diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2014-10-03 10:38:28 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-10-03 10:38:28 -0700 |
| commit | ef6075057783225235b5d3f90918ca239b0c17dc (patch) | |
| tree | 58fd27e56d9b78df9e7ca41ead669a526b1ac2c6 | |
| parent | 3509407b2ed9ba680b1fff85ca9349f8c74111cd (diff) | |
| parent | d6c32229d74c48d50fa3a40a03ee3d7e78a77346 (diff) | |
Merge "Release 1.0.0.204 QCACLD WLAN Driver"
77 files changed, 372 insertions, 43093 deletions
diff --git a/CORE/BAP/inc/bapApi.h b/CORE/BAP/inc/bapApi.h deleted file mode 100644 index c5a2eaf1de0c..000000000000 --- a/CORE/BAP/inc/bapApi.h +++ /dev/null @@ -1,2947 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - -#ifndef WLAN_QCT_WLANBAP_H -#define WLAN_QCT_WLANBAP_H - -/*=========================================================================== - - W L A N B T - A M P P A L L A Y E R - E X T E R N A L A P I - - -DESCRIPTION - This file contains the external API exposed by the wlan BT-AMP PAL layer - module. -===========================================================================*/ - - -/*=========================================================================== - - 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/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/inc/bapApi.h,v 1.21 2009/03/09 08:58:26 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $ - - -when who what, where, why --------- --- ---------------------------------------------------------- -07/01/08 jez Created module. - -===========================================================================*/ - - - -/*=========================================================================== - - INCLUDE FILES FOR MODULE - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include "vos_api.h" -#include "vos_packet.h" -//I need the TL types and API -#include "wlan_qct_tl.h" - -/* BT-AMP PAL API structure types - FramesC generated */ -#include "btampHCI.h" - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - #ifdef __cplusplus - extern "C" { - #endif - - -/*---------------------------------------------------------------------------- - * HCI Interface supported - * - * Here we list the HCI Commands and Events which our 802.11 BT-AMP PAL - * supports. - * - * -------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- - Supported HCI Commands ----------------------------------------------------------------------------*/ -#if 0 -/** BT v3.0 Link Control commands */ - BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD, - BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD, - BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD, - BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD, - BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD, - BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD, - BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD, - BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD, -/* -Host Controller and Baseband Commands -*/ - BTAMP_TLV_HCI_RESET_CMD, - BTAMP_TLV_HCI_SET_EVENT_MASK_CMD, - BTAMP_TLV_HCI_FLUSH_CMD, - BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD, - BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD, - BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD, - BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD, -/* v3.0 Host Controller and Baseband Commands */ - BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD, - BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD, - BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD, - BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD, - BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD, - BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD, - BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD, - BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TO_CMD, - BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TO_CMD, -/** opcode definition for this command from AMP HCI CR D9r4 markup */ - BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD, -/* End of v3.0 Host Controller and Baseband Commands */ -/* -Informational Parameters -*/ - BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFORMATION_CMD, - BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_COMMANDS_CMD, - BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD, -/* v3.0 Informational commands */ - BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD, -/* -Status Parameters -*/ - BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD, - BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD, - BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD, - BTAMP_TLV_HCI_READ_RSSI_CMD, - BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD, - BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD, - BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD, -/* -Debug Commands -*/ - BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD, - BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD, -#endif - -/*--------------------------------------------------------------------------- - Supported HCI Events ----------------------------------------------------------------------------*/ -#if 0 -/** BT events */ - BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT, - BTAMP_TLV_HCI_COMMAND_STATUS_EVENT, - BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT, - BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT, - BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT, - BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT, - BTAMP_TLV_HCI_QOS_VIOLATION_EVENT, -/** BT v3.0 events */ - BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT, - BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT , - BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT , - BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT , - BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT , - BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT , - BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT , - BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT , - BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT , - BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT , -#endif - - -/*---------------------------------------------------------------------------- - * Defines - * -------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------- - Packet type defines for the AMP to PAL packet encapsulation. ----------------------------------------------------------------------------*/ -#define WLANBAP_HCI_COMMAND_PACKET 0x01 /**< HCI command packet type, characterizing packet types over the - UART and RS232 transports */ -#define WLANBAP_HCI_ACL_DATA_PACKET 0x02 /**< HCI ACL data packet type, characterizing packet types over the - UART and RS232 transports */ -#define WLANBAP_HCI_SCO_DATA_PACKET 0x03 /**< HCI SCO data packet type, characterizing packet types over the - UART and RS232 transports */ -#define WLANBAP_HCI_EVENT_PACKET 0x04 /**< HCI event packet type, characterizing packet types over the - UART and RS232 transports */ -/*--------------------------------------------------------------------------- - HCI Data packet size limitation. ----------------------------------------------------------------------------*/ -#define WLANBAP_MAX_80211_PAL_PDU_SIZE 1492 - -/*--------------------------------------------------------------------------- - HCI Flow Control Modes. ----------------------------------------------------------------------------*/ -#define WLANBAP_FLOW_CONTROL_MODE_PACKET_BASED 0x00 -#define WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED 0x01 - -/*--------------------------------------------------------------------------- - BT "assigned numbers" ----------------------------------------------------------------------------*/ -// Qualcomm Company ID -#define WLANBAP_QUALCOMM_COMPANY_ID 29 - -// HCI Interface version -// Parameter Name Assigned Values -// HCI_Version 0 => Bluetooth HCI Specification 1.0B -// 1 => Bluetooth HCI Specification 1.1 -// 2 => Bluetooth HCI Specification 1.2 -// 3 => Bluetooth HCI Specification 2.0 -// 4 => Bluetooth HCI Specification 2.1 -// 5 => Bluetooth HCI Specification 3.0 -#define WLANBAP_HCI_VERSION 5 -#define WLANBAP_HCI_REVISION 0 -#define WLANBAP_PAL_VERSION 0x01 -#define WLANBAP_PAL_SUBVERSION 0x00 - -// AMP device status -#define WLANBAP_HCI_AMP_STATUS_POWERED_DOWN 0x00 -#define WLANBAP_HCI_AMP_STATUS_NOT_SHARED 0x01 -#define WLANBAP_HCI_AMP_STATUS_SHARED 0x02 -#define WLANBAP_HCI_AMP_STATUS_RESERVED 0x03 - -// ACL Packet types (AMP only uses 0x03) -#define WLANBAP_HCI_PKT_START_NON_FLUSH 0x00 -#define WLANBAP_HCI_PKT_CONT 0x01 -#define WLANBAP_HCI_PKT_START_FLUSH 0x02 -#define WLANBAP_HCI_PKT_AMP 0x03 - -/*--------------------------------------------------------------------------- - BT-AMP PAL supported commands defines - - The Supported Commands configuration parameter lists which HCI commands the -local controller supports. It is implied that if a command is listed as -supported, the feature underlying that command is also supported. - The Supported Commands is a 64 octet bit field. If a bit is set to 1, then -this command is supported. - ----------------------------------------------------------------------------*/ -// 0 1 2 3 4 5 6 7 - -#define WLANBAP_PAL_SUPPORTED_HCI_CMDS { \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x0c, \ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x88, 0x3c, \ - 0x00, 0x00, 0x00, 0x40, 0x00, 0xff, 0xff, 0x07, \ - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ -} - -/*--------------------------------------------------------------------------- - BT-AMP PAL "status" and "reason" error code defines ----------------------------------------------------------------------------*/ -#define WLANBAP_STATUS_SUCCESS (0x00) /* Success. Section 3.1.7 */ - -#define WLANBAP_ERROR_UNKNOWN_HCI_CMND (0x01) -#define WLANBAP_ERROR_NO_CNCT (0x02) /* AMP HCI Section 7.1.39 */ -#define WLANBAP_ERROR_HARDWARE_FAILURE (0x03) -#define WLANBAP_ERROR_PAGE_TIMEOUT (0x04) -/* Section 3.1.10 has this mis-identified as 0x08 */ -#define WLANBAP_ERROR_AUTHENT_FAILURE (0x05) -#define WLANBAP_ERROR_KEY_MISSING (0x06) -#define WLANBAP_ERROR_MEMORY_FULL (0x07) -#define WLANBAP_ERROR_CNCT_TIMEOUT (0x08) /* Section 3.1.8 */ -#define WLANBAP_ERROR_MAX_NUM_CNCTS (0x09) /* Section 3.1.8 */ -#define WLANBAP_ERROR_MAX_NUM_SCO_CNCTS (0x0a) -#define WLANBAP_ERROR_MAX_NUM_ACL_CNCTS (0x0b) -#define WLANBAP_ERROR_CMND_DISALLOWED (0x0c) /* Section 4.1 */ -#define WLANBAP_ERROR_HOST_REJ_RESOURCES (0x0d) /* Section 3.1.7 */ -#define WLANBAP_ERROR_HOST_REJ_SECURITY (0x0e) -#define WLANBAP_ERROR_HOST_REJ_PERSONAL_DEV (0x0f) -#define WLANBAP_ERROR_HOST_TIMEOUT (0x10) -#define WLANBAP_ERROR_UNSUPPORT_FEAT_PARAM (0x11) -#define WLANBAP_ERROR_INVALID_HCI_CMND_PARAM (0x12) -#define WLANBAP_ERROR_TERM_CNCT_USER_ENDED (0x13) -#define WLANBAP_ERROR_TERM_CNCT_LOW_RESOURCE (0x14) -#define WLANBAP_ERROR_TERM_CNCT_POWER_OFF (0x15) -/* Section 3.1.9 has a contradictory semantics of "failed connection" */ -#define WLANBAP_ERROR_TERM_BY_LOCAL_HOST (0x16) /* Section 3.1.8 */ -#define WLANBAP_ERROR_REPEATED_ATTEMPTS (0x17) -#define WLANBAP_ERROR_PAIRING_NOT_ALLOWED (0x18) -#define WLANBAP_ERROR_UNKNOWN_LMP_PDU (0x19) -#define WLANBAP_ERROR_UNSUPPORTED_REMOTE_FEAT (0x1a) -#define WLANBAP_ERROR_SCO_REJ (0x1b) -#define WLANBAP_ERROR_SCO_INTERVAL_REJ (0x1c) -#define WLANBAP_ERROR_SCO_AIR_MODE_REJ (0x1d) -#define WLANBAP_ERROR_INVALID_LMP_PARAMETER (0x1e) -#define WLANBAP_ERROR_UNSPECIFIED_ERROR (0x1f) -#define WLANBAP_ERROR_UNSUPPORTED_LMP_PARAM (0x20) -#define WLANBAP_ERROR_ROLE_CHANGE_NOT_ALLOWED (0x21) -#define WLANBAP_ERROR_LMP_RESPONSE_TIMEOUT (0x22) -#define WLANBAP_ERROR_LMP_ERROR_TRANS_COLLISION (0x23) -#define WLANBAP_ERROR_LMP_PDU_NOT_ALLOWED (0x24) -#define WLANBAP_ERROR_ENCRYPTION_MODE_NOT_ACCEPTABLE (0x25) -#define WLANBAP_ERROR_UNIT_KEY_USED (0x26) -#define WLANBAP_ERROR_QOS_IS_NOT_SUPPORTED (0x27) -#define WLANBAP_ERROR_INSTANT_PASSED (0x28) -#define WLANBAP_ERROR_UNIT_KEY_PAIRING_UNSUPPORTED (0x29) - -#define WLANBAP_ERROR_DIFFERENT_TRANS_COLLISION (0x2A) - -/* reserved (0x2B) */ - -#define WLANBAP_ERROR_QOS_UNACCEPTABLE_PARAMETER (0x2C) -#define WLANBAP_ERROR_QOS_REJECTED (0x2D) -#define WLANBAP_ERROR_CHANNEL_CLASSIFICATION_NS (0x2E) -#define WLANBAP_ERROR_INSUFFICIENT_SECURITY (0x2F) -#define WLANBAP_ERROR_PARM_OUT_OF_MANDATORY_RANGE (0x30) - -/* reserved (0x31) */ - -#define WLANBAP_ERROR_ROLE_SWITCH_PENDING (0x32) - -/* reserved (0x33) */ - -#define WLANBAP_ERROR_RESERVED_SLOT_VIOLATION (0x34) -#define WLANBAP_ERROR_ROLE_SWITCH_FAILED (0x35) -#define WLANBAP_ERROR_EIR_TOO_LARGE (0x36) -#define WLANBAP_ERROR_SSP_NOT_SUPPORTED_BY_HOST (0x37) -#define WLANBAP_ERROR_HOST_BUSY_PAIRING (0x38) -#define WLANBAP_ERROR_NO_SUITABLE_CHANNEL (0x39) -#define WLANBAP_ERROR_CONTROLLER_BUSY (0x3A) - -/*---------------------------------------------------------------------------- - * Event_Mask_Page_2 defines for events - * -------------------------------------------------------------------------*/ -#define WLANBAP_EVENT_MASK_NONE 0x0000000000000000 //No events specified (default) -#define WLANBAP_EVENT_MASK_PHY_LINK_COMPLETE_EVENT 0x0000000000000001 //Physical Link Complete Event -#define WLANBAP_EVENT_MASK_CHANNEL_SELECTED_EVENT 0x0000000000000002 //Channel Selected Event -#define WLANBAP_EVENT_MASK_DISC_PHY_LINK_EVENT 0x0000000000000004 //Disconnection Physical Link Event -#define WLANBAP_EVENT_MASK_PHY_LINK_LOSS_EARLY_WARNING_EVENT 0x0000000000000008 //Physical Link Loss Early Warning Event -#define WLANBAP_EVENT_MASK_PHY_LINK_RECOVERY_EVENT 0x0000000000000010 //Physical Link Recovery Event -#define WLANBAP_EVENT_MASK_LOG_LINK_COMPLETE_EVENT 0x0000000000000020 //Logical Link Complete Event -#define WLANBAP_EVENT_MASK_DISC_LOG_LINK_COMPLETE_EVENT 0x0000000000000040 //Disconnection Logical Link Complete Event -#define WLANBAP_EVENT_MASK_FLOW_SPEC_MOD_COMPLETE_EVENT 0x0000000000000080 //Flow Spec Modify Complete Event -#define WLANBAP_EVENT_MASK_NUM_COMPLETED_DATA_BLOCKS_EVENT 0x0000000000000100 //Number of Completed Data Blocks Event -#define WLANBAP_EVENT_MASK_AMP_START_TEST_EVENT 0x0000000000000200 //AMP Start Test Event -#define WLANBAP_EVENT_MASK_AMP_TEST_END_EVENT 0x0000000000000400 //AMP Test End Event -#define WLANBAP_EVENT_MASK_AMP_RCVR_REPORT_EVENT 0x0000000000000800 //AMP Receiver Report Event -#define WLANBAP_EVENT_MASK_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT 0x0000000000001000 //Short Range Mode Change Complete Event -#define WLANBAP_EVENT_MASK_AMP_STATUS_CHANGE_EVENT 0x0000000000002000 //AMP Status Change Event -#define WLANBAP_EVENT_MASK_RESERVED 0xFFFFFFFFFFFFC000 //Reserved for future use - -/*---------------------------------------------------------------------------- - * Typedefs - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Opaque BAP handle Type Declaration - * -------------------------------------------------------------------------*/ -typedef v_PVOID_t tBtampHandle, *ptBtampHandle; - -/*---------------------------------------------------------------------------- - * BAP per-session Context Data Type Declaration - * -------------------------------------------------------------------------*/ -// Move this to bapInternal.h, where it belongs. -// For now, it is just the same thing as the per application context. -//typedef struct sBtampContext tBtampSessCtx; - - -/*--------------------------------------------------------------------------- - HCI Event union ----------------------------------------------------------------------------*/ -typedef struct sBtampHCI_Event { - v_U8_t bapHCIEventCode; /* The event code. To dis-ambiguate. */ - union { - tBtampTLVHCI_Channel_Selected_Event btampChannelSelectedEvent; - tBtampTLVHCI_Command_Complete_Event btampCommandCompleteEvent ; - tBtampTLVHCI_Command_Status_Event btampCommandStatusEvent ; - tBtampTLVHCI_Data_Buffer_Overflow_Event btampDataBufferOverflowEvent ; - tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event btampDisconnectLogicalLinkCompleteEvent ; - tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event btampDisconnectPhysicalLinkCompleteEvent ; - /* Flow_Spec_Modify_Complete_Event is generated after the flow spec modify cmd completes */ - tBtampTLVHCI_Flow_Spec_Modify_Complete_Event btampFlowSpecModifyCompleteEvent ; - /* Asynchronous Flush_Occurred Event CAN ALSO BE generated after the flush cmd completes */ - tBtampTLVHCI_Flush_Occurred_Event btampFlushOccurredEvent ; - tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event btampGenericAMPLinkKeyNotificationEvent ; - tBtampTLVHCI_Hardware_Error_Event btampHardwareErrorEvent ; - tBtampTLVHCI_Logical_Link_Complete_Event btampLogicalLinkCompleteEvent ; - tBtampTLVHCI_Loopback_Command_Event btampLoopbackCommandEvent ; - tBtampTLVHCI_Physical_Link_Complete_Event btampPhysicalLinkCompleteEvent ; - tBtampTLVHCI_Physical_Link_Loss_Warning_Event btampPhysicalLinkLossWarningEvent ; - tBtampTLVHCI_Physical_Link_Recovery_Event btampPhysicalLinkRecoveryEvent ; - tBtampTLVHCI_Qos_Violation_Event btampQosViolationEvent ; - tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event btampShortRangeModeChangeCompleteEvent ; - tBtampTLVHCI_Num_Completed_Pkts_Event btampNumOfCompletedPktsEvent; - tBtampTLVHCI_Num_Completed_Data_Blocks_Event btampNumOfCompletedDataBlocksEvent; - tBtampTLVHCI_Enhanced_Flush_Complete_Event btampEnhancedFlushCompleteEvent ; - } u; -} tBtampHCI_Event, *tpBtampHCI_Event; - -/* 802.3 header */ -typedef struct -{ - /* Destination address field */ - v_U8_t vDA[VOS_MAC_ADDR_SIZE]; - - /* Source address field */ - v_U8_t vSA[VOS_MAC_ADDR_SIZE]; - - /* Length field */ - v_U16_t usLenType; /* Num bytes in info field (i.e., exclude 802.3 hdr) */ - /* Max length 1500 (0x5dc) (What about 0x5ee? That - * includes 802.3 Header and FCS.) */ -}WLANBAP_8023HeaderType; - - -/* - * A list of Command Complete event msgs which will be - * signalled by the Event Callback - */ -#if 0 -/* The tBtampTLVHCI_Command_Complete_Event structure includes each of these*/ -/* HCI Reset: status */ -/* HCI Flush: status, log_link_handle */ - -#endif - -/* - * Command Complete event msgs which will be formed by the caller - * Now an invocation of btampPackTlvHCI_Command_Complete_Event() - * supports generating command complete event messages for all commands... - */ -/* The tBtampTLVHCI_Command_Complete_Event structure includes each of these*/ -#if 0 -/* HCI Cancel Logical Link: status, phy_link_handle, tx_flow_spec_id */ -/* HCI Set Event Mask: status */ -/* HCI Read Connection Accept Timeout: status, connection_accept_timeout */ -/* HCI Write Connection Accept Timeout: status */ -/* HCI Read Link Supervision Timeout: status, log_link_handle (8 sig bits only), link_supervision_timeout */ -/* HCI Write Link Supervision Timeout: status, log_link_handle (8 bits sig only) */ -/* HCI Read Logical Link Accept Timeout: status, logical_link_accept_timeout */ -/* HCI Write Logical Link Accept Timeout: status */ -/* HCI Set Event Mask Page 2: status */ -/* HCI Read Location Data: status, loc_domain_aware, loc_domain, loc_options */ -/* HCI Write Location Data: status */ -/* HCI Read Flow Control Mode: status, flow_control_mode */ -/* HCI Write Flow Control Mode: status */ -/* HCI Read Best Effort Flush Timeout: status, (logical_link_handle ? No!), best_effort_flush_timeout */ -/* HCI Write Best Effort Flush Timeout: status */ -/* HCI Set Short Range Mode: status */ -/* HCI Read Local Version Info: status, HC_HCI_Version, HC_HCI_Revision, HC_PAL_Version, HC_Manufac_Name, HC_PAL_Sub_Version */ -/* HCI Read Local supported commands: status, HC_Support_Cmds */ -/* HCI Read Buffer Size: status, HC_ACL_Data_Packet_Length, HC_SCO_Packet_Length, HC_Total_Num_ACL_Packets, HC_Total_Num_SCO_Packets */ -/* HCI Read Data Block Size: status, HC_Max_ACL_Data_Packet_Length, HC_Data_Block_Length, HC_Total_Num_Data_Blocks */ -/* HCI Read Failed Contact Counter: status, log_link_handle, *pFailedContactCounter */ -/* HCI Reset Failed Contact Counter: status, log_link_handle */ -/* HCI Read Link Quality: status, log_link_handle(?Yes!?), link_quality */ -/* HCI Read RSSI: status, phy_link_handle, rssi */ -/* HCI Read Local AMP Info: status, HC_AMP_Status, HC_Total_BW, HC_Max_Guaranteed_BW, HC_Min_Latency, HC_Max_PDU_Size, HC_Controller_Type, HC_PAL_Capabilities, HC_AMP_Assoc_Length, HC_Max_Flush_Timeout, HC_BE_Flush_Timeout */ -/* HCI Read Local AMP Assoc: status, phy_link_handle, AMP ASSOC remaining length (just actual length, in practice), AMP ASSOC fragment (byte string) */ -/* where AMP Assoc consists of: HC_mac_addr, pref channel (HC_pref_country, HC_pref_triplets), Cnct channel (HC_cnct_country, HC_cnct_triplets), HC_pal_capabilities, HC_pal_version */ -/* HCI Write Remote AMP Assoc: status, phy_link_handle */ -/* HCI Read Loopback Mode: status, loopback_mode */ -/* HCI Write Loopback Mode: status */ - -#endif - -/* BT AMP configuration items */ -typedef struct -{ - /* user preferred channel on which we start the link */ - v_U8_t ucPreferredChannel; - -}WLANBAP_ConfigType; - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - VOSS interfaces - Device initialization - ---------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_Open - - DESCRIPTION - Called at driver initialization (vos_open). BAP will initialize - all its internal resources and will wait for the call to start to - register with the other modules. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Open -( - v_PVOID_t pvosGCtx -); - -/*========================================================================== - - FUNCTION WLANBAP_Start - - DESCRIPTION - Called as part of the overall start procedure (vos_start). BAP will - use this call to register with TL as the BAP entity for - BT-AMP RSN frames. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - Other codes can be returned as a result of a BAL failure; - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Start -( - v_PVOID_t pvosGCtx -); - -/*========================================================================== - - FUNCTION WLANBAP_Stop - - DESCRIPTION - Called by vos_stop to stop operation in BAP, before close. BAP will suspend all - BT-AMP Protocol Adaption Layer operation and will wait for the close - request to clean up its resources. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Stop -( - v_PVOID_t pvosGCtx -); - -/*========================================================================== - - FUNCTION WLANBAP_Close - - DESCRIPTION - Called by vos_close during general driver close procedure. BAP will clean up - all the internal resources. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Close -( - v_PVOID_t pvosGCtx -); - -/*---------------------------------------------------------------------------- - HDD interfaces - Per instance initialization - ---------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_GetNewHndl - - DESCRIPTION - Called by HDD at driver open (BSL_Open). BAP will initialize - allocate a per-instance "file handle" equivalent for this specific - open call. - - There should only ever be one call to BSL_Open. Since - the open app user is the BT stack. - - - DEPENDENCIES - - PARAMETERS - - IN - hBtampHandle: Handle to return btampHandle value in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetNewHndl -( - ptBtampHandle *hBtampHandle /* Handle to return btampHandle value in */ -); - -/*========================================================================== - - FUNCTION WLANBAP_ReleaseHndl - - DESCRIPTION - Called by HDD at driver close (BSL_Close). BAP will reclaim (invalidate) - the "file handle" passed into this call. - - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: btampHandle value to invalidate. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to btampHandle is NULL ; access would cause a - page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_ReleaseHndl -( - ptBtampHandle btampHandle /* btamp handle value to release */ -); - -/*---------------------------------------------------------------------------- - HDD interfaces - Data plane - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - HDD Data callbacks - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION (*WLANBAP_STAFetchPktCBType)() - - DESCRIPTION - Type of the fetch packet callback registered with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_STAFetchPktCBType routine being called. Which is called by - TL when the scheduling algorithms allows for transmission of another - packet to the module. - - This function is here to "wrap" or abstract WLANTL_STAFetchPktCBType. - Because the BAP-specific HDD "shim" layer (BSL) doesn't know anything - about STAIds, or other parameters required by TL. - - - PARAMETERS - - IN - pHddHdl: The HDD(BSL) specific context for this association. - Use the STAId passed to me by TL in WLANTL_STAFetchCBType - to retreive this value. - - IN/OUT - pucAC: access category requested by TL, if HDD does not have - packets on this AC it can choose to service another AC - queue in the order of priority - - OUT - vosDataBuff: pointer to the VOSS data buffer that was transmitted - tlMetaInfo: meta info related to the data frame - - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ - -typedef VOS_STATUS (*WLANBAP_STAFetchPktCBType)( - v_PVOID_t pHddHdl, - WLANTL_ACEnumType ucAC, - vos_pkt_t** vosDataBuff, - WLANTL_MetaInfoType* tlMetaInfo); - - - -/*---------------------------------------------------------------------------- - - FUNCTION (*WLANBAP_STARxCBType)( ) - - DESCRIPTION - Type of the receive callback registered with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_STARxCBType routine being called. Which is called by - TL to notify when a packet was received for a registered STA. - - PARAMETERS - - IN - pHddHdl: The HDD(BSL) specific context for this association. - Use the STAId passed to me by TL in WLANTL_STARxCBType - to retrieve this value. - - vosDataBuff: pointer to the VOSS data buffer that was received - (it may be a linked list) - pRxMetaInfo: Rx meta info related to the data frame - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -typedef VOS_STATUS (*WLANBAP_STARxCBType)( v_PVOID_t pHddHdl, - vos_pkt_t* vosDataBuff, - WLANTL_RxMetaInfoType* pRxMetaInfo); - - - -/*---------------------------------------------------------------------------- - - FUNCTION (*WLANBAP_TxCompCBType)() - - DESCRIPTION - Type of the tx complete callback registered with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_TxCompCBType routine being called. Which is called by - TL to notify when a transmission for a packet has ended. - - PARAMETERS - - IN - pHddHdl: The HDD(BSL) specific context for this association. - <<How do I retrieve this from pvosGCtx? Which is all - the TL WLANTL_TxCompCBType routine provides me.>> - vosDataBuff: pointer to the VOSS data buffer that was transmitted - wTxSTAtus: status of the transmission - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -typedef VOS_STATUS (*WLANBAP_TxCompCBType)( v_PVOID_t pHddHdl, - vos_pkt_t* vosDataBuff, - VOS_STATUS wTxSTAtus ); - -/*---------------------------------------------------------------------------- - HDD Data plane API - ---------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_RegisterDataPlane - - DESCRIPTION - The HDD calls this routine to register the "data plane" routines - for Tx, Rx, and Tx complete with BT-AMP. For now, with only one - physical association supported at a time, this COULD be called - by HDD at the same time as WLANBAP_GetNewHndl. But, in general - it needs to be called upon each new physical link establishment. - - This registration is really two part. The routines themselves are - registered here. But, the mapping between the BSL context and the - actual physical link takes place during WLANBAP_PhysicalLinkCreate. - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_RegisterDataPlane -( - ptBtampHandle btampHandle, /* BTAMP context */ - WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB, - WLANBAP_STARxCBType pfnBtamp_STARxCB, - WLANBAP_TxCompCBType pfnBtampTxCompCB, - // phy_link_handle, of course, doesn't come until much later. At Physical Link create. - v_PVOID_t pHddHdl /* BSL specific context */ -); -//#endif - -/*=========================================================================== - - FUNCTION WLANBAP_XlateTxDataPkt - - DESCRIPTION - - HDD will call this API when it has a HCI Data Packet and it wants - to translate it into a 802.3 LLC frame - ready to send using TL. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) - - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the BT-AMP packet to be - translated to an 802.3 LLC frame - tlMetaInfo: return meta info gleaned from the outgoing frame, here. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_XlateTxDataPkt -( - ptBtampHandle btampHandle, /* Used by BAP to identify the actual session - and therefore addresses */ - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType *pucAC, /* Return the AC here */ - WLANTL_MetaInfoType *tlMetaInfo, /* Return the MetaInfo here. An assist to WLANBAP_STAFetchPktCBType */ - vos_pkt_t *vosDataBuff -); - -/*=========================================================================== - - FUNCTION WLANBAP_XlateRxDataPkt - - DESCRIPTION - - HDD will call this API when it has received a 802.3 (TL/UMA has - Xlated from 802.11) frame from TL and it wants to form a - BT HCI Data Packet - ready to signal up to the BT stack application. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the 802.3 frame to be - translated to BT HCI Data Packet - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_XlateRxDataPkt -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType *pucAC, /* Return the AC here. I don't think this is needed */ - vos_pkt_t *vosDataBuff -); - -/*=========================================================================== - - FUNCTION WLANBAP_STAPktPending - - DESCRIPTION - - HDD will call this API when a packet is pending transmission in its - queues. HDD uses this instead of WLANTL_STAPktPending because he is - not aware of the mapping from session to STA ID. - - DEPENDENCIES - - HDD must have called WLANBAP_GetNewHndl before calling this API. - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - BSL can obtain this from the physical handle value in the - downgoing HCI Data Packet. He, after all, was there - when the PhysicalLink was created. He knew the btampHandle - value returned by WLANBAP_GetNewHndl. He knows as well, his - own pHddHdl (see next). - phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) - ucAc: The access category for the pending frame - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_STAPktPending -( - ptBtampHandle btampHandle, /* Used by BAP to identify the app context and VOSS ctx (!?) */ - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType ucAc /* This is the first instance of a TL type in bapApi.h */ -); - -/*---------------------------------------------------------------------------- - * BT-AMP PAL HCI Event callback types - *--------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION (*tpWLAN_BAPEventCB)() - - DESCRIPTION - Implements the callback for ALL asynchronous events. - Including Events resulting from: - * HCI Create Physical Link, - * Disconnect Physical Link, - * Create Logical Link, - * Flow Spec Modify, - * HCI Reset, - * HCI Flush,... - - DEPENDENCIES - NA. - - PARAMETERS - - IN - pHddHdl: The HDD(BSL) specific context for this association. - BSL gets this from the downgoing packets Physical handle - value. - pBapHCIEvent: pointer to the union of "HCI Event" structures. Contains all info - needed for HCI event. - assoc_specific_event: flag indicates assoc-specific (1) or global (0) event - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -typedef VOS_STATUS (*tpWLAN_BAPEventCB) -( - v_PVOID_t pHddHdl, /* this could refer to either the BSL per - association context which got passed in during - register data plane OR the BSL per application - context passed in during register BAP callbacks - based on setting of the Boolean flag below */ - /* It's like each of us is using the other */ - /* guys reference when invoking him. */ - tpBtampHCI_Event pBapHCIEvent, /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ - v_BOOL_t assoc_specific_event /* Flag to indicate global or assoc-specific event */ -); - - -/*---------------------------------------------------------------------------- - HCI Event Callback Registration routine - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPRegisterBAPCallbacks() - - DESCRIPTION - Register the BAP "Event" callbacks. - Return the per instance handle. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pBapHCIEventCB: pointer to the Event callback - pAppHdl: The context passed in by caller. (I.E., BSL app specific context.) - - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIEventCB is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPRegisterBAPCallbacks -( - ptBtampHandle btampHandle, /* BSL uses my handle to talk to me */ - /* Returned from WLANBAP_GetNewHndl() */ - /* It's like each of us is using the other */ - /* guys reference when invoking him. */ - tpWLAN_BAPEventCB pBapHCIEventCB, /*Implements the callback for ALL asynchronous events. */ - v_PVOID_t pAppHdl // Per-app BSL context -); - - - -/*---------------------------------------------------------------------------- - Host Controller Interface Procedural API - ---------------------------------------------------------------------------*/ - -/** BT v3.0 Link Control commands */ - -/*---------------------------------------------------------------------------- - Each of the next eight command result in asynchronous events (e.g., - HCI_PHYSICAL_LINK_COMPLETE_EVENT, HCI_LOGICAL_LINK_COMPLETE_EVENT, etc...) - These are signalled thru the event callback. (I.E., (*tpWLAN_BAPEventCB).) - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkCreate() - - DESCRIPTION - Implements the actual HCI Create Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - WLANBAP_GetNewHndl has to be called before every call to - WLAN_BAPPhysicalLinkCreate. Since the context is per - physical link. - pBapHCIPhysLinkCreate: pointer to the "HCI Create Physical Link" Structure. - pHddHdl: The context passed in by the caller. (e.g., BSL specific context) - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkCreate is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkCreate -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Create_Physical_Link_Cmd *pBapHCIPhysLinkCreate, - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - /* And I get phy_link_handle from the Command */ - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkAccept() - - DESCRIPTION - Implements the actual HCI Accept Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIPhysLinkAccept: pointer to the "HCI Accept Physical Link" Structure. - pHddHdl: The context passed in by the caller. (e.g., BSL specific context) - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkAccept is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkAccept -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Accept_Physical_Link_Cmd *pBapHCIPhysLinkAccept, - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - /* And I get phy_link_handle from the Command */ - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkDisconnect() - - DESCRIPTION - Implements the actual HCI Disconnect Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIPhysLinkDisconnect: pointer to the "HCI Disconnect Physical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkDisconnect is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkDisconnect -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pBapHCIPhysLinkDisconnect, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkCreate() - - DESCRIPTION - Implements the actual HCI Create Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkCreate: pointer to the "HCI Create Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCreate is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkCreate -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Create_Logical_Link_Cmd *pBapHCILogLinkCreate, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkAccept() - - DESCRIPTION - Implements the actual HCI Accept Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkAccept: pointer to the "HCI Accept Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkAccept is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkAccept -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Accept_Logical_Link_Cmd *pBapHCILogLinkAccept, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkDisconnect() - - DESCRIPTION - Implements the actual HCI Disconnect Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkDisconnect: pointer to the "HCI Disconnect Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkDisconnect is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkDisconnect -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pBapHCILogLinkDisconnect, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkCancel() - - DESCRIPTION - Implements the actual HCI Cancel Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkCancel: pointer to the "HCI Cancel Logical Link" 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.) - (BTW, the required "HCI Logical Link Complete Event" - will be generated by the BAP state machine and sent up - via the (*tpWLAN_BAPEventCB).) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCancel is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkCancel -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Logical_Link_Cancel_Cmd *pBapHCILogLinkCancel, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPFlowSpecModify() - - DESCRIPTION - Implements the actual HCI Modify Logical Link command - Produces an asynchronous flow spec modify complete event. Through the - event callback. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlowSpecModify: pointer to the "HCI Flow Spec Modify" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIFlowSpecModify is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPFlowSpecModify -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Flow_Spec_Modify_Cmd *pBapHCIFlowSpecModify, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/* Host Controller and Baseband Commands */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReset() - - DESCRIPTION - Implements the actual HCI Reset command. - Produces an asynchronous command complete event. Through the - command complete callback. (I.E., (*tpWLAN_BAPEventCB).) - - 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_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReset -( - ptBtampHandle btampHandle -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetEventMask() - - DESCRIPTION - Implements the actual HCI Set Event Mask 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. - pBapHCISetEventMask: pointer to the "HCI Set Event Mask" 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 pBapHCISetEventMask is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetEventMask -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Event_Mask_Cmd *pBapHCISetEventMask, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPFlush() - - DESCRIPTION - Implements the actual HCI Flush command - Produces an asynchronous command complete event. Through the - event callback. And an asynchronous Flush occurred event. Also through the - event callback. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlush: pointer to the "HCI Flush" Structure. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIFlush is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPFlush -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Flush_Cmd *pBapHCIFlush -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_EnhancedBAPFlush() - - DESCRIPTION - Implements the actual HCI Enhanced Flush command - Produces an asynchronous command complete event. Through the command status - event callback. And an asynchronous Enhanced Flush Complete event. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlush: pointer to the "HCI Enhanced Flush" 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 pBapHCIFlush is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_EnhancedBAPFlush -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Enhanced_Flush_Cmd *pBapHCIFlush, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ - -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadConnectionAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Read Connection Accept Timeout 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 pBapHCIReadConnectionAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadConnectionAcceptTimeout -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete */ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteConnectionAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Write Connection Accept Timeout 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. - pBapHCIWriteConnectionAcceptTimeout: pointer to the "HCI Connection Accept Timeout" 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 pBapHCIWriteConnectionAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteConnectionAcceptTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pBapHCIWriteConnectionAcceptTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLinkSupervisionTimeout() - - DESCRIPTION - Implements the actual HCI Read Link Supervision Timeout 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 pBapHCIReadLinkSupervisionTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLinkSupervisionTimeout -( - ptBtampHandle btampHandle, - /* Only 8 bits (phy_link_handle) of this log_link_handle are valid. */ - tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pBapHCIReadLinkSupervisionTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLinkSupervisionTimeout() - - DESCRIPTION - Implements the actual HCI Write Link Supervision Timeout 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. - pBapHCIWriteLinkSupervisionTimeout: pointer to the "HCI Link Supervision Timeout" 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 pBapHCIWriteLinkSupervisionTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLinkSupervisionTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pBapHCIWriteLinkSupervisionTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/* v3.0 Host Controller and Baseband Commands */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLogicalLinkAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Read Logical Link Accept Timeout 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 pBapHCIReadLogicalLinkAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLogicalLinkAcceptTimeout -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLogicalLinkAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Write Logical Link Accept Timeout 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. - pBapHCIWriteLogicalLinkAcceptTimeout: pointer to the "HCI Logical Link Accept Timeout" 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 pBapHCIWriteLogicalLinkAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLogicalLinkAcceptTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pBapHCIWriteLogicalLinkAcceptTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetEventMaskPage2() - - DESCRIPTION - Implements the actual HCI Set Event Mask Page 2 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. - pBapHCISetEventMaskPage2: pointer to the "HCI Set Event Mask Page 2" 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 pBapHCISetEventMaskPage2 is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetEventMaskPage2 -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pBapHCISetEventMaskPage2, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocationData() - - DESCRIPTION - Implements the actual HCI Read Location Data 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 pBapHCIReadLocationData is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocationData -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLocationData() - - DESCRIPTION - Implements the actual HCI Write Location Data 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. - pBapHCIWriteLocationData: pointer to the "HCI Write Location Data" 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 pBapHCIWriteLocationData is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLocationData -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Location_Data_Cmd *pBapHCIWriteLocationData, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadFlowControlMode() - - DESCRIPTION - Implements the actual HCI Read Flow Control Mode 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 pBapHCIReadFlowControlMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadFlowControlMode -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteFlowControlMode() - - DESCRIPTION - Implements the actual HCI Write Flow Control Mode 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. - pBapHCIWriteFlowControlMode: pointer to the "HCI Write Flow Control Mode" 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 pBapHCIWriteFlowControlMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteFlowControlMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pBapHCIWriteFlowControlMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadBestEffortFlushTimeout() - - DESCRIPTION - Implements the actual HCI Read Best Effort Flush Timeout 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 pBapHCIReadBEFlushTO is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadBestEffortFlushTimeout -( - ptBtampHandle btampHandle, - /* The log_link_hanlde identifies which logical link's BE TO*/ - tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pBapHCIReadBEFlushTO, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteBestEffortFlushTimeout() - - DESCRIPTION - Implements the actual HCI Write Best Effort Flush TO 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. - pBapHCIWriteBEFlushTO: pointer to the "HCI Write BE Flush TO" 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 pBapHCIWriteBEFlushTO is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteBestEffortFlushTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pBapHCIWriteBEFlushTO, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetShortRangeMode() - - DESCRIPTION - Implements the actual HCI Set Short Range Mode 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. - pBapHCIShortRangeMode: pointer to the "HCI Set Short Range Mode" 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 pBapHCIShortRangeMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetShortRangeMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pBapHCIShortRangeMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPVendorSpecificCmd0() - - DESCRIPTION - Implements the actual HCI Vendor Specific Command 0 (OGF 0x3f, OCF 0x0000). - 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 pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPVendorSpecificCmd0 -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPVendorSpecificCmd1() - - DESCRIPTION - Implements the actual HCI Vendor Specific Command 1 (OGF 0x3f, OCF 0x0001). - 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 pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPVendorSpecificCmd1 -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/* End of v3.0 Host Controller and Baseband Commands */ - - -/* 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*/ -); - -/*---------------------------------------------------------------------------- - - 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*/ -); - -/*---------------------------------------------------------------------------- - - 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. - - 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*/ -); - -/*---------------------------------------------------------------------------- - - 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*/ -); - -/* -Status Parameters -*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadFailedContactCounter() - - DESCRIPTION - Implements the actual HCI Read Failed Contact Counter 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. - pBapHCIReadFailedContactCounter: pointer to the "HCI Read Failed Contact Counter" 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 pBapHCIReadFailedContactCounter or - pFailedContactCounter is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadFailedContactCounter -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pBapHCIReadFailedContactCounter, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPResetFailedContactCounter() - - DESCRIPTION - Implements the actual HCI Reset Failed Contact Counter 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. - pBapHCIResetFailedContactCounter: pointer to the "HCI Reset Failed Contact Counter" 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 pBapHCIResetFailedContactCounter is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPResetFailedContactCounter -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pBapHCIResetFailedContactCounter, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLinkQuality() - - DESCRIPTION - Implements the actual HCI Read Link Quality 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. - pBapHCIReadLinkQuality: pointer to the "HCI Read Link Quality" 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 pBapHCIReadLinkQuality or - pBapHCILinkQuality is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLinkQuality -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Link_Quality_Cmd *pBapHCIReadLinkQuality, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadRSSI() - - DESCRIPTION - Implements the actual HCI Read RSSI 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. - pBapHCIReadRSSI: pointer to the "HCI Read RSSI" 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 pBapHCIReadRSSI or - pBapHCIRSSI is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadRSSI -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_RSSI_Cmd *pBapHCIReadRSSI, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocalAMPInfo() - - DESCRIPTION - Implements the actual HCI Read Local AMP Information 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. - pBapHCIReadLocalAMPInfo: pointer to the "HCI Read Local AMP Info" 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 pBapHCIReadLocalAMPInfo or - pBapHCILocalAMPInfo is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocalAMPInfo -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pBapHCIReadLocalAMPInfo, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocalAMPAssoc() - - DESCRIPTION - Implements the actual HCI Read Local AMP Assoc 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. - pBapHCIReadLocalAMPAssoc: pointer to the "HCI Read Local AMP Assoc" 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 pBapHCIReadLocalAMPAssoc - (or pBapHCILocalAMPAssoc) is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocalAMPAssoc -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pBapHCIReadLocalAMPAssoc, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteRemoteAMPAssoc() - - DESCRIPTION - Implements the actual HCI Write Remote AMP Assoc 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. - pBapHCIWriteRemoteAMPAssoc: pointer to the "HCI Write Remote AMP Assoc" 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 pBapHCIWriteRemoteAMPAssoc is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteRemoteAMPAssoc -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pBapHCIWriteRemoteAMPAssoc, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/* -Debug Commands -*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLoopbackMode() - - DESCRIPTION - Implements the actual HCI Read Loopback Mode 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. - pBapHCIReadLoopbackMode: pointer to the "HCI Read Loopback Mode". - - 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 pBapHCIReadLoopbackMode or - pBapHCILoopbackMode is NULL. - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLoopbackMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Loopback_Mode_Cmd *pBapHCIReadLoopbackMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLoopbackMode() - - DESCRIPTION - Implements the actual HCI Write Loopback Mode 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. - pBapHCIWriteLoopbackMode: pointer to the "HCI Write Loopback Mode" 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 pBapHCIWriteLoopbackMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLoopbackMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Loopback_Mode_Cmd *pBapHCIWriteLoopbackMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -); - - -/*---------------------------------------------------------------------------- - - 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 -); - -/*=========================================================================== - - FUNCTION WLANBAP_GetAcFromTxDataPkt - - DESCRIPTION - - HDD will call this API when it has a HCI Data Packet (SKB) and it wants - to find AC type of the data frame from the HCI header on the data pkt - - to be send using TL. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - pHciData: Pointer to the HCI data frame - - pucAC: Pointer to return the access category - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetAcFromTxDataPkt -( - ptBtampHandle btampHandle, /* Used by BAP to identify the actual session - and therefore addresses */ - void *pHciData, /* Pointer to the HCI data frame */ - WLANTL_ACEnumType *pucAC /* Return the AC here */ -); - -/*---------------------------------------------------------------------------- - - 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); - -/*---------------------------------------------------------------------------- - - 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 -); - -/*---------------------------------------------------------------------------- - - 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 -); - -#ifdef __cplusplus - } -#endif - - -#endif /* #ifndef WLAN_QCT_WLANBAP_H */ diff --git a/CORE/BAP/inc/btampHCI.h b/CORE/BAP/inc/btampHCI.h deleted file mode 100644 index d0fb4a6142bf..000000000000 --- a/CORE/BAP/inc/btampHCI.h +++ /dev/null @@ -1,2126 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - -#ifndef BTAMPHCI_H -#define BTAMPHCI_H - -/** - * \file btampHCI.h - * - * \brief Structures, function prototypes & definitions - * for working with 802.11 Frames - * - * - * - * - * This file was automatically generated by 'framesc' - * Mon Mar 02 14:06:14 2009 from the following file(s): - * - * btampHCI.frms - * - * PLEASE DON'T EDIT THIS FILE BY HAND! - * - * Instead, please update the input files & re-run - * 'framesc' For more information on 'framesc' & the - * frames language, run 'framesc --help'. - * - * - */ - - -#define WLANBAP_MAX_LOG_LINKS 16 /* Logical links are assigned by BAP */ - - -#if 0 - -/* Calling conventions: The General format of the Unpack and Pack routines */ - -/*========================================================================== - - FUNCTION Unpack_XxxMessage - - DESCRIPTION - Unpack from a Message buffer into a structured type. - - - DEPENDENCIES - - - PARAMETERS - - - IN - void * : halHandle (passed down to the MAC layer and below) - v_U8_t* : Pointer to the source message buffer - v_U16_t : Length in bytes of the contents of the message buffer. - tXxxMessage* : Pointer to the structure in which to return the unpacked values. - - RETURN VALUE - - The result code associated with performing the operation - - - SIDE EFFECTS - -============================================================================*/ -v_U32_t Unpack_XxxMessage(void *, v_U8_t*,v_U16_t, tXxxMessage*); - - -/*========================================================================== - - FUNCTION Pack_XxxMessage - - DESCRIPTION - Pack the data from a structure into a Message buffer. - - - DEPENDENCIES - - - PARAMETERS - - - IN - void * : halHandle (passed down to the MAC layer and below) - tXxxMessage* : Pointer to the structure from which to obtain values. - v_U8_t* : Pointer to the destination message buffer. - v_U32_t : Length in bytes of the destination message buffer. - v_U32_t* : Pointer to return the actual length of the encoded message buffer in. - - - RETURN VALUE - - The result code associated with performing the operation - - SIDE EFFECTS - - -============================================================================*/ -v_U32_t Pack_XxxMessage(void *, tXxxMessage*, v_U8_t*, v_U32_t, v_U32_t*); - -#endif - - -typedef v_U32_t tBTAMP_U64[2]; - -#if defined ( _MSC_VER ) -# pragma warning (disable: 4214) /* nonstandard extension used */ -#endif /* Microsoft C/C++ bit field types other than int */ - -/* - * Frames Return Codes: - * - * Success is indicated by a return value of zero. Failure is indicated - * by the presence of the high bit. Warnings encountered in the course - * of a successful parse are indicated by various bits in the lower 31 - * being turned on. - * - * For instance, a return value of 0x0000000a would indicate that the - * parse succeeded, but that a mandatory IE wasn't present, and some IE - * was found to be corrupt. - * - * - */ - -#define BTAMP_PARSE_SUCCESS ( 0x00000000 ) -#define BTAMP_UNKNOWN_IES ( 0x00000001 ) -#define BTAMP_MANDATORY_IE_MISSING ( 0x00000002 ) -#define BTAMP_INCOMPLETE_IE ( 0x00000004 ) -#define BTAMP_SKIPPED_BAD_IE ( 0x00000008 ) -#define BTAMP_LAST_IE_TOO_LONG ( 0x00000010 ) -#define BTAMP_DUPLICATE_IE ( 0x00000020 ) -#define BTAMP_BAD_FIXED_VALUE ( 0x00000040 ) -#define BTAMP_INCOMPLETE_TLV ( 0x00000080 ) -#define BTAMP_INVALID_TLV_LENGTH ( 0x00000100 ) -#define BTAMP_SKIPPED_BAD_TLV ( 0x00000200 ) -#define BTAMP_UNKNOWN_TLVS ( 0x00000400 ) -#define BTAMP_LAST_TLV_TOO_LONG ( 0x00000800 ) -#define BTAMP_INTERNAL_ERROR ( 0x10000001 ) -#define BTAMP_MISSING_FIXED_FIELD ( 0x10000002 ) -#define BTAMP_BAD_INPUT_BUFFER ( 0x10000003 ) -#define BTAMP_BAD_OUTPUT_BUFFER ( 0x10000004 ) -#define BTAMP_BUFFER_OVERFLOW ( 0x10000005 ) -#define BTAMP_MANDATORY_TLV_MISSING ( 0x00001000 ) -#define BTAMP_FAILED(code) ( (code) & 0x10000000 ) -#define BTAMP_WARNED(code) ( ( ( 0 == (code) ) & 0x10000000 ) && code) -#define BTAMP_SUCCEEDED(code) ( (code) == 0 ) - -/********************************************************************* - * Fixed Fields * - ********************************************************************/ - -/********************************************************************* - * TLVs * - ********************************************************************/ - -// ID 3 (0x0003) -typedef struct sBtampTLVAMP_Assoc_Connected_Channel { - v_U8_t present; - v_U8_t country[3]; - v_U8_t num_triplets; - v_U8_t triplets[5][3]; -} tBtampTLVAMP_Assoc_Connected_Channel; - -#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL ( 3 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL_MIN_LEN ( 5 ) - -#define BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL_MAX_LEN ( 11 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvAMP_Assoc_Connected_Channel(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_Connected_Channel*); - -v_U32_t btampPackTlvAMP_Assoc_Connected_Channel(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvAMP_Assoc_Connected_Channel(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1 (0x0001) -typedef struct sBtampTLVAMP_Assoc_MAC_Addr { - v_U8_t present; - v_U8_t mac_addr[6]; -} tBtampTLVAMP_Assoc_MAC_Addr; - -#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR ( 1 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR_MIN_LEN ( 8 ) - -#define BTAMP_TLV_AMP_ASSOC_MAC_ADDR_MAX_LEN ( 8 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvAMP_Assoc_MAC_Addr(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_MAC_Addr*); - -v_U32_t btampPackTlvAMP_Assoc_MAC_Addr(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvAMP_Assoc_MAC_Addr(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 4 (0x0004) -typedef struct sBtampTLVAMP_Assoc_PAL_Capabilities { - v_U8_t present; - v_U32_t pal_capabilities; -} tBtampTLVAMP_Assoc_PAL_Capabilities; - -#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES ( 4 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES_MIN_LEN ( 6 ) - -#define BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES_MAX_LEN ( 6 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvAMP_Assoc_PAL_Capabilities(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_PAL_Capabilities*); - -v_U32_t btampPackTlvAMP_Assoc_PAL_Capabilities(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Capabilities(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5 (0x0005) -typedef struct sBtampTLVAMP_Assoc_PAL_Version { - v_U8_t present; - v_U8_t pal_version; - v_U16_t pal_CompanyID; - v_U16_t pal_subversion; -} tBtampTLVAMP_Assoc_PAL_Version; - -#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION ( 5 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION_MIN_LEN ( 7 ) - -#define BTAMP_TLV_AMP_ASSOC_PAL_VERSION_MAX_LEN ( 7 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvAMP_Assoc_PAL_Version(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_PAL_Version*); - -v_U32_t btampPackTlvAMP_Assoc_PAL_Version(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Version(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 2 (0x0002) -typedef struct sBtampTLVAMP_Assoc_Preferred_Channel_List { - v_U8_t present; - v_U8_t country[3]; - v_U8_t num_triplets; - v_U8_t triplets[5][3]; -} tBtampTLVAMP_Assoc_Preferred_Channel_List; - -#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST ( 2 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST_MIN_LEN ( 5 ) - -#define BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST_MAX_LEN ( 20 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvAMP_Assoc_Preferred_Channel_List(void *, v_U8_t*,v_U16_t, tBtampTLVAMP_Assoc_Preferred_Channel_List*); - -v_U32_t btampPackTlvAMP_Assoc_Preferred_Channel_List(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 6 (0x0006) -typedef struct sBtampTLVFlow_Spec { - v_U8_t present; - v_U8_t flow_spec_id; - v_U8_t service_type; - v_U16_t max_sdu; - v_U32_t sdu_inter_arrival; - v_U32_t access_latency; - v_U32_t flush_timeout; -} tBtampTLVFlow_Spec; - -#define BTAMP_TLV_FLOW_SPEC ( 6 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_FLOW_SPEC_MIN_LEN ( 18 ) - -#define BTAMP_TLV_FLOW_SPEC_MAX_LEN ( 18 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvFlow_Spec(void *, v_U8_t*,v_U16_t, tBtampTLVFlow_Spec*); - -v_U32_t btampPackTlvFlow_Spec(void *, tBtampTLVFlow_Spec*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvFlow_Spec(void *, tBtampTLVFlow_Spec*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1081 (0x0439) -typedef struct sBtampTLVHCI_Accept_Logical_Link_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t tx_flow_spec[18]; - v_U8_t rx_flow_spec[18]; -} tBtampTLVHCI_Accept_Logical_Link_Cmd; - -#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD ( 1081 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD_MIN_LEN ( 39 ) - -#define BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD_MAX_LEN ( 39 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Accept_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Accept_Logical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Accept_Logical_Link_Cmd(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1078 (0x0436) -typedef struct sBtampTLVHCI_Accept_Physical_Link_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t key_length; - v_U8_t key_type; - v_U8_t key_material[32]; -} tBtampTLVHCI_Accept_Physical_Link_Cmd; - -#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD ( 1078 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD_MAX_LEN ( 37 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Accept_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Accept_Physical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Accept_Physical_Link_Cmd(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 65 (0x0041) -typedef struct sBtampTLVHCI_Channel_Selected_Event { - v_U8_t present; - v_U8_t phy_link_handle; -} tBtampTLVHCI_Channel_Selected_Event; - -#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT ( 65 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Channel_Selected_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Channel_Selected_Event*); - -v_U32_t btampPackTlvHCI_Channel_Selected_Event(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Channel_Selected_Event(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 14 (0x000e) -typedef struct sBtampTLVHCI_Command_Complete_Event { - v_U8_t present; - v_U8_t num_hci_command_packets; - v_U16_t command_opcode; - union - { - struct - { - v_U8_t status; - } Reset; /* command_opcode = c03 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - } Flush; /* command_opcode = c08 */ - struct - { - v_U8_t status; - v_U8_t phy_link_handle; - v_U8_t tx_flow_spec_id; - } Logical_Link_Cancel; /* command_opcode = 43b */ - struct - { - v_U8_t status; - } Set_Event_Mask; /* command_opcode = c05 */ - struct - { - v_U8_t status; - v_U16_t connection_accept_timeout; - } Read_Connection_Accept_TO; /* command_opcode = c15 */ - struct - { - v_U8_t status; - } Write_Connection_Accept_TO; /* command_opcode = c16 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - v_U16_t link_supervision_timeout; - } Read_Link_Supervision_TO; /* command_opcode = c36 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - } Write_Link_Supervision_TO; /* command_opcode = c37 */ - struct - { - v_U8_t status; - v_U16_t logical_link_accept_timeout; - } Read_Logical_Link_Accept_TO; /* command_opcode = c61 */ - struct - { - v_U8_t status; - } Write_Logical_Link_Accept_TO; /* command_opcode = c62 */ - struct - { - v_U8_t status; - } Set_Event_Mask_Page_2; /* command_opcode = c63 */ - struct - { - v_U8_t status; - v_U8_t loc_domain_aware; - v_U8_t loc_domain[3]; - v_U8_t loc_options; - } Read_Location_Data; /* command_opcode = 3172 */ - struct - { - v_U8_t status; - } Write_Location_Data; /* command_opcode = 3173 */ - struct - { - v_U8_t status; - v_U8_t flow_control_mode; - } Read_Flow_Control_Mode; /* command_opcode = 3174 */ - struct - { - v_U8_t status; - } Write_Flow_Control_Mode; /* command_opcode = 3175 */ - struct - { - v_U8_t status; - v_U32_t best_effort_flush_timeout; - } Read_BE_Flush_TO; /* command_opcode = 3177 */ - struct - { - v_U8_t status; - } Write_BE_Flush_TO; /* command_opcode = 3178 */ - struct - { - v_U8_t status; - } Set_Short_Range_Mode; /* command_opcode = 3179 */ - struct - { - v_U8_t status; - v_U8_t HC_HCI_Version; - v_U16_t HC_HCI_Revision; - v_U8_t HC_PAL_Version; - v_U16_t HC_Manufac_Name; - v_U16_t HC_PAL_Sub_Version; - } Read_Local_Version_Info; /* command_opcode = 4097 */ - struct - { - v_U8_t status; - v_U8_t HC_Support_Cmds[64]; - } Read_Local_Supported_Cmds; /* command_opcode = 4098 */ - struct - { - v_U8_t status; - v_U16_t HC_ACL_Data_Packet_Length; - v_U8_t HC_SCO_Packet_Length; - v_U16_t HC_Total_Num_ACL_Packets; - v_U16_t HC_Total_Num_SCO_Packets; - } Read_Buffer_Size; /* command_opcode = 4101 */ - struct - { - v_U8_t status; - v_U16_t HC_Max_ACL_Data_Packet_Length; - v_U16_t HC_Data_Block_Length; - v_U16_t HC_Total_Num_Data_Blocks; - } Read_Data_Block_Size; /* command_opcode = 4106 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - v_U16_t failed_contact_counter; - } Read_Failed_Contact_Counter; /* command_opcode = 5121 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - } Reset_Failed_Contact_Counter; /* command_opcode = 5122 */ - struct - { - v_U8_t status; - v_U16_t log_link_handle; - v_U8_t link_quality; - } Read_Link_Quality; /* command_opcode = 5123 */ - struct - { - v_U8_t status; - /* 2 bytes handle to comply with spec, (lower byte valid) */ - v_U16_t phy_link_handle; - v_S7_t rssi; - } Read_RSSI; /* command_opcode = 5125 */ - struct - { - v_U8_t status; - v_U8_t HC_AMP_Status; - v_U32_t HC_Total_BW; - v_U32_t HC_Max_Guaranteed_BW; - v_U32_t HC_Min_Latency; - v_U32_t HC_Max_PDU_Size; - v_U8_t HC_Controller_Type; - v_U16_t HC_PAL_Capabilities; - v_U16_t HC_AMP_Assoc_Length; - v_U32_t HC_Max_Flush_Timeout; - v_U32_t HC_BE_Flush_Timeout; - } Read_Local_AMP_Info; /* command_opcode = 5129 */ - struct - { - v_U8_t status; - v_U8_t phy_link_handle; - v_U16_t remaining_length; - v_U8_t AMP_assoc_fragment[248]; - } Read_Read_Local_AMP_Assoc; /* command_opcode = 5130 */ - struct - { - v_U8_t status; - v_U8_t phy_link_handle; - } Write_Remote_AMP_Assoc; /* command_opcode = 5131 */ - struct - { - v_U8_t status; - v_U8_t loopback_mode; - } Read_Loopback_Mode; /* command_opcode = 6145 */ - struct - { - v_U8_t status; - } Write_Loopback_Mode; /* command_opcode = 6146 */ - struct - { - v_U8_t status; - } Vendor_Specific_Cmd_0; /* command_opcode = fc00 */ - struct - { - v_U8_t status; - } Vendor_Specific_Cmd_1; /* command_opcode = fc01 */ - } cc_event; -} tBtampTLVHCI_Command_Complete_Event; - -#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT ( 14 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT_MIN_LEN ( 6 ) - -#define BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT_MAX_LEN ( 257 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Command_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Command_Complete_Event*); - -v_U32_t btampPackTlvHCI_Command_Complete_Event(void *, tBtampTLVHCI_Command_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Command_Complete_Event(void *, tBtampTLVHCI_Command_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 15 (0x000f) -typedef struct sBtampTLVHCI_Command_Status_Event { - v_U8_t present; - v_U8_t status; - v_U8_t num_hci_command_packets; - v_U16_t command_opcode; -} tBtampTLVHCI_Command_Status_Event; - -#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT ( 15 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT_MIN_LEN ( 6 ) - -#define BTAMP_TLV_HCI_COMMAND_STATUS_EVENT_MAX_LEN ( 6 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Command_Status_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Command_Status_Event*); - -v_U32_t btampPackTlvHCI_Command_Status_Event(void *, tBtampTLVHCI_Command_Status_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Command_Status_Event(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1080 (0x0438) -typedef struct sBtampTLVHCI_Create_Logical_Link_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t tx_flow_spec[18]; - v_U8_t rx_flow_spec[18]; -} tBtampTLVHCI_Create_Logical_Link_Cmd; - -#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD ( 1080 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD_MIN_LEN ( 39 ) - -#define BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD_MAX_LEN ( 39 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Create_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Create_Logical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Create_Logical_Link_Cmd(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Create_Logical_Link_Cmd(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1077 (0x0435) -typedef struct sBtampTLVHCI_Create_Physical_Link_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t key_length; - v_U8_t key_type; - v_U8_t key_material[32]; -} tBtampTLVHCI_Create_Physical_Link_Cmd; - -#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD ( 1077 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD_MAX_LEN ( 37 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Create_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Create_Physical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Create_Physical_Link_Cmd(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Create_Physical_Link_Cmd(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 26 (0x001a) -typedef struct sBtampTLVHCI_Data_Buffer_Overflow_Event { - v_U8_t present; - v_U8_t link_type; -} tBtampTLVHCI_Data_Buffer_Overflow_Event; - -#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT ( 26 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Data_Buffer_Overflow_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Data_Buffer_Overflow_Event*); - -v_U32_t btampPackTlvHCI_Data_Buffer_Overflow_Event(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1082 (0x043a) -typedef struct sBtampTLVHCI_Disconnect_Logical_Link_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Disconnect_Logical_Link_Cmd; - -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD ( 1082 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 70 (0x0046) -typedef struct sBtampTLVHCI_Disconnect_Logical_Link_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U16_t log_link_handle; - v_U8_t reason; -} tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event; - -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT ( 70 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 6 ) - -#define BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 6 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*); - -v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1079 (0x0437) -typedef struct sBtampTLVHCI_Disconnect_Physical_Link_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t reason; -} tBtampTLVHCI_Disconnect_Physical_Link_Cmd; - -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD ( 1079 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*); - -v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 66 (0x0042) -typedef struct sBtampTLVHCI_Disconnect_Physical_Link_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U8_t phy_link_handle; - v_U8_t reason; -} tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event; - -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT ( 66 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 5 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*); - -v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1084 (0x043c) -typedef struct sBtampTLVHCI_Flow_Spec_Modify_Cmd { - v_U8_t present; - v_U16_t log_link_handle; - v_U8_t be_aggr_counter; - v_U8_t tx_flow_spec[18]; - v_U8_t rx_flow_spec[18]; -} tBtampTLVHCI_Flow_Spec_Modify_Cmd; - -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD ( 1084 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD_MIN_LEN ( 41 ) - -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD_MAX_LEN ( 41 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Cmd*); - -v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Cmd(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 71 (0x0047) -typedef struct sBtampTLVHCI_Flow_Spec_Modify_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U16_t log_link_handle; -} tBtampTLVHCI_Flow_Spec_Modify_Complete_Event; - -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT ( 71 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT_MAX_LEN ( 5 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*); - -v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Complete_Event(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3080 (0x0c08) -typedef struct sBtampTLVHCI_Flush_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Flush_Cmd; - -#define BTAMP_TLV_HCI_FLUSH_CMD ( 3080 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_FLUSH_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_FLUSH_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Flush_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flush_Cmd*); - -v_U32_t btampPackTlvHCI_Flush_Cmd(void *, tBtampTLVHCI_Flush_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Flush_Cmd(void *, tBtampTLVHCI_Flush_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 17 (0x0011) -typedef struct sBtampTLVHCI_Flush_Occurred_Event { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Flush_Occurred_Event; - -#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT ( 17 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Flush_Occurred_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Flush_Occurred_Event*); - -v_U32_t btampPackTlvHCI_Flush_Occurred_Event(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Flush_Occurred_Event(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3167 (0x0C5F) -typedef struct sBtampTLVHCI_Enhanced_Flush_Cmd { - v_U8_t present; - v_U16_t log_link_handle; - v_U8_t packet_type; -} tBtampTLVHCI_Enhanced_Flush_Cmd; - -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD ( 3167 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD_MAX_LEN ( 5 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Enhanced_Flush_Cmd*); - -v_U32_t btampPackTlvHCI_Enhanced_Flush_Cmd(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Cmd(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 57 (0x0039) -typedef struct sBtampTLVHCI_Enhanced_Flush_Complete_Event { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Enhanced_Flush_Complete_Event; - -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT ( 57 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Enhanced_Flush_Complete_Event*); - -v_U32_t btampPackTlvHCI_Enhanced_Flush_Complete_Event(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ - -// ID 62 (0x003e) -typedef struct sBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event { - v_U8_t present; - v_U8_t bd_addr[6]; - v_U8_t generic_amp_link_key[32]; - v_U8_t key_type; -} tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event; - -#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT ( 62 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT_MIN_LEN ( 41 ) - -#define BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT_MAX_LEN ( 41 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*); - -v_U32_t btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 16 (0x0010) -typedef struct sBtampTLVHCI_Hardware_Error_Event { - v_U8_t present; - v_U8_t hardware_code; -} tBtampTLVHCI_Hardware_Error_Event; - -#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT ( 16 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Hardware_Error_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Hardware_Error_Event*); - -v_U32_t btampPackTlvHCI_Hardware_Error_Event(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Hardware_Error_Event(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 1083 (0x043b) -typedef struct sBtampTLVHCI_Logical_Link_Cancel_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t tx_flow_spec_id; -} tBtampTLVHCI_Logical_Link_Cancel_Cmd; - -#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD ( 1083 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Logical_Link_Cancel_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Logical_Link_Cancel_Cmd*); - -v_U32_t btampPackTlvHCI_Logical_Link_Cancel_Cmd(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 69 (0x0045) -typedef struct sBtampTLVHCI_Logical_Link_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U16_t log_link_handle; - v_U8_t phy_link_handle; - v_U8_t flow_spec_id; -} tBtampTLVHCI_Logical_Link_Complete_Event; - -#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT ( 69 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 7 ) - -#define BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 7 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Logical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Logical_Link_Complete_Event*); - -v_U32_t btampPackTlvHCI_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Logical_Link_Complete_Event(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 25 (0x0019) -typedef struct sBtampTLVHCI_Loopback_Command_Event { - v_U8_t present; - v_U8_t hci_command_packet[64]; -} tBtampTLVHCI_Loopback_Command_Event; - -#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT ( 25 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT_MIN_LEN ( 66 ) - -#define BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT_MAX_LEN ( 66 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Loopback_Command_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Loopback_Command_Event*); - -v_U32_t btampPackTlvHCI_Loopback_Command_Event(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Loopback_Command_Event(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 64 (0x0040) -typedef struct sBtampTLVHCI_Physical_Link_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U8_t phy_link_handle; - v_U8_t ch_number; -} tBtampTLVHCI_Physical_Link_Complete_Event; - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT ( 64 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Physical_Link_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Complete_Event*); - -v_U32_t btampPackTlvHCI_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Complete_Event(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 67 (0x0043) -typedef struct sBtampTLVHCI_Physical_Link_Loss_Warning_Event { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t reason; -} tBtampTLVHCI_Physical_Link_Loss_Warning_Event; - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT ( 67 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*); - -v_U32_t btampPackTlvHCI_Physical_Link_Loss_Warning_Event(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 68 (0x0044) -typedef struct sBtampTLVHCI_Physical_Link_Recovery_Event { - v_U8_t present; - v_U8_t phy_link_handle; -} tBtampTLVHCI_Physical_Link_Recovery_Event; - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT ( 68 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Physical_Link_Recovery_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Physical_Link_Recovery_Event*); - -v_U32_t btampPackTlvHCI_Physical_Link_Recovery_Event(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Recovery_Event(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 30 (0x001e) -typedef struct sBtampTLVHCI_Qos_Violation_Event { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Qos_Violation_Event; - -#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT ( 30 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_QOS_VIOLATION_EVENT_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Qos_Violation_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Qos_Violation_Event*); - -v_U32_t btampPackTlvHCI_Qos_Violation_Event(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Qos_Violation_Event(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3177 (0x0c69) -typedef struct sBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd; - -#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD ( 3177 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 4101 (0x1005) -typedef struct sBtampTLVHCI_Read_Buffer_Size_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Buffer_Size_Cmd; - -#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD ( 4101 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Buffer_Size_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Buffer_Size_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Buffer_Size_Cmd(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3093 (0x0c15) -typedef struct sBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd; - -#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD ( 3093 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 4106 (0x100a) -typedef struct sBtampTLVHCI_Read_Data_Block_Size_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Data_Block_Size_Cmd; - -#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD ( 4106 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Data_Block_Size_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Data_Block_Size_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Data_Block_Size_Cmd(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5121 (0x1401) -typedef struct sBtampTLVHCI_Read_Failed_Contact_Counter_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd; - -#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD ( 5121 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3174 (0x0c66) -typedef struct sBtampTLVHCI_Read_Flow_Control_Mode_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Flow_Control_Mode_Cmd; - -#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD ( 3174 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5123 (0x1403) -typedef struct sBtampTLVHCI_Read_Link_Quality_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Read_Link_Quality_Cmd; - -#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD ( 5123 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Link_Quality_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Link_Quality_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Link_Quality_Cmd(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Link_Quality_Cmd(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3126 (0x0c36) -typedef struct sBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd; - -#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD ( 3126 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5130 (0x140a) -typedef struct sBtampTLVHCI_Read_Local_AMP_Assoc_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U16_t length_so_far; - v_U16_t max_remote_amp_assoc_length; -} tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd; - -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD ( 5130 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD_MIN_LEN ( 7 ) - -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD_MAX_LEN ( 7 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5129 (0x1409) -typedef struct sBtampTLVHCI_Read_Local_AMP_Information_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Local_AMP_Information_Cmd; - -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD ( 5129 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Local_AMP_Information_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 4098 (0x1002) -typedef struct sBtampTLVHCI_Read_Local_Supported_Cmds_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd; - -#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD ( 4098 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 4097 (0x1001) -typedef struct sBtampTLVHCI_Read_Local_Version_Info_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Local_Version_Info_Cmd; - -#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD ( 4097 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Local_Version_Info_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Local_Version_Info_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Local_Version_Info_Cmd(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3172 (0x0c64) -typedef struct sBtampTLVHCI_Read_Location_Data_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Location_Data_Cmd; - -#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD ( 3172 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Location_Data_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Location_Data_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Location_Data_Cmd(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Location_Data_Cmd(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3169 (0x0c61) -typedef struct sBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd; - -#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD ( 3169 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 6145 (0x1801) -typedef struct sBtampTLVHCI_Read_Loopback_Mode_Cmd { - v_U8_t present; -} tBtampTLVHCI_Read_Loopback_Mode_Cmd; - -#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD ( 6145 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_Loopback_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_Loopback_Mode_Cmd*); - -v_U32_t btampPackTlvHCI_Read_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5125 (0x1405) -typedef struct sBtampTLVHCI_Read_RSSI_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Read_RSSI_Cmd; - -#define BTAMP_TLV_HCI_READ_RSSI_CMD ( 5125 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_READ_RSSI_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_READ_RSSI_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Read_RSSI_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Read_RSSI_Cmd*); - -v_U32_t btampPackTlvHCI_Read_RSSI_Cmd(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Read_RSSI_Cmd(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3075 (0x0c03) -typedef struct sBtampTLVHCI_Reset_Cmd { - v_U8_t present; -} tBtampTLVHCI_Reset_Cmd; - -#define BTAMP_TLV_HCI_RESET_CMD ( 3075 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_RESET_CMD_MIN_LEN ( 2 ) - -#define BTAMP_TLV_HCI_RESET_CMD_MAX_LEN ( 2 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Reset_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Reset_Cmd*); - -v_U32_t btampPackTlvHCI_Reset_Cmd(void *, tBtampTLVHCI_Reset_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Reset_Cmd(void *, tBtampTLVHCI_Reset_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5122 (0x1402) -typedef struct sBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd { - v_U8_t present; - v_U16_t log_link_handle; -} tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd; - -#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD ( 5122 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*); - -v_U32_t btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3077 (0x0c05) -typedef struct sBtampTLVHCI_Set_Event_Mask_Cmd { - v_U8_t present; - v_U8_t event_mask[8]; -} tBtampTLVHCI_Set_Event_Mask_Cmd; - -#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD ( 3077 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD_MIN_LEN ( 10 ) - -#define BTAMP_TLV_HCI_SET_EVENT_MASK_CMD_MAX_LEN ( 10 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Event_Mask_Cmd*); - -v_U32_t btampPackTlvHCI_Set_Event_Mask_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3171 (0x0c63) -typedef struct sBtampTLVHCI_Set_Event_Mask_Page_2_Cmd { - v_U8_t present; - v_U8_t event_mask_page_2[8]; -} tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd; - -#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD ( 3171 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD_MIN_LEN ( 10 ) - -#define BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD_MAX_LEN ( 10 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*); - -v_U32_t btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3179 (0x0c6b) -typedef struct sBtampTLVHCI_Set_Short_Range_Mode_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U8_t short_range_mode; -} tBtampTLVHCI_Set_Short_Range_Mode_Cmd; - -#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD ( 3179 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*); - -v_U32_t btampPackTlvHCI_Set_Short_Range_Mode_Cmd(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 76 (0x004c) -typedef struct sBtampTLVHCI_Short_Range_Mode_Change_Complete_Event { - v_U8_t present; - v_U8_t status; - v_U8_t phy_link_handle; - v_U8_t short_range_mode; -} tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event; - -#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT ( 76 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT_MIN_LEN ( 5 ) - -#define BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT_MAX_LEN ( 5 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*); - -v_U32_t btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3178 (0x0c6a) -typedef struct sBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd { - v_U8_t present; - v_U16_t log_link_handle; - v_U32_t best_effort_flush_timeout; -} tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd; - -#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD ( 3178 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MIN_LEN ( 8 ) - -#define BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD_MAX_LEN ( 8 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3094 (0x0c16) -typedef struct sBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd { - v_U8_t present; - v_U16_t connection_accept_timeout; -} tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd; - -#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD ( 3094 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3175 (0x0c67) -typedef struct sBtampTLVHCI_Write_Flow_Control_Mode_Cmd { - v_U8_t present; - v_U8_t flow_control_mode; -} tBtampTLVHCI_Write_Flow_Control_Mode_Cmd; - -#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD ( 3175 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3127 (0x0c37) -typedef struct sBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd { - v_U8_t present; - v_U16_t log_link_handle; - v_U16_t link_supervision_timeout; -} tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd; - -#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD ( 3127 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD_MIN_LEN ( 6 ) - -#define BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD_MAX_LEN ( 6 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3173 (0x0c65) -typedef struct sBtampTLVHCI_Write_Location_Data_Cmd { - v_U8_t present; - v_U8_t loc_domain_aware; - v_U8_t loc_domain[3]; - v_U8_t loc_options; -} tBtampTLVHCI_Write_Location_Data_Cmd; - -#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD ( 3173 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD_MIN_LEN ( 7 ) - -#define BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD_MAX_LEN ( 7 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Location_Data_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Location_Data_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Location_Data_Cmd(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Location_Data_Cmd(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 3170 (0x0c62) -typedef struct sBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd { - v_U8_t present; - v_U16_t logical_link_accept_timeout; -} tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd; - -#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD ( 3170 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MIN_LEN ( 4 ) - -#define BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD_MAX_LEN ( 4 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 6146 (0x1802) -typedef struct sBtampTLVHCI_Write_Loopback_Mode_Cmd { - v_U8_t present; - v_U8_t loopback_mode; -} tBtampTLVHCI_Write_Loopback_Mode_Cmd; - -#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD ( 6146 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD_MIN_LEN ( 3 ) - -#define BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD_MAX_LEN ( 3 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Loopback_Mode_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Loopback_Mode_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 5131 (0x140b) -typedef struct sBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd { - v_U8_t present; - v_U8_t phy_link_handle; - v_U16_t length_so_far; - v_U16_t amp_assoc_remaining_length; - v_U8_t amp_assoc_fragment[248]; -} tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd; - -#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD ( 5131 ) - -// N.B. These #defines do *not* include the ID & length -#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD_MIN_LEN ( 7 ) - -#define BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD_MAX_LEN ( 255 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ -v_U32_t btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, v_U8_t*,v_U16_t, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*); - -v_U32_t btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U32_t*); - -#ifdef __cplusplus -}; /* End extern "C". */ -#endif /* C++ */ -// ID 64512 (0xfc00) -typedef struct sBtampTLVHCI_Vendor_Specific_Cmd_0 { - v_U8_t present; -} tBtampTLVHCI_Vendor_Specific_0_Cmd; - -#define BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0 ( 64512 ) - -// ID 64513 (0xfc01) -typedef struct sBtampTLVHCI_Vendor_Specific_Cmd_1 { - v_U8_t present; -} tBtampTLVHCI_Vendor_Specific_1_Cmd; - -#define BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_1 ( 64513 ) - -/********************************************************************* - * Information Elements * - ********************************************************************/ - -/************************************************************************ - * Frames - **********************************************************************/ - -typedef struct sBtampAMP_ASSOC{ - tBtampTLVAMP_Assoc_MAC_Addr AMP_Assoc_MAC_Addr; - tBtampTLVAMP_Assoc_Preferred_Channel_List AMP_Assoc_Preferred_Channel_List; - tBtampTLVAMP_Assoc_Connected_Channel AMP_Assoc_Connected_Channel; - tBtampTLVAMP_Assoc_PAL_Capabilities AMP_Assoc_PAL_Capabilities; - tBtampTLVAMP_Assoc_PAL_Version AMP_Assoc_PAL_Version; -} tBtampAMP_ASSOC; - -#define BTAMP_AMP_ASSOC ( 1 ) - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ - -v_U32_t btampUnpackAMP_ASSOC(void * pCtx, v_U8_t *pBuf, v_U32_t nBuf, tBtampAMP_ASSOC *pFrm); -v_U32_t btampPackAMP_ASSOC(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U8_t *pBuf, v_U32_t nBuf, v_U32_t *pnConsumed); -v_U32_t btampGetPackedAMP_ASSOCSize(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U32_t *pnNeeded); - -#ifdef __cplusplus -} /* End extern "C". */ -#endif /* C++ */ - - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ - -/* HCI Number of Completed Packets Event*/ -typedef struct sBtampTLVHCI_Num_Completed_Pkts_Event -{ - v_U8_t present; - /* - The number of Connection Handles and Num_Data_Packets - parameters pairs contained in this event.Range: 0-255 - */ - - v_U8_t num_handles; - - /* - Size , Number of Handles * 2 Octets,Range: 0x0000-0x0EFF - */ - v_U16_t conn_handles[WLANBAP_MAX_LOG_LINKS]; - - /* - The number of HCI Data Packets that have been completed (transmitted - or flushed) for the associated Connection Handle since the previous time - the event was returned.Range for N: 0x0000-0xFFFF - */ - v_U16_t num_completed_pkts[WLANBAP_MAX_LOG_LINKS]; -} tBtampTLVHCI_Num_Completed_Pkts_Event; - -#define BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT ( 19 ) - -v_U32_t btampPackTlvHCI_Num_Completed_Pkts_Event(void *, tBtampTLVHCI_Num_Completed_Pkts_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Num_Completed_Pkts_Event(void *, tBtampTLVHCI_Num_Completed_Pkts_Event*, v_U32_t*); - -/*Length of the value field expected in a TLV of type Flow SPec*/ -#define WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN 16 - -#ifdef __cplusplus -} /* End extern "C". */ -#endif /* C++ */ - -#ifdef __cplusplus -extern "C" { -#endif /* C++ */ - -/* HCI Number of Completed Data Blocks Event*/ -typedef struct sBtampTLVHCI_Num_Completed_Data_Blocks_Event -{ - v_U8_t present; - /* - Total number of data block buffers available in the Controller for the - storage of data packets scheduled for transmission. This indicates - the existing value is unchanged, or increased, or reduced by up to - the sum of the Num_Of_Completed_Blocks values in this command - */ - - v_U16_t total_num_data_blocks; - - /* - The number of Connection Handles and Num_Data_Packets - parameters pairs contained in this event.Range: 0-255 - */ - - v_U8_t num_handles; - - /* - Size , Number of Handles * 2 Octets,Range: 0x0000-0x0EFF - */ - v_U16_t conn_handles[WLANBAP_MAX_LOG_LINKS]; - - /* - The number of HCI Data Packets that have been completed (transmitted - or flushed) for the associated Connection Handle since the previous time - the event was returned.Range for N: 0x0000-0xFFFF - */ - v_U16_t num_completed_pkts[WLANBAP_MAX_LOG_LINKS]; - - /* - The number of data blocks that have been freed for the associated - Handle since the previous time that a Number Of Completed Data - Blocks event provided information about this Handle. - Range for N: 0x0000-0xFFFF - */ - v_U16_t num_completed_blocks[WLANBAP_MAX_LOG_LINKS]; - -} tBtampTLVHCI_Num_Completed_Data_Blocks_Event; - -#define BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT ( 72 ) - -v_U32_t btampPackTlvHCI_Num_Completed_Data_Blocks_Event(void *, tBtampTLVHCI_Num_Completed_Data_Blocks_Event*, v_U8_t*, v_U32_t, v_U32_t*); - -v_U32_t btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(void *, tBtampTLVHCI_Num_Completed_Data_Blocks_Event*, v_U32_t*); - -#ifdef __cplusplus -} /* End extern "C". */ -#endif /* C++ */ - -#endif /* BTAMPHCI_H */ diff --git a/CORE/BAP/src/bapApiData.c b/CORE/BAP/src/bapApiData.c deleted file mode 100644 index c515e908f341..000000000000 --- a/CORE/BAP/src/bapApiData.c +++ /dev/null @@ -1,1179 +0,0 @@ -/* - * Copyright (c) 2012, 2014 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 D a t a . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - "platform independent" Data path 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. -===========================================================================*/ - -/*=========================================================================== - - 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/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiData.c,v 1.4 2008/11/10 22:34:22 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" -//I need the TL types and API -#include "wlan_qct_tl.h" - -#include "wlan_qct_hal.h" - -/* BT-AMP PAL API header file */ -#include "bapApi.h" -#include "bapInternal.h" -#include "bapApiTimer.h" - -//#define BAP_DEBUG -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -/*Endian-ness definitions*/ - -#undef BAP_LITTLE_BIT_ENDIAN -#define BAP_LITTLE_BIT_ENDIAN - -/*LLC header definitions*/ - -/* Length of the LLC header*/ -#define WLANBAP_LLC_HEADER_LEN 8 -#if 0 -/*Offset of the OUI field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_OUI_OFFSET 3 - -/*Size of the OUI type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_OUI_SIZE 3 - -/*Offset of the protocol type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_PROTO_TYPE_OFFSET (WLANBAP_LLC_OUI_OFFSET + WLANBAP_LLC_OUI_SIZE) - -/*Size of the protocol type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_PROTO_TYPE_SIZE 2 -#endif - -/*BT-AMP protocol type values*/ -/*BT-AMP packet of type data*/ -#define WLANBAP_BT_AMP_TYPE_DATA 0x0001 - -/*BT-AMP packet of type activity report*/ -#define WLANBAP_BT_AMP_TYPE_AR 0x0002 - -/*BT-AMP packet of type security frame*/ -#define WLANBAP_BT_AMP_TYPE_SEC 0x0003 - -/*802.3 header definitions*/ -#define WLANBAP_802_3_HEADER_LEN 14 - -/* Offset of DA field in a 802.3 header*/ -#define WLANBAP_802_3_HEADER_DA_OFFSET 0 - -//*BT-AMP packet LLC OUI value*/ -const v_U8_t WLANBAP_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; - -/*LLC header value*/ -static v_U8_t WLANBAP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; - -/* HCI header definitions*/ - -// Define the length of the ACL data packet HCI header -#define WLANBAP_HCI_ACL_HEADER_LEN 4 - -// Debug related defines -//#define DBGLOG printf -#define DUMPLOG_ON -#ifdef DUMPLOG_ON -#define DUMPLOG(n, name1, name2, aStr, size) do { \ - int i; \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%d. %s: %s = \n", n, name1, name2); \ - for (i = 0; i < size; i++) \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"\n"); \ - } while (0) -#else -#define DUMPLOG(n, name1, name2, aStr, size) -#endif - -#if 0 -// Debug related defines -#define DBGLOG printf -#define DUMPLOG -#if defined DUMPLOG -#define DUMPLOG(n, name1, name2, aStr, size) do { \ - int i; \ - DBGLOG("%d. %s: %s = \n", n, name1, name2); \ - for (i = 0; i < size; i++) \ - DBGLOG("%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ - DBGLOG("\n"); \ - } while (0) -#else -#define DUMPLOG(n, name1, name2, aStr, size) -#endif -#endif - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ -// Don't we have this type defined somewhere? -#if 0 -/* 802.3 header */ -typedef struct -{ - /* Destination address field */ - v_U8_t vDA[VOS_MAC_ADDR_SIZE]; - - /* Source address field */ - v_U8_t vSA[VOS_MAC_ADDR_SIZE]; - - /* Length field */ - v_U16_t usLenType; /* Num bytes in info field (i.e., exclude 802.3 hdr) */ - /* Max length 1500 (0x5dc) (What about 0x5ee? That - * includes 802.3 Header and FCS.) */ -}WLANBAP_8023HeaderType; -#endif - -/** - * \brief HCI ACL Data packet format - * - * 0 7 8 15 16 23 24 31 - * +--------+----+----+--------+--------+ - * | phy_ |log_| PB/| Data Total | - * | link_ |lnk_| BC | Length | - * | handle |hndl|Flag| | - * +--------+----+----+--------+--------+ - * | | - * | Data | - * ~ ~ - * +--------+---------+--------+--------+ - * - * NB: - * This is in little-endian - * 1) phy_link_handle is the first 8 bits - * 2) log_link_handle is the next 4 bits - * 3) PB flag is the next 2 bits - * 4) BC flags is the next 2 bits - * 5) Total length of the data field is the next 16 bits - * - */ - -typedef struct -{ - -#ifndef BAP_LITTLE_BIT_ENDIAN - - v_U8_t phyLinkHandle; /* do I have to reverse the byte? I think so... */ - - v_U8_t BCFlag :2; - v_U8_t PBFlag :2; - v_U8_t logLinkHandle :4; - - v_U16_t dataLength; /* do I have to reverse each byte? and then reverse the two bytes? I think so... */ - -#else - - v_U8_t phyLinkHandle; - - v_U8_t logLinkHandle :4; - v_U8_t PBFlag :2; - v_U8_t BCFlag :2; - - v_U16_t dataLength; /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */ - -#endif - -} WLANBAP_HCIACLHeaderType; - - - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Externalized Function Definitions -* -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -#define WLANBAP_DEBUG_FRAME_BYTE_PER_LINE 16 -#define WLANBAP_DEBUG_FRAME_BYTE_PER_BYTE 4 - -/*=========================================================================== - - FUNCTION WLANBAP_XlateTxDataPkt - - DESCRIPTION - - HDD will call this API when it has a HCI Data Packet and it wants - to translate it into a 802.3 LLC frame - ready to send using TL. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) - - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the BT-AMP packet to be - translated to an 802.3 LLC frame - tlMetaInfo: return meta info gleaned from the outgoing frame, here. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_XlateTxDataPkt -( - ptBtampHandle btampHandle, /* Used by BAP to identify the actual session - and therefore addresses */ - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType *pucAC, /* Return the AC here */ - WLANTL_MetaInfoType *tlMetaInfo, /* Return the MetaInfo here. An assist to WLANBAP_STAFetchPktCBType */ - vos_pkt_t *vosDataBuff -) -{ - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - tpBtampLogLinkCtx pLogLinkContext; - WLANBAP_8023HeaderType w8023Header; - WLANBAP_HCIACLHeaderType hciACLHeader = { 0 }; - v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; - VOS_STATUS vosStatus; - v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - v_U16_t headerLength; /* The 802.3 frame length*/ - v_U16_t protoType = WLANBAP_BT_AMP_TYPE_DATA; /* The protocol type bytes*/ - uintptr_t value = 0; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - // Here, I have to make the assumption that this is an - // HCI ACL Data packet that I am being handed. - vosStatus = vos_pkt_pop_head( vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN); - - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Failed to pop HCI ACL header from packet %d", - vosStatus); - - return vosStatus; - } - - // JEZ081003: Remove this after debugging - // Sanity check the phy_link_handle value - - if ( phy_link_handle != hciACLHeader.phyLinkHandle ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: phy_link_handle mismatch in %s phy_link_handle=%d hciACLHeader.phyLinkHandle=%d", - __func__, phy_link_handle, hciACLHeader.phyLinkHandle); - return VOS_STATUS_E_INVAL; - } - - - /* Lookup the StaId using the phy_link_handle and the BAP context */ - - vosStatus = WLANBAP_GetStaIdFromLinkCtx ( - btampHandle, /* btampHandle value in */ - phy_link_handle, /* phy_link_handle value in */ - &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &pHddHdl); /* Handle to return BSL context */ - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - // JEZ081003: Remove this after debugging - // Sanity check the log_link_handle value - if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Invalid logical link handle (%d) in %s. Corrected.", - hciACLHeader.logLinkHandle, - __func__); - - // JEZ090123: Insure that the logical link value is good - hciACLHeader.logLinkHandle = 1; - //return VOS_STATUS_E_INVAL; - } - - /* Use the log_link_handle to retrieve the logical link context */ - /* JEZ081006: abstract this with a proc. So you can change the impl later */ - pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]); - - // JEZ081003: Remove this after debugging - // Sanity check the log_link_handle value - // JEZ081113: I changed this to fail on an UNOCCUPIED entry - if ( pLogLinkContext->present != VOS_TRUE) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Invalid logical link entry in %s", - __func__); - - return VOS_STATUS_E_INVAL; - } - - // Return the AC and MetaInfo - - // Now copy the AC values from the Logical Link context - *pucAC = pLogLinkContext->btampAC; - // Now copy the values from the Logical Link context to the MetaInfo - tlMetaInfo->ucTID = pLogLinkContext->ucTID; - tlMetaInfo->ucUP = pLogLinkContext->ucUP; - tlMetaInfo->ucIsEapol = VOS_FALSE; - tlMetaInfo->ucDisableFrmXtl = VOS_FALSE; - tlMetaInfo->ucBcast = VOS_FALSE; /* hciACLHeader.BCFlag; */ /* Don't I want to use the BCFlag? */ - tlMetaInfo->ucMcast = VOS_FALSE; - tlMetaInfo->ucType = 0x00; /* What is this really ?? */ -// tlMetaInfo->usTimeStamp = 0x00; /* Ravi, shouldn't you be setting this? It's in the VOS packet. */ - - // Form the 802.3 header - - vos_mem_copy( w8023Header.vDA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE); - vos_mem_copy( w8023Header.vSA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE); - - /* Now this length passed down in HCI...is in little-endian */ - headerLength = vos_le16_to_cpu(hciACLHeader.dataLength); - headerLength += WLANBAP_LLC_HEADER_LEN; - /* Now the 802.3 length field is big-endian?! */ - w8023Header.usLenType = vos_cpu_to_be16(headerLength); - - /* Now adjust the protocol type bytes*/ - protoType = vos_cpu_to_be16( protoType); - - /* Now form the LLC header */ - vos_mem_copy(aucLLCHeader, - WLANBAP_LLC_HEADER, - sizeof(WLANBAP_LLC_HEADER)); - vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], - WLANBAP_BT_AMP_OUI, - WLANBAP_LLC_OUI_SIZE); - vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], - &protoType, //WLANBAP_BT_AMP_TYPE_DATA - WLANBAP_LLC_PROTO_TYPE_SIZE); - - /* Push on the LLC header */ - vos_pkt_push_head(vosDataBuff, - aucLLCHeader, - WLANBAP_LLC_HEADER_LEN); - - /* Push on the 802.3 header */ - vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header)); - - - /*Set the logical link handle as user data so that we can retrieve it on - Tx Complete */ - value = (uintptr_t)hciACLHeader.logLinkHandle; - vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP, - (v_VOID_t *)value); - - return VOS_STATUS_SUCCESS; -}/*WLANBAP_XlateTxDataPkt*/ - -/*=========================================================================== - - FUNCTION WLANBAP_GetAcFromTxDataPkt - - DESCRIPTION - - HDD will call this API when it has a HCI Data Packet (SKB) and it wants - to find AC type of the data frame from the HCI header on the data pkt - - to be send using TL. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - pHciData: Pointer to the HCI data frame - - pucAC: Pointer to return the access category - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetAcFromTxDataPkt -( - ptBtampHandle btampHandle, /* Used by BAP to identify the actual session - and therefore addresses */ - void *pHciData, /* Pointer to the HCI data frame */ - WLANTL_ACEnumType *pucAC /* Return the AC here */ -) -{ - ptBtampContext pBtampCtx; - tpBtampLogLinkCtx pLogLinkContext; - WLANBAP_HCIACLHeaderType hciACLHeader; - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if (( NULL == btampHandle) || (NULL == pHciData) || (NULL == pucAC)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid params in %s", __func__); - return VOS_STATUS_E_FAULT; - } - pBtampCtx = (ptBtampContext) btampHandle; - - vos_mem_copy( &hciACLHeader, pHciData, WLANBAP_HCI_ACL_HEADER_LEN); - // Sanity check the log_link_handle value - if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Invalid logical link handle (%d) in %s", - hciACLHeader.logLinkHandle, - __func__); - - return VOS_STATUS_E_INVAL; - } - - /* Use the log_link_handle to retrieve the logical link context */ - /* JEZ081006: abstract this with a proc. So you can change the impl later */ - pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]); - - // Sanity check the log_link_handle value - // JEZ081113: I changed this to fail on an UNOCCUPIED entry - if ( pLogLinkContext->present != VOS_TRUE) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Invalid logical link entry in %s", - __func__); - - return VOS_STATUS_E_INVAL; - } - - // Return the AC - - // Now copy the AC values from the Logical Link context - *pucAC = pLogLinkContext->btampAC; - - return VOS_STATUS_SUCCESS; -} - -/*=========================================================================== - - FUNCTION WLANBAP_XlateRxDataPkt - - DESCRIPTION - - HDD will call this API when it has received a 802.3 (TL/UMA has - Xlated from 802.11) frame from TL and it wants to form a - BT HCI Data Packet - ready to signal up to the BT stack application. - - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the 802.3 frame to be - translated to BT HCI Data Packet - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_XlateRxDataPkt -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType *pucAC, /* Return the AC here. I don't think this is needed */ - vos_pkt_t *vosDataBuff -) -{ - WLANBAP_8023HeaderType w8023Header; - WLANBAP_HCIACLHeaderType hciACLHeader; - v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - VOS_STATUS vosStatus; - //v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - v_U16_t hciDataLength; /* The HCI packet data length*/ - v_U16_t protoType = WLANBAP_BT_AMP_TYPE_DATA; /* The protocol type bytes*/ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - // Here, I have to make the assumption that this is an - // 802.3 header followed by an LLC/SNAP packet. - vos_mem_set( &w8023Header, sizeof(w8023Header), 0 ); - vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header, sizeof(w8023Header)); - - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Failed to pop 802.3 header from packet %d", - vosStatus); - - return vosStatus; - } - - // Here, is that LLC/SNAP header. - // With the BT SIG OUI that I am being handed. - vos_mem_set( aucLLCHeader, WLANBAP_LLC_HEADER_LEN, 0 ); - vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader, WLANBAP_LLC_HEADER_LEN); - - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Failed to pop LLC/SNAP header from packet %d", - vosStatus); - - return vosStatus; - } - -#ifdef BAP_DEBUG - // JEZ081003: Remove this after debugging - // Should I double check that I am getting the BT SIG OUI ? - if ( !(vos_mem_compare( aucLLCHeader, - WLANBAP_LLC_HEADER, - sizeof(WLANBAP_LLC_HEADER) - - WLANBAP_LLC_OUI_SIZE) /* Don't check the last three bytes here */ - && vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], - (v_VOID_t*)WLANBAP_BT_AMP_OUI, - WLANBAP_LLC_OUI_SIZE))) /* check them here */ - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid LLC header for BT-AMP packet in %s", __func__); - return VOS_STATUS_E_FAULT; - } -#endif //BAP_DEBUG - - /* Now adjust the protocol type bytes*/ - protoType = vos_cpu_to_be16( protoType); - // check if this is a data frame or other, internal to BAP, type... - // we are only handling data frames in here... - // The others (Security and AR) are handled by TLs BAP client API. - // (Verify with TL) - if ( !(vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], - &protoType, //WLANBAP_BT_AMP_TYPE_DATA - WLANBAP_LLC_PROTO_TYPE_SIZE))) - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid (non-data) frame type in %s", __func__); - return VOS_STATUS_E_FAULT; - } - -#ifdef BAP_DEBUG - // JEZ081003: Remove this after debugging - /*------------------------------------------------------------------------ - Sanity check the MAC address in the physical link context - against the value in the incoming Rx Frame. - ------------------------------------------------------------------------*/ - if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE) - && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE))) - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "MAC address mismatch in %s", __func__); - return VOS_STATUS_E_FAULT; - } -#endif //BAP_DEBUG - - /* No lookup is needed. Because TL has already told WLANBAP_STARxCB - * the StaId. And I told WLANBAP_STARxCBType the corresponding BSL context - * Which he used to lookup the phy_link_handle value. - */ - - - // Start filling in the HCI header - hciACLHeader.phyLinkHandle = phy_link_handle; - - // Continue filling in the HCI header - //JEZ100913: On Rx the Logical Link is ALWAYS 0. See Vol 2, Sec E, 5.4.2 of spec. - hciACLHeader.logLinkHandle = 0; - hciACLHeader.PBFlag = WLANBAP_HCI_PKT_AMP; - hciACLHeader.BCFlag = 0; - - /* Now the length field is big-endian?! */ - hciDataLength = vos_be16_to_cpu(w8023Header.usLenType); - /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */ - hciDataLength -= WLANBAP_LLC_HEADER_LEN; - /* The HCI packet data length is Little-endian */ - hciACLHeader.dataLength = vos_cpu_to_le16(hciDataLength); - - /* Return the AC here. - * (I can't because there is no way to figure out what it is.) - */ - *pucAC = 0; - - /* Push on the HCI header */ - vos_pkt_push_head(vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN); - - return VOS_STATUS_SUCCESS; -} /* WLANBAP_XlateRxDataPkt */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_STAFetchPktCB - - DESCRIPTION - The fetch packet callback registered with TL. - - It is called by the TL when the scheduling algorithms allows for - transmission of another packet to the module. - It will be called in the context of the BAL fetch transmit packet - function, initiated by the bus lower layer. - - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle - to TL's or HDD's control block can be extracted - from its context - - IN/OUT - pucSTAId: the Id of the station for which TL is requesting a - packet, in case HDD does not maintain per station - queues it can give the next packet in its queue - and put in the right value for the - pucAC: access category requested by TL, if HDD does not have - packets on this AC it can choose to service another AC - queue in the order of priority - - OUT - vosDataBuff: pointer to the VOSS data buffer that was transmitted - tlMetaInfo: meta info related to the data frame - - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_STAFetchPktCB -( - v_PVOID_t pvosGCtx, - v_U8_t* pucSTAId, - v_U8_t ucAC, - vos_pkt_t** vosDataBuff, - WLANTL_MetaInfoType* tlMetaInfo -) -{ - VOS_STATUS vosStatus; - ptBtampHandle bapHdl; /* holds ptBtampHandle value returned */ - ptBtampContext bapContext; /* Holds the btampContext value returned */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - - /* Lookup the BSL and BAP contexts using the StaId */ - - vosStatus = WLANBAP_GetCtxFromStaId ( - *pucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &bapHdl, /* "handle" to return ptBtampHandle value in */ - &bapContext, /* "handle" to return ptBtampContext value in */ - &pHddHdl); /* "handle" to return BSL context in */ - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_STAFetchPktCB"); - return VOS_STATUS_E_FAULT; - } - - /* Invoke the callback that BSL registered with me */ - vosStatus = (*bapContext->pfnBtampFetchPktCB)( - pHddHdl, - (WLANTL_ACEnumType) ucAC, /* typecast it for now */ - vosDataBuff, - tlMetaInfo); - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Callback registered by BSL failed to fetch pkt in WLANNBAP_STAFetchPktCB"); - return VOS_STATUS_E_FAULT; - } - - return vosStatus; -} /* WLANBAP_STAFetchPktCB */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_STARxCB - - DESCRIPTION - The receive callback registered with TL. - - TL will call this to notify the client when a packet was received - for a registered STA. - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to - TL's or HDD's control block can be extracted from - its context - rxBufChain pointer to adf_nbuf rx chain - ucSTAId: station id - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_STARxCB(v_PVOID_t pvosGCtx, - adf_nbuf_t rxBufChain, - v_U8_t ucSTAId) -{ - - /* TBD */ - return VOS_STATUS_SUCCESS; -} /* WLANBAP_STARxCB */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_TxCompCB - - DESCRIPTION - The tx complete callback registered with TL. - - TL will call this to notify the client when a transmission for a - packet has ended. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to - TL/HAL/PE/BAP/HDD control block can be extracted from - its context - vosDataBuff: pointer to the VOSS data buffer that was transmitted - wTxSTAtus: status of the transmission - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_TxCompCB -( - v_PVOID_t pvosGCtx, - vos_pkt_t* vosDataBuff, - VOS_STATUS wTxSTAtus -) -{ - VOS_STATUS vosStatus; - ptBtampHandle bapHdl; /* holds ptBtampHandle value returned */ - ptBtampContext bapContext; /* Holds the btampContext value returned */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - v_PVOID_t pvlogLinkHandle = NULL; - uintptr_t value; - - WLANBAP_HCIACLHeaderType hciACLHeader; - - /* retrieve the BSL and BAP contexts */ - - /* I don't really know how to do this - in the general case. */ - /* So, for now, I will just use something that works. */ - /* (In general, I will have to keep a list of the outstanding transmit */ - /* buffers, in order to determine which assoc they are with.) */ - //vosStatus = WLANBAP_GetCtxFromStaId ( - // ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - // &bapHdl, /* "handle" to return ptBtampHandle value in */ - // &bapContext, /* "handle" to return ptBtampContext value in */ - // &pHddHdl); /* "handle" to return BSL context in */ - /* Temporarily we do the following*/ - //bapHdl = &btampCtx; - bapHdl = (v_PVOID_t)gpBtampCtx; - /* Typecast the handle into a context. Works as we have only one link*/ - bapContext = ((ptBtampContext) bapHdl); - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == vosDataBuff) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid vosDataBuff value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - if ( NULL == bapContext) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid bapContext value in %s", __func__); - vos_pkt_return_packet( vosDataBuff ); - return VOS_STATUS_E_FAULT; - } - - pHddHdl = bapContext->pHddHdl; - vosStatus = VOS_STATUS_SUCCESS; - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_TxCompCB"); - vos_pkt_return_packet( vosDataBuff ); - return VOS_STATUS_E_FAULT; - } - - /*Get the logical link handle from the vos user data*/ - vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP, - &pvlogLinkHandle); - - value = (uintptr_t)pvlogLinkHandle; - hciACLHeader.logLinkHandle = value; - -#ifdef BAP_DEBUG - /* Trace the bapContext referenced. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: bapContext value = %p in %s:%d. vosDataBuff=%p", bapContext, __func__, __LINE__, vosDataBuff ); -#endif //BAP_DEBUG - - // Sanity check the log_link_handle value -// JEZ100722: Temporary changes. - if (BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) - { - vos_atomic_increment_U32( - &bapContext->btampLogLinkCtx[hciACLHeader.logLinkHandle].uTxPktCompleted); -// &bapContext->btampLogLinkCtx[0].uTxPktCompleted); -// vos_atomic_increment_U32( -// &bapContext->btampLogLinkCtx[1].uTxPktCompleted); - } else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "In %s:%d: Invalid logical link handle: %d", __func__, __LINE__, hciACLHeader.logLinkHandle); - } - - /* Invoke the callback that BSL registered with me */ - vosStatus = (*bapContext->pfnBtampTxCompCB)( - pHddHdl, - vosDataBuff, - wTxSTAtus); - - return vosStatus; -} /* WLANBAP_TxCompCB */ - -/*========================================================================== - - FUNCTION WLANBAP_RegisterDataPlane - - DESCRIPTION - The HDD calls this routine to register the "data plane" routines - for Tx, Rx, and Tx complete with BT-AMP. For now, with only one - physical association supported at a time, this COULD be called - by HDD at the same time as WLANBAP_GetNewHndl. But, in general - it needs to be called upon each new physical link establishment. - - This registration is really two part. The routines themselves are - registered here. But, the mapping between the BSL context and the - actual physical link takes place during WLANBAP_PhysicalLinkCreate. - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_RegisterDataPlane -( - ptBtampHandle btampHandle, /* BTAMP context */ - WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB, - WLANBAP_STARxCBType pfnBtamp_STARxCB, - WLANBAP_TxCompCBType pfnBtampTxCompCB, - // phy_link_handle, of course, doesn't come until much later. At Physical Link create. - v_PVOID_t pHddHdl /* BSL specific context */ -) -{ - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in WLANBAP_RegisterDataPlane"); - return VOS_STATUS_E_FAULT; - } - - // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt - pBtampCtx->pfnBtampFetchPktCB = pfnBtampFetchPktCB; - pBtampCtx->pfnBtamp_STARxCB = pfnBtamp_STARxCB; - pBtampCtx->pfnBtampTxCompCB = pfnBtampTxCompCB; - - // (Right now, there is only one) - pBtampCtx->pHddHdl = pHddHdl; - /* Set the default data transfer mode */ - pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED; - - return VOS_STATUS_SUCCESS; -} /* WLANBAP_RegisterDataPlane */ - - -/*=========================================================================== - - FUNCTION WLANBAP_STAPktPending - - DESCRIPTION - - HDD will call this API when a packet is pending transmission in its - queues. HDD uses this instead of WLANTL_STAPktPending because he is - not aware of the mapping from session to STA ID. - - DEPENDENCIES - - HDD must have called WLANBAP_GetNewHndl before calling this API. - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - BSL can obtain this from the physical handle value in the - downgoing HCI Data Packet. He, after all, was there - when the PhysicalLink was created. He knew the btampHandle - value returned by WLANBAP_GetNewHndl. He knows as well, his - own pHddHdl (see next). - phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) - ucAc: The access category for the pending frame - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_STAPktPending -( - ptBtampHandle btampHandle, /* Used by BAP to identify the app context and VOSS ctx (!?) */ - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - WLANTL_ACEnumType ucAc /* This is the first instance of a TL type in bapApi.h */ -) -{ - VOS_STATUS vosStatus; - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - v_PVOID_t pvosGCtx; - v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - - -#ifdef BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: pBtampCtx value = %p in %s:%d", pBtampCtx, __func__, __LINE__ ); -#endif //BAP_DEBUG - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in WLANBAP_STAPktPending"); - return VOS_STATUS_E_FAULT; - } - - // Retrieve the VOSS context - pvosGCtx = pBtampCtx->pvosGCtx; - - /* Lookup the StaId using the phy_link_handle and the BAP context */ - - vosStatus = WLANBAP_GetStaIdFromLinkCtx ( - btampHandle, /* btampHandle value in */ - phy_link_handle, /* phy_link_handle value in */ - &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &pHddHdl); /* Handle to return BSL context */ - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_STAPktPending"); - return VOS_STATUS_E_FAULT; - } - - - // Let TL know we have a packet to send... - vosStatus = WLANTL_STAPktPending( - pvosGCtx, - ucSTAId, - ucAc); - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Tx: Packet rejected by TL in WLANBAP_STAPktPending"); - return vosStatus; - } - pBtampCtx->dataPktPending = VOS_TRUE;//Indication for LinkSupervision module that data is pending - return VOS_STATUS_SUCCESS; -} /* WLANBAP_STAPktPending */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPRegisterBAPCallbacks() - - DESCRIPTION - Register the BAP "Event" callbacks. - Return the per instance handle. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pBapHCIEventCB: pointer to the Event callback - pAppHdl: The context passed in by caller. (I.E., BSL app specific context.) - - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIEventCB is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPRegisterBAPCallbacks -( - ptBtampHandle btampHandle, /* BSL uses my handle to talk to me */ - /* Returned from WLANBAP_GetNewHndl() */ - /* It's like each of us is using the other */ - /* guys reference when invoking him. */ - tpWLAN_BAPEventCB pBapHCIEventCB, /*Implements the callback for ALL asynchronous events. */ - v_PVOID_t pAppHdl // Per-app BSL context -) -{ - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in WLAN_BAPRegisterBAPCallbacks"); - return VOS_STATUS_E_FAULT; - } - - // Save the Event callback - pBtampCtx->pBapHCIEventCB = pBapHCIEventCB; - - // (Right now, there is only one) - pBtampCtx->pAppHdl = pAppHdl; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPRegisterBAPCallbacks */ diff --git a/CORE/BAP/src/bapApiDebug.c b/CORE/BAP/src/bapApiDebug.c deleted file mode 100644 index f3fb5a677eee..000000000000 --- a/CORE/BAP/src/bapApiDebug.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2014 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 D e b u g . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - Debug 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. -===========================================================================*/ - -/*=========================================================================== - - 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/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiDebug.c,v 1.2 2008/11/10 22:37:58 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" - -/* 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 - * -------------------------------------------------------------------------*/ - -/* -Debug Commands -*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLoopbackMode() - - DESCRIPTION - Implements the actual HCI Read Loopback Mode 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. - pBapHCIReadLoopbackMode: pointer to the "HCI Read Loopback Mode". - - 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 pBapHCIReadLoopbackMode or - pBapHCILoopbackMode is NULL. - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLoopbackMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Loopback_Mode_Cmd *pBapHCIReadLoopbackMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLoopbackMode */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLoopbackMode() - - DESCRIPTION - Implements the actual HCI Write Loopback Mode 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. - pBapHCIWriteLoopbackMode: pointer to the "HCI Write Loopback Mode" 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 pBapHCIWriteLoopbackMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLoopbackMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Loopback_Mode_Cmd *pBapHCIWriteLoopbackMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteLoopbackMode */ diff --git a/CORE/BAP/src/bapApiExt.c b/CORE/BAP/src/bapApiExt.c deleted file mode 100644 index 2335965a2f00..000000000000 --- a/CORE/BAP/src/bapApiExt.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2014 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 E x t . C - - OVERVIEW: - - This software unit holds the implementation of the external interfaces - required by the WLAN BAP module. It is currently a temporary - respository for API routines which should be furnished by CSR - or TL, but aren't yet implemented. - - The functions provide by this module are called by the rest of - the BT-AMP PAL module. - - DEPENDENCIES: - - Are listed for each API below. -===========================================================================*/ - -/*=========================================================================== - - 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/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiExt.c,v 1.1 2008/11/21 20:28:18 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-10-22 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -// I think this pulls in everything -#include "bapApiExt.h" - -//#define BAP_DEBUG -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Externalized Function Definitions -* -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Utility Function implementations - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_GetCurrentChannel - - DESCRIPTION - Clear out all fields in the BAP context. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - channel: current configured channel number. - activeFlag: flag indicating whether there is an active link. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to return channel is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetCurrentChannel -( - ptBtampContext pBtampCtx, - v_U32_t *channel, // return current channel here - v_U32_t *activeFlag // return active flag here -) -{ - //v_U32_t cb_enabled; - tHalHandle halHandle; - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if (( NULL == pBtampCtx ) || (NULL == channel) || (NULL == activeFlag)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - halHandle = VOS_GET_HAL_CB(pBtampCtx->pvosGCtx); - - if(NULL == halHandle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "halHandle is NULL in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - if (ccmCfgGetInt(halHandle, WNI_CFG_CURRENT_CHANNEL, channel) - != eHAL_STATUS_SUCCESS ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Get CFG failed in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - *activeFlag = FALSE; // return active flag here - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_GetCurrentChannel */ diff --git a/CORE/BAP/src/bapApiExt.h b/CORE/BAP/src/bapApiExt.h deleted file mode 100644 index 4efd89856138..000000000000 --- a/CORE/BAP/src/bapApiExt.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef WLAN_QCT_WLANBAP_API_EXT_H -#define WLAN_QCT_WLANBAP_API_EXT_H - -/*=========================================================================== - - W L A N B T - A M P P A L L A Y E R - E X T E R N A L A P I - - -DESCRIPTION - This file contains the external APIs used by the wlan BT-AMP PAL layer - module. -===========================================================================*/ - - -/*=========================================================================== - - 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/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiExt.h,v 1.1 2008/11/21 20:29:13 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $ - - -when who what, where, why --------- --- ---------------------------------------------------------- -10/22/08 jez Created module. - -===========================================================================*/ - - - -/*=========================================================================== - - INCLUDE FILES FOR MODULE - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -// Pick up all the BT-AMP internal definitions -// And underlying supporting types. (Including VOSS, CSR, and...) -#include "bapInternal.h" - -/* Pick up the SIRIUS and HAL types */ -// Already taken care of, above -//#include "sirApi.h" -//#include "halTypes.h" - -/* Pick up the CCM API def'n */ -#include "ccmApi.h" - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - #ifdef __cplusplus - extern "C" { - #endif - - -/*---------------------------------------------------------------------------- - * Defines - * -------------------------------------------------------------------------*/ -// Temporary -//#define BAP_DEBUG - -// How do I get BAP context from voss context? -//#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) -// How do I get halHandle from voss context? -//#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_HAL, ctx) - -/*---------------------------------------------------------------------------- - * Typedefs - * -------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * Function prototypes - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Utility Function prototypes - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_GetCurrentChannel - - DESCRIPTION - Clear out all fields in the BAP context. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - channel: current configured channel number. - activeFlag: flag indicating whether there is an active link. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to return channel is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetCurrentChannel -( - ptBtampContext pBtampCtx, - v_U32_t *channel, // return current channel here - v_U32_t *activeFlag // return active flag here -); - - -#ifdef __cplusplus - } -#endif - - -#endif /* #ifndef WLAN_QCT_WLANBAP_API_EXT_H */ diff --git a/CORE/BAP/src/bapApiHCBB.c b/CORE/BAP/src/bapApiHCBB.c deleted file mode 100644 index 565e9fa2d0a8..000000000000 --- a/CORE/BAP/src/bapApiHCBB.c +++ /dev/null @@ -1,1691 +0,0 @@ -/* - * Copyright (c) 2012 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 H C B B . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - Host Controller and Baseband 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. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /prj/qct/asw/engbuilds/scl/users02/jzmuda/Android/ampBlueZ_6/CORE/BAP/src/bapApiHCBB.c,v 1.7 2011/05/06 00:59:27 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-09-15 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include "vos_trace.h" - -// Pick up the sme callback registration API -#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 - * -------------------------------------------------------------------------*/ - - -/* Host Controller and Baseband Commands */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReset() - - DESCRIPTION - Implements the actual HCI Reset command. - Produces an asynchronous command complete event. Through the - command complete callback. (I.E., (*tpWLAN_BAPEventCB).) - - 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_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReset -( - ptBtampHandle btampHandle -) -{ - VOS_STATUS vosStatus; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - tHalHandle hHal = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - 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__); - - return VOS_STATUS_E_FAULT; - } - - /* Perform a "reset" */ - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - //csrRoamDisconnect(); - /* To avoid sending Disassoc on STA interface */ - if( TRUE == btampContext->isBapSessionOpen ) - { - sme_RoamDisconnect(hHal, - btampContext->sessionId, - // Danlin, where are the richer reason codes? - // I want to be able to convey everything 802.11 supports... - eCSR_DISCONNECT_REASON_UNSPECIFIED); - } - - /* Need to reset the timers as well*/ - /* Connection Accept Timer interval*/ - btampContext->bapConnectionAcceptTimerInterval = WLANBAP_CONNECTION_ACCEPT_TIMEOUT; - /* Link Supervision Timer interval*/ - btampContext->bapLinkSupervisionTimerInterval = WLANBAP_LINK_SUPERVISION_TIMEOUT; - /* Logical Link Accept Timer interval*/ - btampContext->bapLogicalLinkAcceptTimerInterval = WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT; - /* Best Effort Flush timer interval*/ - btampContext->bapBEFlushTimerInterval = WLANBAP_BE_FLUSH_TIMEOUT; - - - /* Form and immediately return the command complete event... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - bapHCIEvent.u.btampCommandCompleteEvent.present = 1; - bapHCIEvent.u.btampCommandCompleteEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_RESET_CMD; - bapHCIEvent.u.btampCommandCompleteEvent.cc_event.Reset.status - = WLANBAP_STATUS_SUCCESS; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - //btampContext->pHddHdl, /* this refers to the BSL per connection context */ - btampContext->pAppHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_FALSE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* WLAN_BAPReset */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetEventMask() - - DESCRIPTION - Implements the actual HCI Set Event Mask 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. - pBapHCISetEventMask: pointer to the "HCI Set Event Mask" 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 pBapHCISetEventMask is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetEventMask -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Event_Mask_Cmd *pBapHCISetEventMask, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPSetEventMask */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPFlush() - - DESCRIPTION - Implements the actual HCI Flush command - Produces an asynchronous command complete event. Through the - event callback. And an asynchronous Flush occurred event. Also through the - event callback. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlush: pointer to the "HCI Flush" Structure. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIFlush is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPFlush -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Flush_Cmd *pBapHCIFlush -) -{ - VOS_STATUS vosStatus; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - 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) { - return VOS_STATUS_E_FAULT; - } - - /* Form and immediately return the command complete event... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - bapHCIEvent.u.btampCommandCompleteEvent.present = 1; - bapHCIEvent.u.btampCommandCompleteEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_FLUSH_CMD; - bapHCIEvent.u.btampCommandCompleteEvent.cc_event.Flush.status - = WLANBAP_STATUS_SUCCESS; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - //btampContext->pHddHdl, /* this refers to the BSL per connection context */ - btampContext->pAppHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_FALSE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* WLAN_BAPFlush */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_EnhancedBAPFlush() - - DESCRIPTION - Implements the actual HCI Enhanced Flush command - Produces an asynchronous command complete event. Through the command status - event callback. And an asynchronous Enhanced Flush Complete event. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlush: pointer to the "HCI Enhanced Flush" 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 pBapHCIFlush is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_EnhancedBAPFlush -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Enhanced_Flush_Cmd *pBapHCIFlush, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ - -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - ptBtampContext btampContext; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - btampContext = (ptBtampContext) btampHandle; - /* Form and return the command status event... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - bapHCIEvent.u.btampCommandStatusEvent.present = 1; - bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - - /* Form and immediately return the command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT; - pBapHCIEvent->u.btampEnhancedFlushCompleteEvent.present = 1; - pBapHCIEvent->u.btampEnhancedFlushCompleteEvent.log_link_handle = - pBapHCIFlush->log_link_handle; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - //btampContext->pHddHdl, /* this refers to the BSL per connection context */ - btampContext->pAppHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_FALSE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* WLAN_EnhancedBAPFlush */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadConnectionAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Read Connection Accept Timeout 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 pBapHCIReadConnectionAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadConnectionAcceptTimeout -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete */ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Connection_Accept_TO.status - = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Connection_Accept_TO.connection_accept_timeout - = btampContext->bapConnectionAcceptTimerInterval; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadConnectionAcceptTimeout */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteConnectionAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Write Connection Accept Timeout 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. - pBapHCIWriteConnectionAcceptTimeout: pointer to the "HCI Connection Accept Timeout" 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 pBapHCIWriteConnectionAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteConnectionAcceptTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pBapHCIWriteConnectionAcceptTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIWriteConnectionAcceptTimeout) - || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the allowed timeout interval range */ - if ((pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout > - WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE) || - (pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout < - WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Out of range for connection accept timeout parameters in %s", - __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Connection_Accept_TO.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - /* Save the Physical link connection accept timeout value */ - btampContext->bapConnectionAcceptTimerInterval = - pBapHCIWriteConnectionAcceptTimeout->connection_accept_timeout; - - /* Return status for command complete event */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Connection_Accept_TO.status - = WLANBAP_STATUS_SUCCESS; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteConnectionAcceptTimeout */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLinkSupervisionTimeout() - - DESCRIPTION - Implements the actual HCI Read Link Supervision Timeout 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 pBapHCIReadLinkSupervisionTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLinkSupervisionTimeout -( - ptBtampHandle btampHandle, - /* Only 8 bits (phy_link_handle) of this log_link_handle are valid. */ - tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pBapHCIReadLinkSupervisionTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U8_t phyLinkHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIReadLinkSupervisionTimeout) || - (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the phyiscal link handle extracted from - logical link handle (lower byte valid) */ - phyLinkHandle = (v_U8_t) pBapHCIReadLinkSupervisionTimeout->log_link_handle; - - if (phyLinkHandle != btampContext->phy_link_handle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid Physical link handle in %s", __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.link_supervision_timeout - = 0x00; /* Invalid value */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.log_link_handle - = pBapHCIReadLinkSupervisionTimeout->log_link_handle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.link_supervision_timeout - = btampContext->bapLinkSupervisionTimerInterval; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.log_link_handle - = pBapHCIReadLinkSupervisionTimeout->log_link_handle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Supervision_TO.status - = WLANBAP_STATUS_SUCCESS; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLinkSupervisionTimeout */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLinkSupervisionTimeout() - - DESCRIPTION - Implements the actual HCI Write Link Supervision Timeout 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. - pBapHCIWriteLinkSupervisionTimeout: pointer to the "HCI Link Supervision Timeout" 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 pBapHCIWriteLinkSupervisionTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLinkSupervisionTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pBapHCIWriteLinkSupervisionTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U8_t phyLinkHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIWriteLinkSupervisionTimeout) || - (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the phyiscal link handle extracted from - logical link handle (lower byte valid) */ - phyLinkHandle = (v_U8_t) pBapHCIWriteLinkSupervisionTimeout->log_link_handle; - - if (phyLinkHandle != btampContext->phy_link_handle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid Physical link handle in %s", __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.log_link_handle - = pBapHCIWriteLinkSupervisionTimeout->log_link_handle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - /* Save the LS timeout interval */ - btampContext->bapLinkSupervisionTimerInterval = - pBapHCIWriteLinkSupervisionTimeout->link_supervision_timeout; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.log_link_handle - = pBapHCIWriteLinkSupervisionTimeout->log_link_handle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Link_Supervision_TO.status - = WLANBAP_STATUS_SUCCESS; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteLinkSupervisionTimeout */ - -/* v3.0 Host Controller and Baseband Commands */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLogicalLinkAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Read Logical Link Accept Timeout 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 pBapHCIReadLogicalLinkAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLogicalLinkAcceptTimeout -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Logical_Link_Accept_TO.status - = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout - = btampContext->bapLogicalLinkAcceptTimerInterval; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLogicalLinkAcceptTimeout */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLogicalLinkAcceptTimeout() - - DESCRIPTION - Implements the actual HCI Write Logical Link Accept Timeout 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. - pBapHCIWriteLogicalLinkAcceptTimeout: pointer to the "HCI Logical Link Accept Timeout" 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 pBapHCIWriteLogicalLinkAcceptTimeout is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLogicalLinkAcceptTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pBapHCIWriteLogicalLinkAcceptTimeout, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIWriteLogicalLinkAcceptTimeout) - || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the allowed timeout interval range */ - if ((pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout > - WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE) || - (pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout < - WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Out of range for logical connection accept timeout parameters in %s", - __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Logical_Link_Accept_TO.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - /* Save the Physical link connection accept timeout value */ - btampContext->bapLogicalLinkAcceptTimerInterval = - pBapHCIWriteLogicalLinkAcceptTimeout->logical_link_accept_timeout; - - /* Return status for command complete event */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Logical_Link_Accept_TO.status - = WLANBAP_STATUS_SUCCESS; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteLogicalLinkAcceptTimeout */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetEventMaskPage2() - - DESCRIPTION - Implements the actual HCI Set Event Mask Page 2 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. - pBapHCISetEventMaskPage2: pointer to the "HCI Set Event Mask Page 2" 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 pBapHCISetEventMaskPage2 is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetEventMaskPage2 -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pBapHCISetEventMaskPage2, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCISetEventMaskPage2) - || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - - /* Save away the event mask */ - vos_mem_copy( - btampContext->event_mask_page_2, - pBapHCISetEventMaskPage2->event_mask_page_2, - 8 ); - - /* Return status for command complete event */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Set_Event_Mask_Page_2.status - = WLANBAP_STATUS_SUCCESS; - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPSetEventMaskPage2 */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocationData() - - DESCRIPTION - Implements the actual HCI Read Location Data 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 pBapHCIReadLocationData is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocationData -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - ptBtampContext btampContext; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - btampContext = (ptBtampContext) btampHandle; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_domain_aware - = btampContext->btamp_Location_Data_Info.loc_domain_aware; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_options - = btampContext->btamp_Location_Data_Info.loc_options; - - vos_mem_copy( - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.loc_domain, - btampContext->btamp_Location_Data_Info.loc_domain, - 3 ); - - /* Return status for command complete event */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Location_Data.status - = WLANBAP_STATUS_SUCCESS; - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLocationData */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteLocationData() - - DESCRIPTION - Implements the actual HCI Write Location Data 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. - pBapHCIWriteLocationData: pointer to the "HCI Write Location Data" 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 pBapHCIWriteLocationData is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteLocationData -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Location_Data_Cmd *pBapHCIWriteLocationData, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIWriteLocationData) - || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - btampContext = (ptBtampContext) btampHandle; - - btampContext->btamp_Location_Data_Info.loc_domain_aware = - pBapHCIWriteLocationData->loc_domain_aware; - - btampContext->btamp_Location_Data_Info.loc_options = - pBapHCIWriteLocationData->loc_options; - - vos_mem_copy( - btampContext->btamp_Location_Data_Info.loc_domain, - pBapHCIWriteLocationData->loc_domain, - 3 ); - - /* Return status for command complete event */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Location_Data.status - = WLANBAP_STATUS_SUCCESS; - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteLocationData */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadFlowControlMode() - - DESCRIPTION - Implements the actual HCI Read Flow Control Mode 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 pBapHCIReadFlowControlMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadFlowControlMode -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Flow_Control_Mode.status - = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Flow_Control_Mode.flow_control_mode - = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadFlowControlMode */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteFlowControlMode() - - DESCRIPTION - Implements the actual HCI Write Flow Control Mode 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. - pBapHCIWriteFlowControlMode: pointer to the "HCI Write Flow Control Mode" 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 pBapHCIWriteFlowControlMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteFlowControlMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pBapHCIWriteFlowControlMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteFlowControlMode */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadBestEffortFlushTimeout() - - DESCRIPTION - Implements the actual HCI Read Best Effort Flush Timeout 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 pBapHCIReadBEFlushTO is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadBestEffortFlushTimeout -( - ptBtampHandle btampHandle, - /* The log_link_hanlde identifies which logical link's BE TO*/ - tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pBapHCIReadBEFlushTO, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadBestEffortFlushTimeout */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteBestEffortFlushTimeout() - - DESCRIPTION - Implements the actual HCI Write Best Effort Flush TO 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. - pBapHCIWriteBEFlushTO: pointer to the "HCI Write BE Flush TO" 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 pBapHCIWriteBEFlushTO is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteBestEffortFlushTimeout -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pBapHCIWriteBEFlushTO, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteBestEffortFlushTimeout */ - - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPSetShortRangeMode() - - DESCRIPTION - Implements the actual HCI Set Short Range Mode 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. - pBapHCIShortRangeMode: pointer to the "HCI Set Short Range Mode" 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 pBapHCIShortRangeMode is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPSetShortRangeMode -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pBapHCIShortRangeMode, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine); - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the BAP state to accept the Short Range Mode set request; - SRM set requests are allowed only in CONNECTED state */ - - /* Form and return the command status event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD; - - if (CONNECTED != instanceVar->stateVar) - { - /* Short Range Mode request in invalid state */ - pBapHCIEvent->u.btampCommandStatusEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - return VOS_STATUS_SUCCESS; - } - else if (pBapHCIShortRangeMode->phy_link_handle != btampContext->phy_link_handle) - { - /* Invalid Physical link handle */ - pBapHCIEvent->u.btampCommandStatusEvent.status = - WLANBAP_ERROR_NO_CNCT; - return VOS_STATUS_SUCCESS; - } - else if (pBapHCIShortRangeMode->short_range_mode > 0x01) - { - /* Invalid mode requested */ - pBapHCIEvent->u.btampCommandStatusEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - return VOS_STATUS_SUCCESS; - } - - pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - - /* Send the Command Status event (success) here, since Change Complete is next */ - (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - pBapHCIEvent, /* This now encodes ALL event types */ - VOS_FALSE /* Flag to indicate assoc-specific event */ - ); - - /* Format the Short Range Mode Complete event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT; - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.present = 1; - - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.status = - WLANBAP_STATUS_SUCCESS; /* Assumption for now */ - - /* The input parameters will go out in the CC Event */ - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.phy_link_handle = - pBapHCIShortRangeMode->phy_link_handle; - - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.short_range_mode = - pBapHCIShortRangeMode->short_range_mode; /* Assumption for now */ - - /* If the requested setting is different from the current setting... */ - if (pBapHCIShortRangeMode->short_range_mode != btampContext->phy_link_srm) - { - /* ... then change the SRM according to the requested value. - * If the attempt fails, the assumptions above need to be corrected. - */ - #if 0 - // Suggested API, needs to be created - if (VOS_STATUS_SUCCESS != HALSetShortRangeMode(pBapHCIShortRangeMode->short_range_mode)) - #else - if (0) - #endif - { - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.status = - WLANBAP_ERROR_HARDWARE_FAILURE; - pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent.short_range_mode = - btampContext->phy_link_srm; /* Switch back to current value */ - } - else - { - /* Update the SRM setting for this physical link, since it worked */ - btampContext->phy_link_srm = pBapHCIShortRangeMode->short_range_mode; - } - } - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPSetShortRangeMode */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPVendorSpecificCmd0() - - DESCRIPTION - Implements the actual HCI Vendor Specific Command 0 (OGF 0x3f, OCF 0x0000). - There is no need for a callback because when this call returns the action has - been completed. - - The command is received when: - - The A2MP Create Phy Link Response has been rx'd by the Bluetooth stack (initiator) - - 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 pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPVendorSpecificCmd0 -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine); - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the BAP state to accept the Vendor Specific Cmd 0: - this is only allowed for the BT_INITIATOR in the CONNECTING state */ - - /* Form and return the command status event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0; - - if ( (BT_INITIATOR != btampContext->BAPDeviceRole) || - (CONNECTING != instanceVar->stateVar) ) - { - /* Vendor Specific Command 0 happened in invalid state */ - pBapHCIEvent->u.btampCommandStatusEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - return VOS_STATUS_SUCCESS; - } - - /* Signal BT Coexistence code in firmware to prefer WLAN */ - WLANBAP_NeedBTCoexPriority(btampContext, 1); - - pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - - /* Send the Command Status event (success) here, since Command Complete is next */ - (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - pBapHCIEvent, /* This now encodes ALL event types */ - VOS_FALSE /* Flag to indicate assoc-specific event */ - ); - - /* Format the Vendor Specific Command 0 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_VENDOR_SPECIFIC_CMD_0; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Vendor_Specific_Cmd_0.status - = WLANBAP_STATUS_SUCCESS; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPVendorSpecificCmd0 */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPVendorSpecificCmd1() - - DESCRIPTION - Implements the actual HCI Vendor Specific Command 1 (OGF 0x3f, OCF 0x0001). - There is no need for a callback because when this call returns the action has - been completed. - - The command is received when: - - HCI wants to enable testability - - 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 pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPVendorSpecificCmd1 -( - ptBtampHandle btampHandle, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - - btampContext->btamp_async_logical_link_create = TRUE; - - - /* Format the Vendor Specific Command 1 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_VENDOR_SPECIFIC_CMD_1; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Vendor_Specific_Cmd_1.status - = WLANBAP_STATUS_SUCCESS; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPVendorSpecificCmd1 */ - -/*---------------------------------------------------------------------------- - - DESCRIPTION - Callback registered with TL for BAP, this is required in order for - TL to inform BAP, that the flush operation requested has been completed. - - The registered reception callback is being triggered by TL whenever a - frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - ucStaId: station identifier for the requested value - ucTid: identifier of the tspec - status: status of the Flush operation - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_TLFlushCompCallback -( - v_PVOID_t pvosGCtx, - v_U8_t ucStaId, - v_U8_t ucTID, - v_U8_t status -) -{ - - return VOS_STATUS_SUCCESS; -} // WLANBAP_TLFlushCompCallback - - -/* End of v3.0 Host Controller and Baseband Commands */ diff --git a/CORE/BAP/src/bapApiInfo.c b/CORE/BAP/src/bapApiInfo.c deleted file mode 100644 index 29b29314cd4c..000000000000 --- a/CORE/BAP/src/bapApiInfo.c +++ /dev/null @@ -1,606 +0,0 @@ -/* - * Copyright (c) 2012 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. -===========================================================================*/ - -/*=========================================================================== - - 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; -} diff --git a/CORE/BAP/src/bapApiLinkCntl.c b/CORE/BAP/src/bapApiLinkCntl.c deleted file mode 100644 index 7531a017eef8..000000000000 --- a/CORE/BAP/src/bapApiLinkCntl.c +++ /dev/null @@ -1,1936 +0,0 @@ -/* - * Copyright (c) 2012 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 L i n k C n t l . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - Link Control 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. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapApiLinkCntl.c,v 1.1 2010/10/23 23:40:28 labuser Exp labuser $$DateTime$$Author: labuser $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-09-15 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -//#include "wlan_qct_tl.h" -#include "vos_trace.h" -// Pick up the CSR callback definition -#include "csrApi.h" - -/* BT-AMP PAL API header file */ -#include "bapApi.h" -#include "bapInternal.h" -#include "btampFsm.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 - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_RoamCallback() - - DESCRIPTION - Callback for Roam (connection status) Events - - DEPENDENCIES - NA. - - PARAMETERS - - IN - pContext: is the pContext passed in with the roam request - pCsrRoamInfo: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and - eRoamCmdResult: for detail valid members. It may be NULL - roamId: is to identify the callback related roam request. 0 means unsolicited - roamStatus: is a flag indicating the status of the callback - roamResult: is the result - - RETURN VALUE - The eHalStatus code associated with performing the operation - - eHAL_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -#if 0 -eCSR_ROAM_RESULT_WDS_STARTED -#define eWLAN_BAP_MAC_START_BSS_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */ - -eCSR_ROAM_RESULT_FAILURE -eCSR_ROAM_RESULT_NOT_ASSOCIATED -#define eWLAN_BAP_MAC_START_FAILS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ - -eCSR_ROAM_RESULT_WDS_ASSOCIATED -#define eWLAN_BAP_MAC_CONNECT_COMPLETED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */ - - -eCSR_ROAM_RESULT_FAILURE -eCSR_ROAM_RESULT_NOT_ASSOCIATED -#define eWLAN_BAP_MAC_CONNECT_FAILED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ - - -eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND -#define eWLAN_BAP_MAC_CONNECT_INDICATION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */ - - -eCSR_ROAM_RESULT_KEY_SET -#define eWLAN_BAP_MAC_KEY_SET_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */ - - -eCSR_ROAM_RESULT_WDS_DISASSOC_IND -#define eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOC_IND */ - - -eCSR_ROAM_RESULT_WDS_STOPPED -#define eWLAN_BAP_MAC_READY_FOR_CONNECTIONS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */ - -#endif //0 - - -eHalStatus -WLANBAP_RoamCallback -( - void *pContext, - tCsrRoamInfo *pCsrRoamInfo, - tANI_U32 roamId, - eRoamCmdStatus roamStatus, - eCsrRoamResult roamResult -) -{ - eHalStatus halStatus = eHAL_STATUS_SUCCESS; - /* btampContext value */ - ptBtampContext btampContext = (ptBtampContext) pContext; - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_U8_t status; /* return the BT-AMP status here */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamStatus = %d", __func__, roamStatus); - - switch (roamStatus) { - //JEZ081110: For testing purposes, with Infra STA as BT STA, this - //actually takes care of the "eCSR_ROAM_RESULT_WDS_STARTED" case, - //below, better than "eCSR_ROAM_RESULT_IBSS_STARTED". - //case eCSR_ROAM_ROAMING_START: - case eCSR_ROAM_ASSOCIATION_START: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_ROAMING_START", roamResult); - // This only gets called when CSR decides to roam on its own - due to lostlink. -#if 0 - if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc)) - { - memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId, - sizeof(tSirMacAddr)); - apple80211Interface->willRoam(&bssid); // Return result isn't significant - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: willRoam returns\n", __func__); - } -#endif //0 - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - case eCSR_ROAM_SET_KEY_COMPLETE: - /* bapRoamCompleteCallback with eCSR_ROAM_SET_KEY_COMPLETE */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __func__, "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - case eCSR_ROAM_DISASSOCIATED: - /* bapRoamCompleteCallback with eCSR_ROAM_DISASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __func__, "eCSR_ROAM_DISASSOCIATED", roamStatus); - case eCSR_ROAM_LOSTLINK: - /* bapRoamCompleteCallback with eCSR_ROAM_LOSTLINK */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __func__, "eCSR_ROAM_LOSTLINK", roamStatus); - - if (roamResult != eCSR_ROAM_RESULT_NONE) { - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - } - - break; - - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamStatus = %d", __func__, roamStatus); - - break; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamResult = %d", __func__, roamResult); - - switch (roamResult) { - //JEZ081110: Commented out for testing. Test relies upon IBSS. - case eCSR_ROAM_RESULT_IBSS_STARTED: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_IBSS_STARTED", roamResult); - case eCSR_ROAM_RESULT_WDS_STARTED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_STARTED", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - //JEZ081110: Commented out for testing. Test relies upon IBSS. - //JEZ081110: But I cannot rely upon IBSS for the initial testing. - case eCSR_ROAM_RESULT_FAILURE: - //case eCSR_ROAM_RESULT_NOT_ASSOCIATED: - //case eCSR_ROAM_RESULT_IBSS_START_FAILED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_FAILURE", roamResult); -#ifdef FEATURE_WLAN_BTAMP_UT_RF - break; -#endif - case eCSR_ROAM_RESULT_WDS_START_FAILED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_START_FAILED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_START_FAILED", roamResult); - - /* Fill in the event structure */ - /* I don't think I should signal a eCSR_ROAM_RESULT_FAILURE - * as a eWLAN_BAP_MAC_START_FAILS - */ - bapEvent.event = eWLAN_BAP_MAC_START_FAILS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - //JEZ081110: Commented out for testing. This handles both Infra STA and IBSS STA. - case eCSR_ROAM_RESULT_IBSS_CONNECT: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult); - case eCSR_ROAM_RESULT_ASSOCIATED: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_ASSOCIATED", roamResult); - case eCSR_ROAM_RESULT_WDS_ASSOCIATED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_ASSOCIATED", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_CONNECT_COMPLETED; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - //JEZ081110: Commented out for testing. Test relies upon IBSS. - //JEZ081110: But I cannot rely upon IBSS for the initial testing. - //case eCSR_ROAM_RESULT_FAILURE: - case eCSR_ROAM_RESULT_IBSS_START_FAILED: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_IBSS_START_FAILED", roamResult); - case eCSR_ROAM_RESULT_NOT_ASSOCIATED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED", roamResult); -#ifdef FEATURE_WLAN_BTAMP_UT_RF - break; -#endif - case eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_CONNECT_FAILED; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - //JEZ081110: I think I have to check for the bssType to - //differentiate between IBSS Start and IBSS Join success. - //case eCSR_ROAM_RESULT_IBSS_CONNECT: - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult); - - //JEZ081110: Commented out for testing. Test relies upon IBSS. - // No longer commented out. - case eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_CONNECT_INDICATION; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - /* If BAP doesn't like the incoming association, signal SME/CSR */ - if ( status != WLANBAP_STATUS_SUCCESS) - halStatus = eHAL_STATUS_FAILURE; - - break; - - //JEZ081110: Not supported in SME and CSR, yet. -#if 0 - case eCSR_ROAM_RESULT_KEY_SET: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_KEY_SET", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; -#endif //0 - - case eCSR_ROAM_RESULT_DISASSOC_IND: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_DISASSOC_IND", roamResult); - case eCSR_ROAM_RESULT_WDS_DISASSOCIATED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOCIATED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_DISASSOCIATED", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - //JEZ081110: Commented out for testing. Test relies upon IBSS. - case eCSR_ROAM_RESULT_IBSS_INACTIVE: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_IBSS_INACTIVE", roamResult); - case eCSR_ROAM_RESULT_WDS_STOPPED: - /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __func__, "eCSR_ROAM_RESULT_WDS_STOPPED", roamResult); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; - bapEvent.params = pCsrRoamInfo; - bapEvent.u1 = roamStatus; - bapEvent.u2 = roamResult; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - break; - - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamResult = %d", __func__, roamResult); - - break; - } - -#if 0 - switch (roamResult) { - case eCSR_ROAM_RESULT_IBSS_CONNECT: - // we have an IBSS connection... - - // update our state - btampContext->mAssociatedStatus = WLANBAP_STATUS_SUCCESS; - btampContext->mAssociated = VOS_TRUE; - // update "assocBssid" with the BSSID of the IBSS - if (pCsrRoamInfo) - memcpy(btampContext->assocBssid, pCsrRoamInfo->peerMacOrBssidForIBSS, 6); - - // We must update the system role to match that of the - // lower layers in case the upper layers decided to try - // joining the network in infrastructure mode if the - // initial join in IBSS mode fails. Andreas Wolf - // (awolf@apple.com) explains the behavior as follows: - // "If the client attempts to join an open network and it fails - // on the first attempt, it reverts back to b-only mode. This - // workaround was specifically put in place to allow the client - // to associate to some third party b-only infrastructure APs. - // It did not take IBSS into account, it seems that the fallback - // always forces infrastructure." - - btampContext->systemRole = eSYSTEM_STA_IN_IBSS_ROLE; - - if (mLinkStatus == 0) - { - // enable the flow of data - DBGLOG("%s: marking link as up in %s\n", __func__, "eCSR_ROAM_RESULT_IBSS_CONNECT"); - mLinkStatus = 1; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp); - outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE); - outputQueue->start(); - // Let them know we are ready - ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE); - } - else - { - DBGLOG("%s: link is already up in %s\n", __func__, "eCSR_ROAM_RESULT_IBSS_CONNECT"); - } - break; - - case eCSR_ROAM_RESULT_IBSS_INACTIVE: - // we have no more IBSS peers, so disable the flow of data - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_RESULT_IBSS_INACTIVE"); - mLinkStatus = (tANI_U8) 0; - // JEZ070627: Revisit ? - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - outputQueue->stop(); - outputQueue->setCapacity(0); - - // update our state - btampContext->mAssociated = false; - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_RESULT_IBSS_INACTIVE"); - } - - break; - - case eCSR_ROAM_RESULT_ASSOCIATED: - btampContext->mAssociatedStatus = APPLE80211_STATUS_SUCCESS; - btampContext->mAssociated = true; - - if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) { - ccpCsrToAppleScanResult(mPMacObject, pCsrRoamInfo->pBssDesc, &scanResult); - - /* Save away the IEs used by the AP */ - ccpCsrToAssocApiedata( mPMacObject, pCsrRoamInfo->pBssDesc, &(btampContext->apiedata)); - - if (BssidChanged((tCsrBssid*) btampContext->assocBssid, (ether_addr*) scanResult.asr_bssid)) { - memcpy(btampContext->assocBssid, scanResult.asr_bssid, 6); - ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_BSSID_CHANGED ); - } - } - - ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE); - - if (mLinkStatus == 0) - { - mLinkStatus = (tANI_U8) 1; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp); - DBGLOG("%s: marking link as up in %s\n", __func__, "eCSR_ROAM_RESULT_ASSOCIATED"); - outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE); - outputQueue->start(); - } - else - { - DBGLOG("%s: link is already up in %s\n", __func__, "eCSR_ROAM_RESULT_ASSOCIATED"); - } - break; - case eCSR_ROAM_RESULT_NOT_ASSOCIATED: - btampContext->mAssociatedStatus = APPLE80211_STATUS_UNAVAILABLE; - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED"); - } - break; - - case eCSR_ROAM_RESULT_FAILURE: - btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE; - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_RESULT_FAILURE"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_RESULT_FAILURE"); - } - break; - - case eCSR_ROAM_RESULT_DISASSOC_IND: - { - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_RESULT_DISASSOC_IND"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_RESULT_DISASSOC_IND"); - } - - //if (pCsrRoamInfo) // For now, leave this commented out. Until CSR changes integrated. - { - // Now set the reason and status codes. - // Actually, the "result code" field in the tSirSmeDisassocInd should be named reasonCode and NOT statusCode. - // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame. - // For now, we are going to have to (painfully) map the only "result code" type information we have - // available at ALL from LIM/CSR. And that is the statusCode field of type tSirResultCodes - // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be - // of type tSirMacReasonCodes. - // Right now, we don't even have that. So, I have to just make up some "reason code" that I will - // pretend I found in the incoming DisAssoc Indication. - //btampContext->statusCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes - //btampContext->reasonCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes - btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes - btampContext->deAuthReasonCode = 0; // tANI_U16 // eSIR_SME_DEAUTH_FROM_PEER - // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16 // eSIR_SME_DISASSOC_FROM_PEER - btampContext->disassocReasonCode = btampContext->reasonCode; // tSirMacReasonCodes - // Let's remember the peer who just disassoc'd us - //memcpy(btampContext->peerMacAddr, pCsrRoamInfo->peerMacOrBssidForIBSS, 6); - } - } - break; - - case eCSR_ROAM_RESULT_DEAUTH_IND: - { - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_RESULT_DEAUTH_IND"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_RESULT_DEAUTH_IND"); - } - - //if (pCsrRoamInfo) // For now, leave this commented out. Until CSR changes integrated. - { - // Now set the reason and status codes. - // Actually, the "result code" field in the tSirSmeDeauthInd should be named reasonCode and NOT statusCode. - // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame. - // For now, we are going to have to (painfully) map the only "result code" type information we have - // available at ALL from LIM/CSR. And that is the statusCode field of type tSirResultCodes - // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be - // of type tSirMacReasonCodes. - // Right now, we don't even have that. So, I have to just make up some "reason code" that I will - // pretend I found in the incoming DeAuth Indication. - //btampContext->statusCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes - //btampContext->reasonCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes - btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes - btampContext->disassocReasonCode = 0; // tANI_U16 // eSIR_SME_DISASSOC_FROM_PEER - // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16 // eSIR_SME_DEAUTH_FROM_PEER - btampContext->deAuthReasonCode = btampContext->reasonCode; // tSirMacReasonCodes - // Let's remember the peer who just de-auth'd us - //memcpy(btampContext->peerMacAddr, ((tpSirSmeDeauthInd) pCallbackInfo)->peerMacAddr, 6); - } - } - break; - - case eCSR_ROAM_RESULT_MIC_ERROR_UNICAST: - - //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus) // Make sure - { - if (btampContext->mTKIPCounterMeasures) - { - ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_UCAST); - DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __func__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST"); - } - else - { - DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __func__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST"); - } - } - break; - - case eCSR_ROAM_RESULT_MIC_ERROR_GROUP: - - //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus) // Make sure - { - if (btampContext->mTKIPCounterMeasures) - { - ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_MCAST); - DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __func__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP"); - } - else - { - DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __func__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP"); - } - } - break; - - default: - break; - } - switch (roamStatus) { - case eCSR_ROAM_ROAMING_START: - DBGLOG("%s: In %s\n", __func__, "eCSR_ROAM_ROAMING_START"); - // This only gets called when CSR decides to roam on its own - due to lostlink. - // Apple still needs to be told. - if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc)) - { - memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId, - sizeof(tSirMacAddr)); - apple80211Interface->willRoam(&bssid); // Return result isn't significant - DBGLOG("%s: willRoam returns\n", __func__); - } - break; - - case eCSR_ROAM_SHOULD_ROAM: - if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) { - // pCallbackInfo points to the BSS desc. Convert to Apple Scan Result. - halStatus = ccpCsrToAppleScanResult( - mPMacObject, - pCsrRoamInfo->pBssDesc, - &scanResult); - if ( halStatus != 0 ) - return eHAL_STATUS_FAILURE; - roamAccepted = apple80211Interface->shouldRoam(&scanResult); // Return result is crucial - if (roamAccepted == true) { - // If the roam is acceptable, return SUCCESS - DBGLOG("%s: shouldRoam returns \"acceptable\"\n", __func__); -//#if 0 - // Actually, before returning, immediately signal willRoam - // This is a workaround for a CSR bug. Eventually, when - // eCSR_ROAM_ASSOCIATION_START gets called WITH callback param p1 - // pointing to a tBssDescription, this work-around can be removed. - memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, sizeof(tSirMacAddr)); - apple80211Interface->willRoam(&bssid); // Return result isn't significant - DBGLOG("%s: willRoam (called out of order) returns\n", __func__); - DBGLOG(" with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet)); -//#endif - return eHAL_STATUS_SUCCESS; - } else { - // If the roam is NOT acceptable, return FAILURE - DBGLOG("%s: shouldRoam returns \"NOT acceptable\"\n", __func__); - return eHAL_STATUS_FAILURE; - } - } - break; - - case eCSR_ROAM_DISASSOCIATED: - //if (eCSR_ROAM_RESULT_FORCED == roamResult || eCSR_ROAM_RESULT_MIC_ERROR == roamResult) - { - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_DISASSOCIATED"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_DISASSOCIATED"); - } - } - break; - - case eCSR_ROAM_LOSTLINK: - btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE; - btampContext->mAssociated = false; - - if (mLinkStatus != 0) - { - DBGLOG("%s: marking link as down in %s\n", __func__, "eCSR_ROAM_LOSTLINK"); - mLinkStatus = (tANI_U8) 0; - ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown); - } - else - { - DBGLOG("%s: link already down in %s\n", __func__, "eCSR_ROAM_LOSTLINK"); - } - break; - - case eCSR_ROAM_ASSOCIATION_START: - DBGLOG("%s: In %s\n", __func__, "eCSR_ROAM_ASSOCIATION_START"); -#if 0 - // This is the right place to call willRoam - for an "initial" association. - // But, unfortunately, when eCSR_ROAM_ASSOCIATION_START gets called, - // it doesn't have a pointer to the tBssDescription in the roaming callback - // routines parameter p1 (pCallbackInfo in SetWextState). So, don't use this code, yet. - if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc) { - memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, 6); - apple80211Interface->willRoam(&bssid); // Return result isn't significant - DBGLOG("%s: willRoam returns\n", __func__); - DBGLOG(" with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet)); - } -#endif //0 - break; - - case eCSR_ROAM_ASSOCIATION_COMPLETION: - DBGLOG("%s: In %s\n", __func__, "eCSR_ROAM_ASSOCIATION_COMPLETION"); - break; - - case eCSR_ROAM_MIC_ERROR_IND: // Handled in eCSR_ROAM_RESULT_MIC_ERROR_UNICAST and GROUP, above - case eCSR_ROAM_CANCELLED: - case eCSR_ROAM_ROAMING_COMPLETION: - case eCSR_ROAM_SCAN_FOUND_NEW_BSS: - default: - break; - } -#endif //0 - - return halStatus; -} - -/*---------------------------------------------------------------------------- - Host Controller Interface Procedural API - ---------------------------------------------------------------------------*/ - -/** BT v3.0 Link Control commands */ - -/*---------------------------------------------------------------------------- - Each of the next eight command result in asynchronous events (e.g., - HCI_PHYSICAL_LINK_COMPLETE_EVENT, HCI_LOGICAL_LINK_COMPLETE_EVENT, etc...) - These are signalled thru the event callback. (I.E., (*tpWLAN_BAPEventCB).) - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkCreate() - - DESCRIPTION - Implements the actual HCI Create Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - WLANBAP_GetNewHndl has to be called before every call to - WLAN_BAPPhysicalLinkCreate. Since the context is per - physical link. - pBapHCIPhysLinkCreate: pointer to the "HCI Create Physical Link" Structure. - pHddHdl: The context passed in by the caller. (e.g., BSL specific context) - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkCreate is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkCreate -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Create_Physical_Link_Cmd *pBapHCIPhysLinkCreate, - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - /* And I get phy_link_handle from the Command */ - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus; - /* I am using btampContext, instead of pBapPhysLinkMachine */ - //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine; - ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ - v_U8_t status; /* return the BT-AMP status here */ - BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine); - - /* Validate params */ - if ((pBapHCIPhysLinkCreate == NULL) || (NULL == btampContext)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %p, pBapHCIPhysLinkCreate is %p", - __func__, btampHandle, pBapHCIPhysLinkCreate); - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - if(DISCONNECTED != instanceVar->stateVar) - { - /* Create/Accept Phy link request in invalid state */ - status = WLANBAP_ERROR_MAX_NUM_CNCTS; - - } - else - { - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE; - bapEvent.params = pBapHCIPhysLinkCreate; - //bapEvent.callback = pBapHCIPhysLinkCreateCB; - - /* Allocate a new state machine instance */ - /* There will only ever be one of these (NB: Don't assume this.) */ - /* So for now this returns a pointer to a static structure */ - /* (With all state set to initial values) */ - vosStatus = WLANBAP_CreateNewPhyLinkCtx ( - btampHandle, - pBapHCIPhysLinkCreate->phy_link_handle, /* I get phy_link_handle from the Command */ - pHddHdl, /* BSL passes in its specific context */ - &btampContext, /* Handle to return per assoc btampContext value in */ - BT_INITIATOR); /* BT_INITIATOR */ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %p", __func__, btampContext); - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - } - - /* Format the command status event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.status = status; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD; - - /* ... */ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPPhysicalLinkCreate */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkAccept() - - DESCRIPTION - Implements the actual HCI Accept Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIPhysLinkAccept: pointer to the "HCI Accept Physical Link" Structure. - pHddHdl: The context passed in by the caller. (e.g., BSL specific context) - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkAccept is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkAccept -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Accept_Physical_Link_Cmd *pBapHCIPhysLinkAccept, - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - /* And I get phy_link_handle from the Command */ - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus; - /* I am using btampContext, instead of pBapPhysLinkMachine */ - //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine; - ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ - v_U8_t status; /* return the BT-AMP status here */ - BTAMPFSM_INSTANCEDATA_T *instanceVar; - - /* Validate params */ - if ((pBapHCIPhysLinkAccept == NULL) || (NULL == btampContext)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %p, pBapHCIPhysLinkAccept is %p", - __func__, btampHandle, pBapHCIPhysLinkAccept); - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - instanceVar = &(btampContext->bapPhysLinkMachine); - if(DISCONNECTED != instanceVar->stateVar) - { - /* Create/Accept Phy link request in invalid state */ - status = WLANBAP_ERROR_MAX_NUM_CNCTS; - - } - else - { - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT; - bapEvent.params = pBapHCIPhysLinkAccept; - //bapEvent.callback = pBapHCIPhysLinkAcceptCB; - - /* Allocate a new state machine instance */ - /* There will only ever be one of these (NB: Don't assume this.) */ - /* So for now this returns a pointer to a static structure */ - /* (With all state set to initial values) */ - vosStatus = WLANBAP_CreateNewPhyLinkCtx ( - btampHandle, - pBapHCIPhysLinkAccept->phy_link_handle, /* I get phy_link_handle from the Command */ - pHddHdl, /* BSL passes in its specific context */ - &btampContext, /* Handle to return per assoc btampContext value in */ - BT_RESPONDER); /* BT_RESPONDER */ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %p", __func__, btampContext); - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - } - /* Format the command status event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.status = status; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD; - - /* ... */ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPPhysicalLinkAccept */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPPhysicalLinkDisconnect() - - DESCRIPTION - Implements the actual HCI Disconnect Physical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIPhysLinkDisconnect: pointer to the "HCI Disconnect Physical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkDisconnect is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPPhysicalLinkDisconnect -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pBapHCIPhysLinkDisconnect, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus; - /* I am using btampContext, instead of pBapPhysLinkMachine */ - //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine; - ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ - v_U8_t status; /* return the BT-AMP status here */ - - /* Validate params */ - if (pBapHCIPhysLinkDisconnect == NULL) { - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate the Physical link handle */ - if (pBapHCIPhysLinkDisconnect->phy_link_handle != btampContext->phy_link_handle) - { - /* Format the command status event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD; - return VOS_STATUS_SUCCESS; - } - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT; - bapEvent.params = pBapHCIPhysLinkDisconnect; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %p", __func__, btampContext); - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; - bapEvent.params = pBapHCIPhysLinkDisconnect; - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - - /* Format the command status event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - pBapHCIEvent->u.btampCommandStatusEvent.present = 1; - pBapHCIEvent->u.btampCommandStatusEvent.status = status; - pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD; - - /* ... */ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPPhysicalLinkDisconnect */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkCreate() - - DESCRIPTION - Implements the actual HCI Create Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkCreate: pointer to the "HCI Create Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCreate is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkCreate -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Create_Logical_Link_Cmd *pBapHCILogLinkCreate, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - VOS_STATUS vosStatus; - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U16_t log_link_index = 0; - BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine); - VOS_STATUS retval; - v_U16_t index_for_logLinkCtx = 0; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /* Validate params */ - if (btampHandle == NULL) { - return VOS_STATUS_E_FAULT; - } - - /* Validate params */ - if (pBapHCILogLinkCreate == NULL) { - return VOS_STATUS_E_FAULT; - } - - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate the BAP state to accept the logical link request - Logical Link create/accept requests are allowed only in - CONNECTED state */ - /* Form and immediately return the command status event... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - bapHCIEvent.u.btampCommandStatusEvent.present = 1; - bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD; - - retval = VOS_STATUS_E_FAILURE; - if(DISCONNECTED == instanceVar->stateVar) - { - /* Create Logical link request in invalid state */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - - } - else if (CONNECTED != instanceVar->stateVar) - { - /* Create Logical link request in invalid state */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED; - } - else if (pBapHCILogLinkCreate->phy_link_handle != btampContext->phy_link_handle) - { - /* Invalid Physical link handle */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress; - - if( TRUE == btampContext->btamp_logical_link_cancel_pending ) - { - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_NO_CNCT; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - btampContext->btamp_logical_link_cancel_pending = FALSE; - } - else - { - /* If btamp_async_logical_link_create is set, we will seralize the req - on MC thread & handle it there after; If the above flag is not set - respond to HCI the sync way as before */ - if(FALSE == btampContext->btamp_async_logical_link_create) - { - /* Allocate a logical link index for these flow specs */ - vosStatus = WLANBAP_CreateNewLogLinkCtx( - btampContext, /* per assoc btampContext value */ - pBapHCILogLinkCreate->phy_link_handle, /* I get phy_link_handle from the Command */ - pBapHCILogLinkCreate->tx_flow_spec, /* I get tx_flow_spec from the Command */ - pBapHCILogLinkCreate->rx_flow_spec, /* I get rx_flow_spec from the Command */ - &log_link_index /* Return the logical link index here */ - ); - if (VOS_STATUS_SUCCESS != vosStatus) - { - /* Invalid flow spec format */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - else - { - retval = VOS_STATUS_SUCCESS; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen; - } - } - else - { - btampContext->btamp_logical_link_req_info.phyLinkHandle = - pBapHCILogLinkCreate->phy_link_handle; - vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec, - pBapHCILogLinkCreate->tx_flow_spec, 18); - vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec, - pBapHCILogLinkCreate->rx_flow_spec, 18); - btampContext->btamp_async_logical_link_create = FALSE; - vosStatus = btampEstablishLogLink(btampContext); - if(VOS_STATUS_SUCCESS == vosStatus) - { - retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI - } - else - { - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - - } - } - } - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - index_for_logLinkCtx = log_link_index >> 8; - /* Format the Logical Link Complete event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1; - - /* Return the logical link index here */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle - = log_link_index; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle - = pBapHCILogLinkCreate->phy_link_handle; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id - = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id; - - /* ... */ - - return retval; -} /* WLAN_BAPLogicalLinkCreate */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkAccept() - - DESCRIPTION - Implements the actual HCI Accept Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkAccept: pointer to the "HCI Accept Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkAccept is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkAccept -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Accept_Logical_Link_Cmd *pBapHCILogLinkAccept, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - VOS_STATUS vosStatus; - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U16_t log_link_index = 0; - BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine); - VOS_STATUS retval; - v_U16_t index_for_logLinkCtx; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /* Validate params */ - if (btampHandle == NULL) { - return VOS_STATUS_E_FAULT; - } - - /* Validate params */ - if (pBapHCILogLinkAccept == NULL) { - return VOS_STATUS_E_FAULT; - } - - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate the BAP state to accept the logical link request - Logical Link create/accept requests are allowed only in - CONNECTED state */ - /* Form and immediately return the command status event... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - bapHCIEvent.u.btampCommandStatusEvent.present = 1; - bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD; - - retval = VOS_STATUS_E_FAILURE; - if(DISCONNECTED == instanceVar->stateVar) - { - /* Create Logical link request in invalid state */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - - } - else if (CONNECTED != instanceVar->stateVar) - { - /* Create Logical link request in invalid state */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_CMND_DISALLOWED; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED; - } - else if (pBapHCILogLinkAccept->phy_link_handle != btampContext->phy_link_handle) - { - /* Invalid Physical link handle */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress; - if( TRUE == btampContext->btamp_logical_link_cancel_pending ) - { - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_NO_CNCT; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - btampContext->btamp_logical_link_cancel_pending = FALSE; - } - else - { - /* If btamp_async_logical_link_create is set, we will seralize the req - on MC thread & handle it there after; If the above flag is not set - respond to HCI the sync way as before */ - if(FALSE == btampContext->btamp_async_logical_link_create) - { - /* Allocate a logical link index for these flow specs */ - vosStatus = WLANBAP_CreateNewLogLinkCtx( - btampContext, /* per assoc btampContext value */ - pBapHCILogLinkAccept->phy_link_handle, /* I get phy_link_handle from the Command */ - pBapHCILogLinkAccept->tx_flow_spec, /* I get tx_flow_spec from the Command */ - pBapHCILogLinkAccept->rx_flow_spec, /* I get rx_flow_spec from the Command */ - &log_link_index /* Return the logical link index here */ - ); - if (VOS_STATUS_SUCCESS != vosStatus) - { - /* Invalid flow spec format */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - else - { - retval = VOS_STATUS_SUCCESS; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen; - } - } - else - { - btampContext->btamp_logical_link_req_info.phyLinkHandle = - pBapHCILogLinkAccept->phy_link_handle; - vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec, - pBapHCILogLinkAccept->tx_flow_spec, 18); - vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec, - pBapHCILogLinkAccept->rx_flow_spec, 18); - btampContext->btamp_async_logical_link_create = FALSE; - vosStatus = btampEstablishLogLink(btampContext); - if(VOS_STATUS_SUCCESS == vosStatus) - { - retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI - } - else - { - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - - } - } - } - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - index_for_logLinkCtx = log_link_index >> 8; - - /* Format the Logical Link Complete event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1; - /* Return the logical link index here */ - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle - = log_link_index; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle - = pBapHCILogLinkAccept->phy_link_handle; - pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id - = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id; - - /* ... */ - - return retval; -} /* WLAN_BAPLogicalLinkAccept */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkDisconnect() - - DESCRIPTION - Implements the actual HCI Disconnect Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkDisconnect: pointer to the "HCI Disconnect Logical Link" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkDisconnect is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkDisconnect -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pBapHCILogLinkDisconnect, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - tpBtampLogLinkCtx pLogLinkContext; - VOS_STATUS retval = VOS_STATUS_SUCCESS; - v_U8_t log_link_index; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - /*------------------------------------------------------------------------ - Sanity check - ------------------------------------------------------------------------*/ - if (( NULL == pBapHCILogLinkDisconnect ) || - ( NULL == btampContext)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Critical error: Invalid input parameter on %s", - __func__); - return VOS_STATUS_E_FAULT; - } - - /* Derive logical link index from handle */ - log_link_index = ((pBapHCILogLinkDisconnect->log_link_handle) >> 8); - - if( log_link_index >= WLANBAP_MAX_LOG_LINKS ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Critical error: Invalid input parameter on %s", - __func__); - /* Fill in the event code to propagate the event notification to BRM - BRM generates the Command status Event based on this.*/ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT; - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1; - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - return VOS_STATUS_E_INVAL; - - } - -#ifdef BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: btampContext value = %p in %s:%d", btampContext, __func__, __LINE__ ); -#endif //BAP_DEBUG - - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - bapHCIEvent.u.btampCommandStatusEvent.present = 1; - bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD; - - /*------------------------------------------------------------------------ - FIXME: Validate the Logical Link handle, Generation and freeing... - Here the Logical link is not validated and assumed that it is correct to. - get the Logical link context. . - ------------------------------------------------------------------------*/ - pLogLinkContext = - &(btampContext->btampLogLinkCtx[log_link_index]); - - // Validate whether the context is active. - if ((VOS_FALSE == pLogLinkContext->present) || - (pBapHCILogLinkDisconnect->log_link_handle != pLogLinkContext->log_link_handle)) - { - /* If status is failed, the platform specific layer generates the - command status event with proper status */ - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - retval = VOS_STATUS_E_FAILURE; -#ifdef BAP_DEBUG - /* Log the error. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s:%d Invalid Logical Link handle(should be) = %d(%d)", __func__, __LINE__, - pBapHCILogLinkDisconnect->log_link_handle, pLogLinkContext->log_link_handle); - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " Logical Link index = %d", log_link_index); -#endif //BAP_DEBUG - } - else - { - /* Form and return the command status event... */ - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status - = WLANBAP_STATUS_SUCCESS; - - - pLogLinkContext->present = VOS_FALSE; - pLogLinkContext->uTxPktCompleted = 0; - pLogLinkContext->log_link_handle = 0; - /* Decrement the total logical link count */ - btampContext->total_log_link_index--; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - - /* Notify the Command status Event */ - (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - /* Format the Logical Link Complete event to return... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT; - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1; - /* Return the logical link index here */ - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.log_link_handle - = pBapHCILogLinkDisconnect->log_link_handle; - pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.reason - = WLANBAP_ERROR_TERM_BY_LOCAL_HOST; - - return retval; -} /* WLAN_BAPLogicalLinkDisconnect */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPLogicalLinkCancel() - - DESCRIPTION - Implements the actual HCI Cancel Logical Link command - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCILogLinkCancel: pointer to the "HCI Cancel Logical Link" 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.) - (BTW, the required "HCI Logical Link Complete Event" - will be generated by the BAP state machine and sent up - via the (*tpWLAN_BAPEventCB).) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCancel is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPLogicalLinkCancel -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Logical_Link_Cancel_Cmd *pBapHCILogLinkCancel, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext; - BTAMPFSM_INSTANCEDATA_T *instanceVar; - /* Validate params */ - if ((btampHandle == NULL) || (pBapHCILogLinkCancel == NULL) || - (pBapHCIEvent == NULL)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Null Parameters Not allowed", __func__); - return VOS_STATUS_E_FAULT; - } - - btampContext = (ptBtampContext) btampHandle; - instanceVar = &(btampContext->bapPhysLinkMachine); - - /* Form and immediately return the command status event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode = - BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - - if (pBapHCILogLinkCancel->phy_link_handle != btampContext->phy_link_handle) - { - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status = - WLANBAP_ERROR_NO_CNCT; - } - else - { - /* As the logical link create is returned immediately, the logical link is - created and so cancel can not return success. - And it returns WLANBAP_ERROR_NO_CNCT if not connected or - WLANBAP_ERROR_MAX_NUM_ACL_CNCTS if connected */ - if(WLAN_BAPLogLinkClosed == btampContext->btamp_logical_link_state ) - { - /* Cancel Logical link request in invalid state */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status = - WLANBAP_ERROR_NO_CNCT; - } - else if(WLAN_BAPLogLinkOpen == btampContext->btamp_logical_link_state ) - { - /* Cancel Logical link request in conected state */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status = - WLANBAP_ERROR_MAX_NUM_ACL_CNCTS; - } - else if(WLAN_BAPLogLinkInProgress == btampContext->btamp_logical_link_state ) - { - /* Cancel Logical link request in progress state, need to fail logical link - creation as well */ - btampContext->btamp_logical_link_cancel_pending = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status = - WLANBAP_STATUS_SUCCESS; - } - else - { - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status = - WLANBAP_ERROR_NO_CNCT; - } - } - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.phy_link_handle = - pBapHCILogLinkCancel->phy_link_handle; - /* Since the status is not success, the Tx flow spec Id is not meaningful and - filling with 0 */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.tx_flow_spec_id = - pBapHCILogLinkCancel->tx_flow_spec_id; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPLogicalLinkCancel */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPFlowSpecModify() - - DESCRIPTION - Implements the actual HCI Modify Logical Link command - Produces an asynchronous flow spec modify complete event. Through the - event callback. - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - pBapHCIFlowSpecModify: pointer to the "HCI Flow Spec Modify" Structure. - - IN/OUT - pBapHCIEvent: Return event value for the command status event. - (The caller of this routine is responsible for sending - the Command Status event up the HCI interface.) - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIFlowSpecModify is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPFlowSpecModify -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Flow_Spec_Modify_Cmd *pBapHCIFlowSpecModify, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - v_U16_t index_for_logLinkHandle = 0; - ptBtampContext btampContext; - tpBtampLogLinkCtx pLogLinkContext; - v_U32_t retval; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - /* Validate params */ - if ((btampHandle == NULL) || (pBapHCIFlowSpecModify == NULL) || - (pBapHCIEvent == NULL)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Null Parameters Not allowed", __func__); - return VOS_STATUS_E_FAULT; - } - - btampContext = (ptBtampContext) btampHandle; - - index_for_logLinkHandle = pBapHCIFlowSpecModify->log_link_handle >> 8; /* Return the logical link index here */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - " %s:index_for_logLinkHandle=%d", __func__,index_for_logLinkHandle); - - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - bapHCIEvent.u.btampCommandStatusEvent.present = 1; - bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1; - bapHCIEvent.u.btampCommandStatusEvent.command_opcode - = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD; - - /*------------------------------------------------------------------------ - Evaluate the Tx and Rx Flow specification for this logical link. - ------------------------------------------------------------------------*/ - // Currently we only support flow specs with service types of BE (0x01) - - /*------------------------------------------------------------------------ - Now configure the Logical Link context. - ------------------------------------------------------------------------*/ - pLogLinkContext = &(btampContext->btampLogLinkCtx[index_for_logLinkHandle]); - - /* Extract Tx flow spec into the context structure */ - retval = btampUnpackTlvFlow_Spec((void *)btampContext, pBapHCIFlowSpecModify->tx_flow_spec, - WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN, - &pLogLinkContext->btampFlowSpec); - if (retval != BTAMP_PARSE_SUCCESS) - { - /* Flow spec parsing failed, return failure */ - vosStatus = VOS_STATUS_E_FAILURE; - pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status = - WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status - = WLANBAP_STATUS_SUCCESS; - - } - /* Notify the Command status Event */ - vosStatus = - (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - /* Form and immediately return the command status event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT; - pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.present = 1; - pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.log_link_handle = - pBapHCIFlowSpecModify->log_link_handle; - - return vosStatus; -} /* WLAN_BAPFlowSpecModify */ - - -void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext) -{ - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - v_U16_t log_link_index = 0; - v_U16_t index_for_logLinkCtx = 0; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - if (btampContext == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Null Parameters Not allowed", __func__); - return; - } - - if( TRUE == btampContext->btamp_logical_link_cancel_pending ) - { - bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - btampContext->btamp_logical_link_cancel_pending = FALSE; - } - else - { - /* Allocate a logical link index for these flow specs */ - vosStatus = WLANBAP_CreateNewLogLinkCtx( - btampContext, /* per assoc btampContext value */ - btampContext->btamp_logical_link_req_info.phyLinkHandle, /* I get phy_link_handle from the Command */ - btampContext->btamp_logical_link_req_info.txFlowSpec, /* I get tx_flow_spec from the Command */ - btampContext->btamp_logical_link_req_info.rxFlowSpec, /* I get rx_flow_spec from the Command */ - &log_link_index /* Return the logical link index here */ - ); - if (VOS_STATUS_SUCCESS != vosStatus) - { - /* Invalid flow spec format */ - bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed; - } - else - { - bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS; - btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen; - } - } - - index_for_logLinkCtx = log_link_index >> 8; - /* Format the Logical Link Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampLogicalLinkCompleteEvent.present = 1; - - /* Return the logical link index here */ - bapHCIEvent.u.btampLogicalLinkCompleteEvent.log_link_handle - = log_link_index; - bapHCIEvent.u.btampLogicalLinkCompleteEvent.phy_link_handle - = btampContext->btamp_logical_link_req_info.phyLinkHandle; - bapHCIEvent.u.btampLogicalLinkCompleteEvent.flow_spec_id - = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers to the BSL per connection context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - return; -} diff --git a/CORE/BAP/src/bapApiLinkSupervision.c b/CORE/BAP/src/bapApiLinkSupervision.c deleted file mode 100644 index 4425e2fcd06d..000000000000 --- a/CORE/BAP/src/bapApiLinkSupervision.c +++ /dev/null @@ -1,631 +0,0 @@ -/* - * Copyright (c) 2014 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 LinkSupervision . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - "platform independent" Data path 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. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-03-25 arulv Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -//#include "wlan_qct_tl.h" -#include "vos_trace.h" -//I need the TL types and API -#include "wlan_qct_tl.h" - -/* BT-AMP PAL API header file */ -#include "bapApi.h" -#include "bapInternal.h" -#include "bapApiTimer.h" - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - -#if 1 -//*BT-AMP packet LLC OUI value*/ -static const v_U8_t WLANBAP_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; - -/*LLC header value*/ -static v_U8_t WLANBAP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; -#endif - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Externalized Function Definitions -* -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_AcquireLSPacket( ptBtampContext pBtampCtx, vos_pkt_t **ppPacket, v_U16_t size, tANI_BOOLEAN isLsReq ) -{ - VOS_STATUS vosStatus; - vos_pkt_t *pPacket = NULL; - WLANBAP_8023HeaderType w8023Header; - v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; - v_U16_t headerLength; /* The 802.3 frame length*/ - v_U16_t protoType; - v_U8_t *pData = NULL; - - - if(isLsReq) - { - protoType = WLANTL_BT_AMP_TYPE_LS_REQ; - } - else - { - protoType = WLANTL_BT_AMP_TYPE_LS_REP; - } - - //If success, vosTxLsPacket is the packet and pData points to the head. - vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT,size, 1, - VOS_TRUE, NULL, NULL ); - if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - vosStatus = vos_pkt_reserve_head( pPacket, (v_VOID_t *)&pData, size ); - if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: failed to reserve size = %d\n",__func__, size ); - vos_pkt_return_packet( pPacket ); - } - } - - if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLANBAP_LinkSupervisionTimerHandler failed to get vos_pkt\n" ); - return vosStatus; - } - - // Form the 802.3 header - vos_mem_copy( w8023Header.vDA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE); - vos_mem_copy( w8023Header.vSA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE); - - headerLength = WLANBAP_LLC_HEADER_LEN; - /* Now the 802.3 length field is big-endian?! */ - w8023Header.usLenType = vos_cpu_to_be16(headerLength); - - /* Now adjust the protocol type bytes*/ - protoType = vos_cpu_to_be16( protoType); - /* Now form the LLC header */ - vos_mem_copy(aucLLCHeader, - WLANBAP_LLC_HEADER, - sizeof(WLANBAP_LLC_HEADER)); - vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], - WLANBAP_BT_AMP_OUI, - WLANBAP_LLC_OUI_SIZE); - vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], - &protoType, //WLANBAP_BT_AMP_TYPE_LS_REQ - WLANBAP_LLC_PROTO_TYPE_SIZE); - - /* Push on the LLC header */ - vos_pkt_push_head(pPacket, - aucLLCHeader, - WLANBAP_LLC_HEADER_LEN); - - /* Push on the 802.3 header */ - vos_pkt_push_head(pPacket, &w8023Header, sizeof(w8023Header)); - *ppPacket = pPacket; - return vosStatus; -} - - - -/*=========================================================================== - - FUNCTION WLANBAP_InitLinkSupervision - - DESCRIPTION - - This API will be called when Link Supervision module is to be initialized when connected at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -#define TX_LS_DATALEN 32 - -VOS_STATUS -WLANBAP_InitLinkSupervision -( - ptBtampHandle btampHandle -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - vos_pkt_t *pLSReqPacket; - vos_pkt_t *pLSRepPacket; - v_U16_t lsPktln; - - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - -#if 0 - /* Initialize Link supervision data structure */ - vos_mem_set(pLsInfo, sizeof(tBtampLS),0); - - /* Allocate memory for Static Tx Data */ - pLsInfo->pTxPktData = vos_mem_malloc(sizeof(tBtampLsPktData)+TX_LS_DATALEN); - - /* Initialize Static data for LS pkt Tx */ - pLsInfo->pTxPktData->BufLen = TX_LS_DATALEN; - vos_mem_copy (&pLsInfo->pTxPktData->pBuf, LsTxData, pLsInfo->pTxPktData->BufLen); -#endif - pBtampCtx->lsReqPktPending = VOS_FALSE; - pBtampCtx->retries = 0; - - vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSReqPacket,32, TRUE ); - if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - pBtampCtx->lsReqPacket = pLSReqPacket; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:AcquireLSPacket failed\n",__func__); - pBtampCtx->lsReqPacket = NULL; - return vosStatus; - } - - vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSRepPacket,32,FALSE ); - if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - pBtampCtx->lsRepPacket = pLSRepPacket; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:AcquireLSPacket failed\n",__func__); - pBtampCtx->lsRepPacket = NULL; - return vosStatus; - } - - vosStatus = vos_pkt_get_packet_length(pBtampCtx->lsRepPacket,&lsPktln); - - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:vos_pkt_get_length error",__func__); - return VOS_STATUS_E_FAULT; - } - pBtampCtx->lsPktln = lsPktln; - - /* Start Link Supervision Timer if not configured for infinite */ - if (pBtampCtx->bapLinkSupervisionTimerInterval) - { - vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, - pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:No LS configured for infinite",__func__); - } - - return vosStatus; -} - -/*=========================================================================== - - FUNCTION WLANBAP_DeInitLinkSupervision - - DESCRIPTION - - This API will be called when Link Supervision module is to be stopped after disconnected at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_DeInitLinkSupervision -( - ptBtampHandle btampHandle -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "In: %s", __func__); - - vosStatus = WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - - - /*Free the vos packet*/ - if ( pBtampCtx->lsRepPacket ) - { - vosStatus = vos_pkt_return_packet(pBtampCtx->lsRepPacket); - pBtampCtx->lsRepPacket = NULL; - } - - if ( pBtampCtx->lsReqPacket ) - { - vosStatus = vos_pkt_return_packet(pBtampCtx->lsReqPacket); - pBtampCtx->lsReqPacket = NULL; - } - - - return vosStatus; -} - -/*=========================================================================== - - FUNCTION WLANBAP_RxProcLsPkt - - DESCRIPTION - - This API will be called when Link Supervision frames are received at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the 802.3 frame to be - translated to BT HCI Data Packet - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_RxProcLsPkt -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - v_U16_t RxProtoType, /* Protocol Type from the frame received */ - vos_pkt_t *vosRxLsBuff -) -{ - VOS_STATUS vosStatus; - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - WLANBAP_8023HeaderType w8023Header; - v_SIZE_t HeaderLen = sizeof(w8023Header); - - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "In %s Received RxProtoType=%x", __func__,RxProtoType); - - vos_pkt_extract_data(vosRxLsBuff,0,(v_VOID_t*)&w8023Header,&HeaderLen); - if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE) - && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE))) - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "MAC address mismatch in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Free the vos packet*/ - vosStatus = vos_pkt_return_packet( vosRxLsBuff ); - if ( VOS_STATUS_SUCCESS != vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Failed to free VOS packet in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - - /* Reset Link Supervision timer */ - if (RxProtoType == WLANTL_BT_AMP_TYPE_LS_REP) - { - pBtampCtx->lsReqPktPending = FALSE; - pBtampCtx->retries = 0; - if (pBtampCtx->bapLinkSupervisionTimerInterval) - { - /* Restart the LS timer */ - WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, - pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); - } - } - else if(RxProtoType == WLANTL_BT_AMP_TYPE_LS_REQ) - { - if (pBtampCtx->bapLinkSupervisionTimerInterval) - { - /* Restart the LS timer */ - WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, - pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); - } - pBtampCtx->pPacket = pBtampCtx->lsRepPacket; - // Handle LS rep frame - vosStatus = WLANBAP_TxLinkSupervision( btampHandle, phy_link_handle, pBtampCtx->pPacket, WLANTL_BT_AMP_TYPE_LS_REP); - } - - return vosStatus; - -} - -/* Tx callback function for LS packet */ -static VOS_STATUS WLANBAP_TxLinkSupervisionCB -( - v_PVOID_t pvosGCtx, - vos_pkt_t *pPacket, - VOS_STATUS retStatus -) -{ - VOS_STATUS vosStatus; - ptBtampContext bapContext; /* Holds the btampContext value returned */ - vos_pkt_t *pLSPacket; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "TxCompCB reached for LS Pkt"); - - /* Get the BT AMP context from the global */ - bapContext = gpBtampCtx; - - if (!VOS_IS_STATUS_SUCCESS (retStatus)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "TxCompCB:Transmit status Failure"); - } - - if ( pPacket == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLANBAP_TxCompCB bad input\n" ); - return VOS_STATUS_E_FAILURE; - } - - - /* Return the packet & reallocate */ - - if( pPacket == bapContext->lsReqPacket ) - { - vosStatus = WLANBAP_AcquireLSPacket( bapContext, &pLSPacket,32, TRUE ); - if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - bapContext->lsReqPacket = pLSPacket; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:AcquireLSPacket failed\n",__func__); - bapContext->lsReqPacket = NULL; - return vosStatus; - } - } - else - { - vosStatus = WLANBAP_AcquireLSPacket( bapContext, &pLSPacket,32, FALSE ); - if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - bapContext->lsRepPacket = pLSPacket; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:AcquireLSPacket failed\n",__func__); - bapContext->lsRepPacket = NULL; - return vosStatus; - } - } - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "%s:Returned Vos Packet:%p\n", __func__, pPacket ); - - vos_pkt_return_packet( pPacket ); - - return (VOS_STATUS_SUCCESS ); -} - -/*=========================================================================== - - FUNCTION WLANBAP_TxLinkSupervision - - DESCRIPTION - - This API will be called to process Link Supervision Request received - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pucAC: Pointer to return the access category - vosDataBuff: The data buffer containing the 802.3 frame to be - translated to BT HCI Data Packet - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_TxLinkSupervision -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - vos_pkt_t *pPacket, - v_U16_t protoType -) -{ - ptBtampContext pBtampCtx = (ptBtampContext)btampHandle; - VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; - v_PVOID_t pvosGCtx; - v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - WLANTL_MetaInfoType metaInfo; - - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "In : %s protoType=%x", __func__,protoType); - - // Retrieve the VOSS context - pvosGCtx = pBtampCtx->pvosGCtx; - - /* Lookup the StaId using the phy_link_handle and the BAP context */ - - vosStatus = WLANBAP_GetStaIdFromLinkCtx ( - btampHandle, /* btampHandle value in */ - phy_link_handle, /* phy_link_handle value in */ - &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &pHddHdl); /* Handle to return BSL context */ - - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_TxLinKSupervisionReq"); - return VOS_STATUS_E_FAULT; - } - - vos_mem_zero( &metaInfo, sizeof( WLANTL_MetaInfoType ) ); - - metaInfo.ucTID = 0x00 ; - metaInfo.ucUP = 0x00; - metaInfo.ucIsEapol = VOS_FALSE;//Notify TL that this is NOT an EAPOL frame - metaInfo.ucDisableFrmXtl = VOS_FALSE; - metaInfo.ucType = 0x00; - pBtampCtx->metaInfo = metaInfo; - - vosStatus = WLANTL_TxBAPFrm( pvosGCtx, pPacket, &metaInfo, WLANBAP_TxLinkSupervisionCB ); - if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Tx: Packet rejected by TL in WLANBAP_TxLinkSupervisionReq"); - return vosStatus; - } - - if(protoType == WLANTL_BT_AMP_TYPE_LS_REQ) - { - pBtampCtx->lsReqPktPending = TRUE; - pBtampCtx->retries++; - } - - if (pBtampCtx->bapLinkSupervisionTimerInterval) - { - /* Restart the LS timer */ - WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, - pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); - } - - if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLANBAP_TxLinkSupervisionReq failed to Start LinkSupervision Timer\n" ); - return vosStatus; - } - - return vosStatus; -} /* WLANBAP_RxLinkSupervisionReq */ diff --git a/CORE/BAP/src/bapApiStatus.c b/CORE/BAP/src/bapApiStatus.c deleted file mode 100644 index 7fdf1dfc5b87..000000000000 --- a/CORE/BAP/src/bapApiStatus.c +++ /dev/null @@ -1,846 +0,0 @@ -/* - * Copyright (c) 2012 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 S t a t u s . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - Status 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. -===========================================================================*/ - -/*=========================================================================== - - 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/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 $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-09-15 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -//#include "wlan_qct_tl.h" -#include "vos_trace.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 - * -------------------------------------------------------------------------*/ - -/* -Status Parameters -*/ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadFailedContactCounter() - - DESCRIPTION - Implements the actual HCI Read Failed Contact Counter 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. - pBapHCIReadFailedContactCounter: pointer to the "HCI Read Failed Contact Counter" structure. - pFailedContactCounter: pointer to return value for the "Failed Contact Counter" - - 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 pBapHCIReadFailedContactCounter or - pFailedContactCounter is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadFailedContactCounter -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pBapHCIReadFailedContactCounter, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including "Read" Command Complete*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadFailedContactCounter */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPResetFailedContactCounter() - - DESCRIPTION - Implements the actual HCI Reset Failed Contact Counter 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. - pBapHCIResetFailedContactCounter: pointer to the "HCI Reset Failed Contact Counter" 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 pBapHCIResetFailedContactCounter is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPResetFailedContactCounter -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pBapHCIResetFailedContactCounter, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPResetFailedContactCounter */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLinkQuality() - - DESCRIPTION - Implements the actual HCI Read Link Quality 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. - pBapHCIReadLinkQuality: pointer to the "HCI Read Link Quality" structure. - pBapHCILinkQuality: pointer to return value for the "Link Quality" - - 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 pBapHCIReadLinkQuality or - pBapHCILinkQuality is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLinkQuality -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Link_Quality_Cmd *pBapHCIReadLinkQuality, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U8_t phyLinkHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIReadLinkQuality) || - (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the physical link handle extracted from - input parameter. This parameter has 2 bytes for physical handle - (only lower byte valid) */ - phyLinkHandle = (v_U8_t) pBapHCIReadLinkQuality->log_link_handle; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.log_link_handle - = phyLinkHandle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality = 0; - - if (phyLinkHandle != btampContext->phy_link_handle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid Physical link handle in %s", __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - /* Get the Link quality indication status from control block. - Link quality value is being updated on the SME callback */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality - = btampContext->link_quality; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status - = WLANBAP_STATUS_SUCCESS; - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLinkQuality */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadRSSI() - - DESCRIPTION - Implements the actual HCI Read RSSI 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. - pBapHCIReadRSSI: pointer to the "HCI Read RSSI" structure. - pBapHCIRSSI: pointer to return value for the "RSSI". - - 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 pBapHCIReadRSSI or - pBapHCIRSSI is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadRSSI -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_RSSI_Cmd *pBapHCIReadRSSI, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - VOS_STATUS vosStatus; - ptBtampContext btampContext = (ptBtampContext) btampHandle; - v_U8_t phyLinkHandle; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: btampHandle value: %p", __func__, btampHandle); - - /* Validate params */ - if ((NULL == btampHandle) || (NULL == pBapHCIReadRSSI) || - (NULL == pBapHCIEvent)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid input parameters in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Validate the physical link handle extracted from - input parameter. This parameter has 2 bytes for physical handle - (only lower byte valid) */ - phyLinkHandle = (v_U8_t) pBapHCIReadRSSI->log_link_handle; - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.phy_link_handle - = phyLinkHandle; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi = 0; - - if (phyLinkHandle != btampContext->phy_link_handle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Invalid Physical link handle in %s", __func__); - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status - = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - } - else - { - /* Get the RSSI value for this station (physical link) */ - vosStatus = WLANTL_GetRssi(btampContext->pvosGCtx, btampContext->ucSTAId, - &pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi,NULL); - - if (VOS_STATUS_SUCCESS == vosStatus) - { - /* GetRssi success, indicate the to upper layer */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status - = WLANBAP_STATUS_SUCCESS; - } - else - { - /* API failed, indicate unspecified error to upper layer */ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status - = WLANBAP_ERROR_UNSPECIFIED_ERROR; - } - } - - /* Fill in the parameters for command complete event... */ - pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT; - pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE; - pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1; - pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode - = BTAMP_TLV_HCI_READ_RSSI_CMD; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadRSSI */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocalAMPInfo() - - DESCRIPTION - Implements the actual HCI Read Local AMP Information 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. - pBapHCIReadLocalAMPInfo: pointer to the "HCI Read Local AMP Info" 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 pBapHCIReadLocalAMPInfo or - pBapHCILocalAMPInfo is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocalAMPInfo -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pBapHCIReadLocalAMPInfo, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - /* Validate params */ - if (btampHandle == NULL) { - return VOS_STATUS_E_FAULT; - } - - /* Validate params */ - if (pBapHCIReadLocalAMPInfo == 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_AMP_INFORMATION_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.status - = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Status - = WLANBAP_HCI_AMP_STATUS_NOT_SHARED; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Total_BW - = 24000; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW - = 12000; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Min_Latency - = 100; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size - = WLANBAP_MAX_80211_PAL_PDU_SIZE; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Controller_Type - = 1; -#if 0 -AMP Info PAL_Capabilities: Size: 2 Octets - -Value Parameter Description -0xXXXX Bit 0: "Service Type = Guaranteed" is not supported by PAL = 0 - "Service Type = Guaranteed" is supported by PAL = 1 - Bits 15-1: Reserved (shall be set to 0) - (See EFS in Generic AMP FIPD [1]) -#endif //0 - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities - = 0x00; // was 0x03. Completely wrong. - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length - = 248; - //= 40; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout - = 10000; //10; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout - = 10000; //8; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLocalAMPInfo */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPReadLocalAMPAssoc() - - DESCRIPTION - Implements the actual HCI Read Local AMP Assoc 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. - pBapHCIReadLocalAMPAssoc: pointer to the "HCI Read Local AMP Assoc" 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 pBapHCIReadLocalAMPAssoc - (or pBapHCILocalAMPAssoc) is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPReadLocalAMPAssoc -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pBapHCIReadLocalAMPAssoc, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - VOS_STATUS vosStatus; - ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ - tHalHandle hHal; - tBtampAMP_ASSOC btamp_ASSOC; - v_U32_t nConsumed = 0; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /* Validate params */ - if ((pBapHCIReadLocalAMPAssoc == NULL) || (NULL == btampHandle)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "param is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "In %s, phy_link_handle = %d", __func__, - pBapHCIReadLocalAMPAssoc->phy_link_handle); - - /* Update the MAC address and SSID if in case the Read Local AMP Assoc - * Request is made before Create Physical Link creation. - */ - WLANBAP_ReadMacConfig (btampContext); - - /* Fill in the contents of an AMP_Assoc structure in preparation - * for Packing it into the AMP_assoc_fragment field of the Read - * Local AMP Assoc Command Complete Event - */ - /* Return the local MAC address */ - btamp_ASSOC.AMP_Assoc_MAC_Addr.present = 1; - vos_mem_copy( - btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr, - btampContext->self_mac_addr, - sizeof(btampContext->self_mac_addr)); - - /*Save the local AMP assoc info*/ - vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_mac_addr, - btampContext->self_mac_addr, - sizeof(btampContext->self_mac_addr)); - - - /* JEZ090303: This logic should return a single channel list with the */ - /* selected channel, if we have one. */ - //if (btampContext->channel) - if (1) - { - /* Return the local Preferred Channel List */ - /* Return both the Regulatory Info and one channel list */ - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1; - memcpy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3); - /*Save the local AMP assoc info*/ - vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_pref_country, "XXX", 3); - - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 2; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0; - - if (( BT_INITIATOR == btampContext->BAPDeviceRole ) && - ( 0 != btampContext->channel )) - { - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->channel; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x01; //we are AP - we start on their 1st preferred channel - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11; - } - else - { - if (btampContext->config.ucPreferredChannel) - { - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->config.ucPreferredChannel; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = - 0x0B - btampContext->config.ucPreferredChannel + 1; - } - else - { - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = 0x01; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x0B; //all channels for 1 to 11 - } - - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11; - } - } else - { - /* Return the local Preferred Channel List */ - /* Return only the Regulatory Info */ - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1; - memcpy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3); - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 1; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254; - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0; - - } - - /*Save the local AMP assoc info*/ - btampContext->btamp_AMP_Assoc.HC_pref_num_triplets = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0]; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1]; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2]; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0]; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1]; - btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2]; - - /* Also, at this point, lie and tell the other side we are connected on */ - /* the one channel we support. I hope this convinces the peer as BT-AMP AP */ - /* We really want him to use our channel. Since we only support one.*/ - /* Return the local Connected Channel */ - btamp_ASSOC.AMP_Assoc_Connected_Channel.present = 1; - memcpy (btamp_ASSOC.AMP_Assoc_Connected_Channel.country, "XXX", 3); - btamp_ASSOC.AMP_Assoc_Connected_Channel.num_triplets = 2; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][0] = 201; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][1] = 254; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][2] = 0; - //btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = 0x01; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = (0 != btampContext->channel)?btampContext->channel:0x01; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][1] = 0x01; - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][2] = 0x11; - - - /* Return the local PAL Capabilities */ - btamp_ASSOC.AMP_Assoc_PAL_Capabilities.present = 1; - -#if 0 -AMP ASSOC Pal Capabilities: Size: 4 Octets - - Value Description - 4 TypeID for 802.11 PAL Capabilities - - 4 Length - - 0xXXXXXXXX Bit 0: - 0 signifies the PAL is not capable of utilizing - received Activity Reports - 1 signifies the PAL is capable of utilizing - received Activity Reports - Bit 1: - 0 signifies the PAL is not capable of utilizing - scheduling information sent in an Activity Report - 1 signifies the PAL is capable of utilizing - scheduling information sent in an Activity Report - Bits 2..31 Reserved - -#endif //0 - - btamp_ASSOC.AMP_Assoc_PAL_Capabilities.pal_capabilities -// = btampContext->btamp_Remote_AMP_Assoc.HC_pal_capabilities; - //= 0x03; - = 0x00; - - /* Return the local PAL Version */ - btamp_ASSOC.AMP_Assoc_PAL_Version.present = 1; - - /* Return the version and company ID data */ - btamp_ASSOC.AMP_Assoc_PAL_Version.pal_version = WLANBAP_PAL_VERSION; - btamp_ASSOC.AMP_Assoc_PAL_Version.pal_CompanyID = WLANBAP_QUALCOMM_COMPANY_ID; // Qualcomm Company ID - btamp_ASSOC.AMP_Assoc_PAL_Version.pal_subversion = WLANBAP_PAL_SUBVERSION; - - //Pack the AMP Assoc structure - vosStatus = btampPackAMP_ASSOC( - hHal, - &btamp_ASSOC, - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment, - 248, - &nConsumed); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: nConsumed value: %d", __func__, nConsumed); - - /* 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_AMP_ASSOC_CMD; - /*Validate the Physical handle*/ - if(pBapHCIReadLocalAMPAssoc->phy_link_handle != - btampContext->phy_link_handle) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: Wrong Physical Link handle in Read Local AMP Assoc cmd: current: %x, new: %x", __func__, - btampContext->phy_link_handle, - pBapHCIReadLocalAMPAssoc->phy_link_handle); - - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status - = WLANBAP_ERROR_NO_CNCT; - } else - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status - = WLANBAP_STATUS_SUCCESS; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle - = pBapHCIReadLocalAMPAssoc->phy_link_handle; - /* We will fit in one fragment, so remaining is exactly equal to encoded size*/ - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.remaining_length - = nConsumed; - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPReadLocalAMPAssoc */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLAN_BAPWriteRemoteAMPAssoc() - - DESCRIPTION - Implements the actual HCI Write Remote AMP Assoc 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. - pBapHCIWriteRemoteAMPAssoc: pointer to the "HCI Write Remote AMP Assoc" 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 pBapHCIWriteRemoteAMPAssoc is NULL - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLAN_BAPWriteRemoteAMPAssoc -( - ptBtampHandle btampHandle, - tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pBapHCIWriteRemoteAMPAssoc, - tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */ - /* Including Command Complete and Command Status*/ -) -{ - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus; - tBtampHCI_Event bapHCIEvent; - - /* I am using btampContext, instead of pBapPhysLinkMachine */ - //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine; - ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */ - v_U8_t status; /* return the BT-AMP status here */ - - /* Validate params */ - if (pBapHCIWriteRemoteAMPAssoc == NULL) { - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC; - bapEvent.params = pBapHCIWriteRemoteAMPAssoc; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %p", __func__, btampContext); - - /* Handle event */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - /* 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_WRITE_REMOTE_AMP_ASSOC_CMD; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.status - = status; - pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.phy_link_handle - = pBapHCIWriteRemoteAMPAssoc->phy_link_handle; - - if(WLANBAP_ERROR_NO_SUITABLE_CHANNEL == status) - { - /* Format the Physical Link Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = status; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle - = btampContext->phy_link_handle; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number - = 0; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - } - - /* ... */ - - return VOS_STATUS_SUCCESS; -} /* WLAN_BAPWriteRemoteAMPAssoc */ diff --git a/CORE/BAP/src/bapApiTimer.c b/CORE/BAP/src/bapApiTimer.c deleted file mode 100644 index bc234b1dbfdf..000000000000 --- a/CORE/BAP/src/bapApiTimer.c +++ /dev/null @@ -1,1034 +0,0 @@ -/* - * Copyright (c) 2012 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 T i m e r . C - - OVERVIEW: - - This software unit holds the implementation of the timer routines - required by the WLAN BAP module. - - The functions provide by this module are called by the rest of - the BT-AMP PAL module. - - DEPENDENCIES: - - Are listed for each API below. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /home/labuser/btamp-label9/CORE/BAP/src/bapApiTimer.c,v 1.5 2010/09/04 00:14:37 labuser Exp labuser $$DateTime$$Author: labuser $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-10-23 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -// I think this pulls in everything -#include "vos_types.h" -#include "bapApiTimer.h" - -//#define BAP_DEBUG - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -#define WLAN_BAP_TX_PKT_MONITOR_TIME 100 - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ -#if 1 -//*BT-AMP packet LLC OUI value*/ -static const v_U8_t WLANBAP_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; - -#endif - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Externalized Function Definitions -* -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Utility Function implementations - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_InitConnectionAcceptTimer - - DESCRIPTION - Initialize the Connection Accept Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_InitConnectionAcceptTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Initialize the timer */ - vosStatus = vos_timer_init( - &pBtampCtx->bapConnectionAcceptTimer, - VOS_TIMER_TYPE_SW, /* use this type */ - WLANBAP_ConnectionAcceptTimerHandler, - pBtampCtx); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_InitConnectionAcceptTimer */ - -/*========================================================================== - - FUNCTION WLANBAP_DeinitConnectionAcceptTimer - - DESCRIPTION - Destroy the Connection Accept Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_DeinitConnectionAcceptTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Initialize and then Start the timer */ - vosStatus = vos_timer_destroy ( - &pBtampCtx->bapConnectionAcceptTimer ); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_DeinitConnectionAcceptTimer */ - -/*========================================================================== - - FUNCTION WLANBAP_StartConnectionAcceptTimer - - DESCRIPTION - Start the Connection Accept Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - interval: time interval. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StartConnectionAcceptTimer -( - ptBtampContext pBtampCtx, - v_U32_t interval -) -{ - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Start the connection accept timer*/ - vos_timer_start( - &pBtampCtx->bapConnectionAcceptTimer, - interval); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_StartConnectionAcceptTimer */ - - -/*========================================================================== - - FUNCTION WLANBAP_StopConnectionAcceptTimer - - DESCRIPTION - Stop the Connection Accept Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StopConnectionAcceptTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Stop the timer */ - vosStatus = vos_timer_stop( - &pBtampCtx->bapConnectionAcceptTimer); - - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_StopConnectionAcceptTimer */ - - - -/*========================================================================== - - FUNCTION WLANBAP_ConnectionAcceptTimerHandler - - DESCRIPTION - Callback function registered with vos timer for the Connection - Accept timer - - DEPENDENCIES - - PARAMETERS - - IN - userData: pointer can be used to retrive the BT-AMP context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -v_VOID_t -WLANBAP_ConnectionAcceptTimerHandler -( - v_PVOID_t userData -) -{ - ptBtampContext pBtampCtx = (ptBtampContext)userData; - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_U8_t status; /* return the BT-AMP status here */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*----------------------------------------------------------------------- - Sanity check - -----------------------------------------------------------------------*/ - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Fatal error in %s", __func__ ); - VOS_ASSERT(0); - return; - } - - /*--------------------------------------------------------------------- - Feed this timeout to the BTAMP FSM - ---------------------------------------------------------------------*/ - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT; - bapEvent.params = NULL; - - /* Handle event */ - vosStatus = btampFsm(pBtampCtx, &bapEvent, &status); - - /* Now transition to fully disconnected and notify phy link disconnect*/ - bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; - bapEvent.params = NULL; - - /* Handle event */ - vosStatus = btampFsm(pBtampCtx, &bapEvent, &status); - - -}/*WLANBAP_ConnectionAcceptTimerHandler*/ - -/*========================================================================== - - FUNCTION WLANBAP_InitLinkSupervisionTimer - - DESCRIPTION - Initialize the Link Supervision Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_InitLinkSupervisionTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Initialize the timer */ - vosStatus = vos_timer_init( - &pBtampCtx->bapLinkSupervisionTimer, - VOS_TIMER_TYPE_SW, /* use this type */ - WLANBAP_LinkSupervisionTimerHandler, - pBtampCtx); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_InitLinkSupervisionTimer */ - -/*========================================================================== - - FUNCTION WLANBAP_DeinitLinkSupervisionTimer - - DESCRIPTION - Destroy the Link Supervision Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_DeinitLinkSupervisionTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Initialize and then Start the timer */ - vosStatus = vos_timer_destroy ( - &pBtampCtx->bapLinkSupervisionTimer ); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_DeinitLinkSupervisionTimer */ - -/*========================================================================== - - FUNCTION WLANBAP_StartLinkSupervisionTimer - - DESCRIPTION - Start the LinkSupervisionTimer Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - interval: time interval. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StartLinkSupervisionTimer -( - ptBtampContext pBtampCtx, - v_U32_t interval -) -{ - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - vos_timer_start( - &pBtampCtx->bapLinkSupervisionTimer, - interval); - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_StartLinkSupervisionTimer */ - -/*========================================================================== - - FUNCTION WLANBAP_StopLinkSupervisionTimer - - DESCRIPTION - Stop the LinkSupervision Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StopLinkSupervisionTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Stop the timer */ - vosStatus = vos_timer_stop( - &pBtampCtx->bapLinkSupervisionTimer); - - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_StopLinkSupervisionTimer */ - - -/*========================================================================== - - FUNCTION WLANBAP_LinkSupervisionTimerHandler - - DESCRIPTION - Callback function registered with vos timer for the LinkSupervision timer - - DEPENDENCIES - - PARAMETERS - - IN - userData: pointer can be used to retrive the BT-AMP context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -v_VOID_t -WLANBAP_LinkSupervisionTimerHandler -( - v_PVOID_t userData -) -{ - ptBtampContext pBtampCtx = (ptBtampContext)userData; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampHandle btampHandle = (ptBtampHandle)userData; - tWLAN_BAPEvent bapEvent; /* State machine event */ - v_U8_t phy_link_handle; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*----------------------------------------------------------------------- - Sanity check - -----------------------------------------------------------------------*/ - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Fatal error in %s", __func__ ); - VOS_ASSERT(0); - return; - } - - phy_link_handle = pBtampCtx->phy_link_handle; - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP:In LinkSupervision Timer handler %s", __func__ ); - - if(pBtampCtx->dataPktPending == VOS_TRUE) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Data seen. Do nothing", __func__ ); - - pBtampCtx->dataPktPending = VOS_FALSE; - pBtampCtx->lsReqPktPending = VOS_FALSE; - pBtampCtx->retries = 0; - vosStatus = WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, - pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); - - //Data is seen. or our previous packet is not yet fetched by TL.Don't do any thing.Just return; - return; - } - else if((pBtampCtx->lsReqPktPending == VOS_TRUE ) - && (pBtampCtx->retries == WLANBAP_LINK_SUPERVISION_RETRIES)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "#########WLAN BAP: LinkSupervision Timed OUT######## %s", __func__ ); - - /*--------------------------------------------------------------------- - Feed this timeout to the BTAMP FSM - ---------------------------------------------------------------------*/ - /* Fill in the event structure */ - /* JEZ110307: Which should this be? */ - //bapEvent.event =eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT; - bapEvent.event =eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION; - bapEvent.params = NULL; - - /* Handle event */ - vosStatus = btampFsm(pBtampCtx, &bapEvent, (v_U8_t *)&vosStatus); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Resend the LS packet", __func__ ); - - /* If we have transmit pkt pending and the time out occurred,resend the ls packet */ - WLANBAP_StopLinkSupervisionTimer(pBtampCtx); - pBtampCtx->pPacket = pBtampCtx->lsReqPacket; - vosStatus = WLANBAP_TxLinkSupervision( btampHandle, - phy_link_handle, - pBtampCtx->pPacket , - WLANTL_BT_AMP_TYPE_LS_REQ); - } - -}/*WLANBAP_LinkSupervisionTimerHandler*/ - -/*========================================================================== - - FUNCTION WLANBAP_StartTxPacketMonitorTimer - - DESCRIPTION - Start the Tx Packet Monitor Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - interval: time interval. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StartTxPacketMonitorTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_U32_t uInterval = WLAN_BAP_TX_PKT_MONITOR_TIME; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Start the timer */ - vosStatus = vos_timer_start( &pBtampCtx->bapTxPktMonitorTimer, - uInterval); - - return vosStatus; -}/* WLANBAP_StartTxPacketMonitorTimer */ - - -/*========================================================================== - - FUNCTION WLANBAP_StopTxPacketMonitorTimer - - DESCRIPTION - Stop the Tx Packet Monitor Timer. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StopTxPacketMonitorTimer -( - ptBtampContext pBtampCtx -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /*Stop the timer */ - vosStatus = vos_timer_stop( &pBtampCtx->bapTxPktMonitorTimer); - - - return vosStatus; -}/* WLANBAP_StopTxPacketMonitorTimer */ - - -/*========================================================================== - - FUNCTION WLANBAP_SendCompletedPktsEvent - - DESCRIPTION - Utility function for sending the NUM_OF_COMPLETED_PKTS_EVENT to HCI - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -v_VOID_t -WLANBAP_SendCompletedPktsEvent -( - ptBtampContext pBtampCtx -) -{ - v_U8_t i, j; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - v_U32_t uTxCompleted = 0; - tpBtampLogLinkCtx pLogLinkContext = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - /* Format the Number of completed packets event */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT; - bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = 0; - - /*--------------------------------------------------------------------- - Check if LL still exists, if TRUE generate num_pkt_event and - restart the timer - ---------------------------------------------------------------------*/ - for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) - { - pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; - if ( pLogLinkContext->present ) - { - uTxCompleted = pLogLinkContext->uTxPktCompleted; - bapHCIEvent.u.btampNumOfCompletedPktsEvent.conn_handles[j] = - pLogLinkContext->log_link_handle; - bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_completed_pkts[j] = - uTxCompleted; - - j++; - - vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted, - (v_U32_t) uTxCompleted); - - if (uTxCompleted) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __func__, - pLogLinkContext->log_link_handle, uTxCompleted); - } - } - } - - /* Indicate only if at least one logical link is present and number of - completed packets is non zero */ - if (j && uTxCompleted) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Indicating Num Completed packets Event"); - - /*issue num_pkt_event for uTxCompleted*/ - bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = j; - (*pBtampCtx->pBapHCIEventCB) - ( - pBtampCtx->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - } - -} - -/*========================================================================== - - FUNCTION WLANBAP_SendCompletedDataBlksEvent - - DESCRIPTION - Utility function for sending the NUM_OF_COMPLETED_DATA_BLOCKS_EVENT to HCI - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -v_VOID_t -WLANBAP_SendCompletedDataBlksEvent -( - ptBtampContext pBtampCtx -) -{ - v_U8_t i, j; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - v_U32_t uTxCompleted = 0; - tpBtampLogLinkCtx pLogLinkContext = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - /* Format the Number of completed data blocks event */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT; - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = 0; - - /*--------------------------------------------------------------------- - Check if LL still exists, if TRUE generate num_data_blocks_event and - restart the timer - ---------------------------------------------------------------------*/ - for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) - { - pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; - if ( pLogLinkContext->present ) - { - uTxCompleted = pLogLinkContext->uTxPktCompleted; - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.conn_handles[j] = - pLogLinkContext->log_link_handle; - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_pkts[j] = - uTxCompleted; - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_blocks[j] = - uTxCompleted; - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.total_num_data_blocks = 16; - - j++; - - vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted, - (v_U32_t) uTxCompleted); - - if (uTxCompleted) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __func__, - pLogLinkContext->log_link_handle, uTxCompleted); - } - } - } - - /* Indicate only if at least one logical link is present and number of - completed data blocks is non zero */ - if (j && uTxCompleted) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Indicating Num Completed Data Blocks Event"); - - /*issue num_data_blocks_event for uTxCompleted*/ - bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = j; - (*pBtampCtx->pBapHCIEventCB) - ( - pBtampCtx->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - } - -} - -/*========================================================================== - - FUNCTION WLANBAP_TxPacketMonitorHandler - - DESCRIPTION - Callback function registered with vos timer for the Tx Packet Monitor - Timer. - - DEPENDENCIES - - PARAMETERS - - IN - userData: pointer can be used to retrive the BT-AMP context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -v_VOID_t -WLANBAP_TxPacketMonitorHandler -( - v_PVOID_t userData -) -{ - ptBtampContext pBtampCtx = (ptBtampContext)userData; - BTAMPFSM_INSTANCEDATA_T *instanceVar = &pBtampCtx->bapPhysLinkMachine; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*----------------------------------------------------------------------- - Sanity check - -----------------------------------------------------------------------*/ - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Fatal error in %s", __func__ ); - VOS_ASSERT(0); - return; - } - -#if 0 //BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __func__, __LINE__ ); -#endif //BAP_DEBUG - - if(WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED == pBtampCtx->ucDataTrafficMode) - { - WLANBAP_SendCompletedDataBlksEvent(pBtampCtx); - } - else - { - WLANBAP_SendCompletedPktsEvent(pBtampCtx); - } - - /* Restart the Packet monitoring timer if still Physical link - * is present. - * It is possible that when the physical link is tear down, - * timer start request is in Q and could start again. - */ - if (CONNECTED == instanceVar->stateVar) - { - WLANBAP_StartTxPacketMonitorTimer(pBtampCtx); - } -}/*WLANBAP_TxPacketMonitorHandler*/ diff --git a/CORE/BAP/src/bapApiTimer.h b/CORE/BAP/src/bapApiTimer.h deleted file mode 100644 index 5c4a3662a368..000000000000 --- a/CORE/BAP/src/bapApiTimer.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef WLAN_QCT_WLANBAP_API_TIMER_H -#define WLAN_QCT_WLANBAP_API_TIMER_H - -/*=========================================================================== - - W L A N B T - A M P P A L L A Y E R - T I M E R S E R V I C E S A P I - - -DESCRIPTION - This file contains the timer APIs used by the wlan BT-AMP PAL layer - module. -===========================================================================*/ - - -/*=========================================================================== - - 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/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiTimer.h,v 1.1 2008/11/21 20:30:20 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $ - - -when who what, where, why --------- --- ---------------------------------------------------------- -10/23/08 jez Created module. - -===========================================================================*/ - - - -/*=========================================================================== - - INCLUDE FILES FOR MODULE - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -// Pick up all the BT-AMP internal definitions -// And underlying supporting types. (Including VOSS, CSR, and...) -#include "bapInternal.h" - -/* Pick up the SIRIUS and HAL types */ -// Already taken care of, above -//#include "sirApi.h" -//#include "halTypes.h" - -/* Pick up the CCM API def'n */ -#include "ccmApi.h" - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - #ifdef __cplusplus - extern "C" { - #endif - - -/*---------------------------------------------------------------------------- - * Defines - * -------------------------------------------------------------------------*/ -// Temporary -//#define BAP_DEBUG - - -/*---------------------------------------------------------------------------- - * Typedefs - * -------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * Function prototypes - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Utility Function prototypes - * -------------------------------------------------------------------------*/ - -#if 0 -/*========================================================================== - - FUNCTION WLANBAP_StartConnectionAcceptTimer - - DESCRIPTION - Clear out all fields in the BAP context. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - interval: time interval. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_StartConnectionAcceptTimer -( - ptBtampContext pBtampCtx, - v_U32_t interval -); -#endif // 0 - -/* Connection Accept timer*/ -VOS_STATUS WLANBAP_InitConnectionAcceptTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_DeinitConnectionAcceptTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_StartConnectionAcceptTimer - (ptBtampContext pBtampCtx, v_U32_t interval); - -VOS_STATUS WLANBAP_StopConnectionAcceptTimer - ( ptBtampContext pBtampCtx); - -v_VOID_t WLANBAP_ConnectionAcceptTimerHandler - ( v_PVOID_t userData ); - -/* Link Supervision timer*/ -VOS_STATUS WLANBAP_InitLinkSupervisionTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_DeinitLinkSupervisionTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_StartLinkSupervisionTimer - (ptBtampContext pBtampCtx, v_U32_t interval); - -VOS_STATUS WLANBAP_StopLinkSupervisionTimer - ( ptBtampContext pBtampCtx); - -v_VOID_t WLANBAP_LinkSupervisionTimerHandler - ( v_PVOID_t userData ); - -/* Logical Link Accept timer*/ -VOS_STATUS WLANBAP_InitLogicalLinkAcceptTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_DeinitLogicalLinkAcceptTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_StartLogicalLinkAcceptTimer - (ptBtampContext pBtampCtx, v_U32_t interval); - -VOS_STATUS WLANBAP_StopLogicalLinkAcceptTimer - ( ptBtampContext pBtampCtx); - -v_VOID_t WLANBAP_LogicalLinkAcceptTimerHandler - ( v_PVOID_t userData ); - -/* Best Effort Flush timer*/ -VOS_STATUS WLANBAP_InitBEFlushTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_DeinitBEFlushTimer - ( ptBtampContext pBtampCtx); - -VOS_STATUS WLANBAP_StartBEFlushTimer - (ptBtampContext pBtampCtx, v_U32_t interval); - -VOS_STATUS WLANBAP_StopBEFlushTimer - ( ptBtampContext pBtampCtx); - -v_VOID_t WLANBAP_BEFlushTimerHandler - ( v_PVOID_t userData ); - -/* Tx Packet monitor timer handler */ -v_VOID_t -WLANBAP_TxPacketMonitorHandler -( - v_PVOID_t userData -); - -/* Tx Packet monitor start timer */ -VOS_STATUS -WLANBAP_StartTxPacketMonitorTimer -( - ptBtampContext pBtampCtx -); - -/* Tx Packet monitor stop timer */ -VOS_STATUS -WLANBAP_StopTxPacketMonitorTimer -( - ptBtampContext pBtampCtx -); - -#ifdef __cplusplus - } -#endif - - -#endif /* #ifndef WLAN_QCT_WLANBAP_API_TIMER_H */ diff --git a/CORE/BAP/src/bapInternal.h b/CORE/BAP/src/bapInternal.h deleted file mode 100644 index 0e4f5274354c..000000000000 --- a/CORE/BAP/src/bapInternal.h +++ /dev/null @@ -1,1304 +0,0 @@ -/* - * Copyright (c) 2012, 2014 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. - */ - -#ifndef WLAN_QCT_WLANBAP_INTERNAL_H -#define WLAN_QCT_WLANBAP_INTERNAL_H - -/*=========================================================================== - - W L A N B T - A M P P A L L A Y E R - I N T E R N A L A P I - - -DESCRIPTION - This file contains the internal API exposed by the wlan BT-AMP PAL layer - module. -===========================================================================*/ - - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapInternal.h,v 1.3 2010/07/12 20:40:18 labuser Exp labuser $ $DateTime: $ $Author: labuser $ - - -when who what, where, why --------- --- ---------------------------------------------------------- -09/15/08 jez Created module. - -===========================================================================*/ - - - -/*=========================================================================== - - INCLUDE FILES FOR MODULE - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include "vos_api.h" -#include "vos_packet.h" - -// Pick up the CSR API definitions -#include "csrApi.h" - -/* BT-AMP PAL API structure types - FramesC generated */ -#include "btampHCI.h" -#include "bapApi.h" - -// Pick up the BTAMP FSM definitions -#include "fsmDefs.h" -//#include "btampFsm.h" -#include "btampFsm_ext.h" -#include "bapRsn8021xFsm.h" -#include "bapRsnErrors.h" - -#include "csrApi.h" -#include "sirApi.h" -#include "wniApi.h" -#include "palApi.h" -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - #ifdef __cplusplus - extern "C" { - #endif - - -/*---------------------------------------------------------------------------- - * Defines - * -------------------------------------------------------------------------*/ -// Temporary so that I can compile -//#define VOS_MODULE_ID_BAP 9 -// Temporary -//#define BAP_DEBUG - -// Used to enable or disable security on the BT-AMP link -#define WLANBAP_SECURITY_ENABLED_STATE VOS_TRUE - -// How do I get BAP context from voss context? -#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) -// How do I get halHandle from voss context? -#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_SME, ctx) - -// Default timeout values (in BR/EDR baseband slots) -// Physical Link Connection Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec) -/* chose to double it to 3FFF as we saw conn timeout in lab*/ -//#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT 0xFFFF -// Set default to 0x1F40. Which is ~5 secs. -#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT 0x1F40 - -/* Link Supervision Timer interval (0x7D00 * 0.625 = 20 sec) */ -#ifdef FEATURE_WLAN_BTAMP_UT -#define WLANBAP_LINK_SUPERVISION_TIMEOUT 0x7D00 -#else -#define WLANBAP_LINK_SUPERVISION_TIMEOUT 0x3E80 // 10 seconds -#endif -#define WLANBAP_LINK_SUPERVISION_RETRIES 2 - -/* Logical Link Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec)*/ -#define WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT 0x1F40 - -/* BR/EDR baseband 1 slot time period */ -#define WLANBAP_BREDR_BASEBAND_SLOT_TIME 1 // 0.625 - -/* Maximum allowed range for connection accept timeout interval */ -#define WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE 0xB540 - -/* Minimum allowed range for connection accept timeout interval */ -#define WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE 0x01 - -/* Best Effort Flush timer interval*/ -#define WLANBAP_BE_FLUSH_TIMEOUT 10 - -/* Length of the LLC header*/ -#define WLANBAP_LLC_HEADER_LEN 8 - -/*Size of the protocol type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_PROTO_TYPE_SIZE 2 - -/*Size of the OUI type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_OUI_SIZE 3 - -/*Offset of the OUI field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_OUI_OFFSET 3 - -/*Offset of the protocol type field inside the LLC/SNAP header*/ -#define WLANBAP_LLC_PROTO_TYPE_OFFSET (WLANBAP_LLC_OUI_OFFSET + WLANBAP_LLC_OUI_SIZE) - -#define WLANBAP_MAX_NUM_TRIPLETS 5 - -#define WLANBAP_MAX_SIZE_TRIPLETS 3 -/*---------------------------------------------------------------------------- - * Typedefs - * -------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------- - * Type Declarations - For internal BAP context information - * -------------------------------------------------------------------------*/ -typedef struct sBtampHCI_Buffer_Size { -// v_U8_t present; - /* D9r14 says Max80211PALPDUSize 1492 */ - v_U16_t HC_ACL_Data_Packet_Length; - v_U8_t HC_SCO_Packet_Length; - v_U16_t HC_Total_Num_ACL_Packets; - v_U16_t HC_Total_Num_SCO_Packets; -} tBtampHCI_Buffer_Size; - -typedef struct sBtampHCI_Data_Block_Size { -// v_U8_t present; - v_U8_t status; - /* D9r14 says Max80211PALPDUSize 1492 */ - v_U16_t HC_Max_ACL_Data_Packet_Length; - v_U16_t HC_Data_Block_Length; - v_U16_t HC_Total_Num_Data_Blocks; -} tBtampHCI_Data_Block_Size; - -typedef struct sBtampHCI_Version_Info { -// v_U8_t present; - v_U8_t HC_HCI_Version; - v_U16_t HC_HCI_Revision; - v_U8_t HC_PAL_Version; /* for 802.11 AMP: 0x01 */ - v_U16_t HC_PAL_Sub_Version; /* for 802.11 AMP: Vendor specific */ - v_U16_t HC_Manufac_Name; /* See BT assigned numbers */ -} tBtampHCI_Version_Info; - -typedef struct sBtampHCI_Supported_Cmds { -// v_U8_t present; - v_U8_t HC_Support_Cmds[64]; /* a bitmask of cmds */ -} tBtampHCI_Supported_Cmds; - -typedef struct sBtampHCI_AMP_Info { -// v_U8_t present; - v_U8_t HC_AMP_Status; - v_U32_t HC_Total_BW; /* combined uplink and downlink */ - v_U32_t HC_Max_Guaranteed_BW; /* upper bound */ - v_U32_t HC_Min_Latency; /* AMP HCI latency + DIFS + CWMin */ - v_U32_t HC_Max_PDU_Size; /* Equal to Max80211PALPDUSize */ - v_U8_t HC_Controller_Type; /* 0x01 for 802.11 BT-AMP PAL */ - v_U16_t HC_PAL_Capabilities; /* Bit 0: 0 = No Guarantee; 1 = Guarantee */ - v_U16_t HC_AMP_Assoc_Length; /* Length of AMP Assoc Info */ - /* Equal to Max80211AMPASSOCLen (672) */ - v_U16_t HC_Max_Flush_Timeout; /* Maximum time Tx attempted. 0 is inf retry */ - v_U16_t HC_BE_Flush_Timeout; /* Maximum time BE Tx attempted. 0 is inf retry */ -} tBtampHCI_AMP_Info; - -typedef struct sBtampHCI_AMP_Assoc { -// v_U8_t present; - v_U8_t HC_cnct_country[3]; /* Connected channel */ - v_U8_t HC_cnct_num_triplets; - v_U8_t HC_cnct_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS]; - v_U8_t HC_mac_addr[6]; - v_U32_t HC_pal_capabilities; - v_U8_t HC_pref_country[3]; /* Preferred channels */ - v_U8_t HC_pref_num_triplets; - v_U8_t HC_pref_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS]; - v_U8_t HC_pal_version; - v_U16_t HC_pal_CompanyID; - v_U16_t HC_pal_subversion; -} tBtampHCI_AMP_Assoc, *tpBtampHCI_AMP_Assoc ; - -typedef struct sBtampTLVHCI_Location_Data_Info { - v_U8_t loc_domain_aware; - v_U8_t loc_domain[3]; - v_U8_t loc_options; -} tBtampTLVHCI_Location_Data_Info; - -/*---------------------------------------------------------------------------- - * Type Declarations - For BAP logical link context information - * -------------------------------------------------------------------------*/ -typedef struct sBtampLogLinkCtx { - v_U8_t present; /* In use? */ - - v_U8_t log_link_index; /* small integer (<16) value assigned by us */ - v_U16_t log_link_handle; /* 8 bits of phy_link_handle and our index */ - - /* The flow spec (From section 5.6 of Generic AMP spec) */ - tBtampTLVFlow_Spec btampFlowSpec; - - /* The Access category */ - WLANTL_ACEnumType btampAC; - - /* The TID */ - v_U8_t ucTID; - - /* UP of the packet being sent */ - v_U8_t ucUP; - - /*Number of packets completed since the last time num pkt complete event - was issued*/ - v_U32_t uTxPktCompleted; - -} tBtampLogLinkCtx, *tpBtampLogLinkCtx ; - -/*---------------------------------------------------------------------------- - * Type Declarations - QOS related - * -------------------------------------------------------------------------*/ -/* BT-AMP QOS config */ -typedef struct sBtampQosCfg { - v_U8_t bWmmIsEnabled; -} tBtampQosCfg; - -/*---------------------------------------------------------------------------- - * Opaque BAP context Type Declaration - * -------------------------------------------------------------------------*/ -// We were only using this syntax, when this was truly opaque. -// (I.E., it was defined in a different file.) -//typedef struct sBtampContext tBtampContext, *ptBtampContext; - - -// Validity check the logical link value -#define BTAMP_VALID_LOG_LINK(a) ( a > 0 && a < WLANBAP_MAX_LOG_LINKS ? 1 : 0) - -/* Instance data definition of state machine */ -// Moved here from the BTAMP FSM definitions in btampFsm.h -typedef struct{ - BTAMPFSM_ENTRY_FLAG_T disconnectedEntry; - BTAMPFSM_STATEVAR_T stateVar; - BTAMPFSM_INST_ID_T inst_id; -} BTAMPFSM_INSTANCEDATA_T; - -/* BT-AMP device role */ -typedef enum{ - BT_RESPONDER, - BT_INITIATOR -} tWLAN_BAPRole; - -/* BT-AMP device role */ -typedef enum{ - WLAN_BAPLogLinkClosed, - WLAN_BAPLogLinkOpen, - WLAN_BAPLogLinkInProgress, -} tWLAN_BAPLogLinkState; - -typedef struct{ - v_U8_t phyLinkHandle; - v_U8_t txFlowSpec[18]; - v_U8_t rxFlowSpec[18]; -} tBtampLogLinkReqInfo; - -/*---------------------------------------------------------------------------- - * BAP context Data Type Declaration - * -------------------------------------------------------------------------*/ -#undef BTAMP_MULTIPLE_PHY_LINKS -typedef struct sBtampContext { -#ifndef BTAMP_MULTIPLE_PHY_LINKS - - // Include the enclosing VOSS context here - v_PVOID_t pvosGCtx; - - // include the phy link state machine structure here - tWLAN_BAPbapPhysLinkMachine bapPhysLinkMachine; - - // BAP device role - tWLAN_BAPRole BAPDeviceRole; - // Include the SME(CSR) sessionId here - v_U8_t sessionId; - - // Actual storage for AP and self (STA) SSID - //tSirMacSSid SSID[2]; - tCsrSSIDInfo SSIDList[2]; - // Actual storage for AP bssid - tCsrBssid bssid; - // Include the SME(CSR) context here - tCsrRoamProfile csrRoamProfile; - tANI_U32 csrRoamId; - - // QOS config - tBtampQosCfg bapQosCfg; - - /*Flag for signaling if security is enabled*/ - v_U8_t ucSecEnabled; - - // associated boolean flag - v_U8_t mAssociated; - // associated status - v_U8_t mAssociatedStatus; - tCsrBssid assocBssid; - tBssSystemRole systemRole; - - // own SSID - v_U8_t ownSsid[32]; - v_U32_t ownSsidLen; - - // incoming Assoc SSID - v_U8_t assocSsid[32]; - v_U32_t assocSsidLen; - - // gNeedPhysLinkCompEvent - v_U8_t gNeedPhysLinkCompEvent; - // gPhysLinkStatus - v_U8_t gPhysLinkStatus; - // gDiscRequested - v_U8_t gDiscRequested; - // gDiscReason - v_U8_t gDiscReason; - - // Include the BSL per-application context here - v_PVOID_t pAppHdl; // Per-app BSL context - // Include the BSL per-association contexts here. - // (Right now, there is only one) - v_PVOID_t pHddHdl; - /* 8 bits of phy_link_handle identifies this association */ - v_U8_t phy_link_handle; - // Short Range Mode setting for this physical link - v_U8_t phy_link_srm; - - // Include the key material for this physical link - v_U8_t key_type; - v_U8_t key_length; - v_U8_t key_material[32]; - - /* Physical link quality status - After the physical link is up, SME indicates the link quality through - callback. This value is returned to upper layer on request. - */ - v_U8_t link_quality; - - /* Connection Accept timer*/ - vos_timer_t bapConnectionAcceptTimer; - /* Link Supervision timer*/ - vos_timer_t bapLinkSupervisionTimer; - /* Logical Link Accept timer*/ - vos_timer_t bapLogicalLinkAcceptTimer; - /* Best Effort Flush timer*/ - vos_timer_t bapBEFlushTimer; - - /* TX Packet Monitoring timer*/ - vos_timer_t bapTxPktMonitorTimer; - - /* Connection Accept Timer interval (in BR/EDR baseband slots) - * Interval length = N * 0.625 msec (1 BR/EDR baseband slot) - */ - v_U16_t bapConnectionAcceptTimerInterval; - - /* Link Supervision Timer interval (in BR/EDR baseband slots) */ - v_U16_t bapLinkSupervisionTimerInterval; - - /* Logical Link Accept Timer interval (in BR/EDR baseband slots) */ - v_U16_t bapLogicalLinkAcceptTimerInterval; - - /* Best Effort Flush timer interval*/ - v_U32_t bapBEFlushTimerInterval; - - // Include the current channel here - v_U32_t channel; - - // Include the associations STA Id - v_U8_t ucSTAId; - - // Include the associations MAC addresses - v_U8_t self_mac_addr[6]; - v_U8_t peer_mac_addr[6]; - - // The array of logical links - /* the last small integer (<16) value assigned by us */ - v_U8_t current_log_link_index; /* assigned mod 16 */ - v_U8_t total_log_link_index; /* should never be >16 */ - /* The actual array */ - tBtampLogLinkCtx btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS]; - - // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt - WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB; - WLANBAP_STARxCBType pfnBtamp_STARxCB; - WLANBAP_TxCompCBType pfnBtampTxCompCB; - - /* Implements the callback for ALL asynchronous events. */ - tpWLAN_BAPEventCB pBapHCIEventCB; - - // Save Page2 of the event mask. - v_U8_t event_mask_page_2[8]; - - // Include the Local Assoc structure. - // (This gets filled during initialization. It is used, for example, to - // obtain the local MAC address for forming the 802.3 frame.) - // <<Why don't I just pull out the individ fields I need? Like MAC addr.>> - tBtampHCI_AMP_Assoc btamp_AMP_Assoc; - - // Remote AMP Assoc - tBtampHCI_AMP_Assoc btamp_Remote_AMP_Assoc; - - tBtampTLVHCI_Location_Data_Info btamp_Location_Data_Info; - - union - { - tAuthRsnFsm authFsm; - tSuppRsnFsm suppFsm; - }uFsm; - //LinkSupervision packet - tANI_BOOLEAN lsReqPktPending; - tANI_BOOLEAN dataPktPending; - tANI_U8 retries; - vos_pkt_t *pPacket; - vos_pkt_t *lsReqPacket; - vos_pkt_t *lsRepPacket; - v_U16_t lsPktln; - v_U16_t lsPending; - WLANTL_MetaInfoType metaInfo; - tANI_BOOLEAN isBapSessionOpen; - - tWLAN_BAPLogLinkState btamp_logical_link_state; - - tBtampLogLinkReqInfo btamp_logical_link_req_info; - - tANI_BOOLEAN btamp_async_logical_link_create; - - tANI_BOOLEAN btamp_logical_link_cancel_pending; - - tANI_BOOLEAN btamp_session_on; - -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - - // Include the enclosing VOSS context here - v_PVOID_t pvosGCtx; - - // include the state machine structure here - - // Include the BSL per-application context here - v_PVOID_t pAppHdl; // Per-app BSL context - // Include the BSL per-association contexts here. - // (Right now, there is only one) - v_PVOID_t pHddHdl; - /* 8 bits of phy_link_handle identifies this association */ - v_U8_t phy_link_handle; - // Short Range Mode setting for this physical link - v_U8_t phy_link_srm; - - // Include the associations STA Id - v_U8_t ucSTAId; - - // Include the associations MAC addresses - v_U8_t self_mac_addr[6]; - v_U8_t peer_mac_addr[6]; - - // The array of logical links - /* the last small integer (<16) value assigned by us */ - v_U8_t current_log_link_index; /* assigned mod 16 */ - v_U8_t total_log_link_index; /* should never be >16 */ - /* The actual array */ - tBtampLogLinkCtx btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS]; - - // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt - WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB; - WLANBAP_STARxCBType pfnBtamp_STARxCB; - WLANBAP_TxCompCBType pfnBtampTxCompCB; - - /* Implements the callback for ALL asynchronous events. */ - tpWLAN_BAPEventCB pBapHCIEventCB; - - // Include the Local Assoc structure. - // (This gets filled during initialization. It is used, for example, to - // obtain the local MAC address for forming the 802.3 frame.) - // <<Why don't I just pull out the individ fields I need? Like MAC addr.>> - tBtampHCI_AMP_Assoc btamp_AMP_Assoc; - //LinkSupervision packet - tANI_BOOLEAN lsReqPktPending; - tANI_U8 retries; - vos_pkt_t *pPacket; - vos_pkt_t *lsReqPacket; - vos_pkt_t *lsRepPacket; - v_U16_t lsPktln; - WLANTL_MetaInfoType* metaInfo; - tANI_BOOLEAN isBapSessionOpen; - //End of LinkSupervision packet -#endif //BTAMP_MULTIPLE_PHY_LINKS - WLANBAP_ConfigType config; - /*multiple data structures getting accessed/written from both north & south - bound entities. To avoid multiple access, need a lock*/ - vos_lock_t bapLock; - // Either Block mode or Pkt mode - v_U8_t ucDataTrafficMode; -}*ptBtampContext; -//tBtampContext, *ptBtampContext; - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -typedef struct sBtampLsPktData { - v_U32_t BufLen; - v_U8_t pBuf[1]; // ptr to Data Buffer -}tBtampLsPktData, *ptBtampLsPktData; - -typedef struct sBtampLsPkt { - v_U8_t SrcMac[6]; - v_U8_t DstMac[6]; - tBtampLsPktData Data; -} tBtampLsPkt, *ptBtampLsPkt; - -/*---------------------------------------------------------------------------- - * BAP per-session Context Data Type Declaration - * -------------------------------------------------------------------------*/ -// For now, it is just the same thing as the per application context. -typedef struct sBtampContext tBtampSessCtx; - -/*---------------------------------------------------------------------------- - * BAP state machine event definition - * -------------------------------------------------------------------------*/ -/* The event structure */ -typedef struct sWLAN_BAPEvent { - v_U32_t event; /* State machine input event message */ - v_PVOID_t params; /* A VOID pointer type for all possible inputs */ - v_U32_t u1; /* introduced to handle csrRoamCompleteCallback roamStatus */ - v_U32_t u2; /* introduced to handle csrRoamCompleteCallback roamResult */ -} tWLAN_BAPEvent, *ptWLAN_BAPEvent; - -// Pick up the BTAMP FSM definitions -#include "btampFsm.h" - - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ -// The main per-Physical Link (per WLAN association) context. -//extern tBtampContext btampCtx; -extern ptBtampContext gpBtampCtx; - -// Include the Local AMP Info structure. -extern tBtampHCI_AMP_Info btampHCI_AMP_Info; -// Include the Local Data Block Size info structure. -extern tBtampHCI_Data_Block_Size btampHCI_Data_Block_Size; -// Include the Local Version info structure. -extern tBtampHCI_Version_Info btampHCI_Version_Info; -// Include the Local Supported Cmds info structure. -extern tBtampHCI_Supported_Cmds btampHCI_Supported_Cmds; - - -/*---------------------------------------------------------------------------- - * Function prototypes - * -------------------------------------------------------------------------*/ - -/* I don't think any of this is needed */ - -/* TL data path callbacks passed into WLANTL_RegisterSTAClient */ - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_STAFetchPktCB - - DESCRIPTION - The fetch packet callback registered with TL. - - It is called by the TL when the scheduling algorithms allows for - transmission of another packet to the module. - It will be called in the context of the BAL fetch transmit packet - function, initiated by the bus lower layer. - - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle - to TL's or HDD's control block can be extracted - from its context - - IN/OUT - pucSTAId: the Id of the station for which TL is requesting a - packet, in case HDD does not maintain per station - queues it can give the next packet in its queue - and put in the right value for the - pucAC: access category requested by TL, if HDD does not have - packets on this AC it can choose to service another AC - queue in the order of priority - - OUT - vosDataBuff: pointer to the VOSS data buffer that was transmitted - tlMetaInfo: meta info related to the data frame - - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_STAFetchPktCB -( - v_PVOID_t pvosGCtx, - v_U8_t* pucSTAId, - v_U8_t ucAC, - vos_pkt_t** vosDataBuff, - WLANTL_MetaInfoType* tlMetaInfo -); - - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_STARxCB - - DESCRIPTION - The receive callback registered with TL. - - TL will call this to notify the client when a packet was received - for a registered STA. - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to - TL's or HDD's control block can be extracted from - its context - rxBufChain : pointer to adf_nbuf rx chain - ucSTAId: station id - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_STARxCB(v_PVOID_t pvosGCtx, adf_nbuf_t rxBufChain, v_U8_t ucSTAId); - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_TxCompCB - - DESCRIPTION - The tx complete callback registered with TL. - - TL will call this to notify the client when a transmission for a - packet has ended. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to - TL/HAL/PE/BAP/HDD control block can be extracted from - its context - vosDataBuff: pointer to the VOSS data buffer that was transmitted - wTxSTAtus: status of the transmission - - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_TxCompCB -( - v_PVOID_t pvosGCtx, - vos_pkt_t* vosDataBuff, - VOS_STATUS wTxSTAtus -); - -/* Callbacks Registered with TL by WLANTL_RegisterBAPClient */ - -/* RSN Callback */ - -/*---------------------------------------------------------------------------- - - DESCRIPTION - The receive callback registered with TL for BAP. - - The registered reception callback is being triggered by TL whenever a - frame was received and it was filtered as a non-data BT AMP packet. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - vosDataBuff: pointer to the vOSS buffer containing the received packet; - no chaining will be done on this path - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -WLANTL_BAPRxCBType WLANBAP_TLRsnRxCallback -( - v_PVOID_t pvosGCtx, - vos_pkt_t* vosDataBuff -); - -/* Flush complete Callback */ - -/*---------------------------------------------------------------------------- - - DESCRIPTION - Callback registered with TL for BAP, this is required inorder for - TL to inform BAP, that the flush operation requested has been completed. - - The registered reception callback is being triggered by TL whenever a - frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - ucStaId: station identifier for the requested value - ucTid: identifier of the tspec - status: status of the Flush operation - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_TLFlushCompCallback -( - v_PVOID_t pvosGCtx, - v_U8_t ucStaId, - v_U8_t ucTID, - v_U8_t status -); - -/*---------------------------------------------------------------------------- - * CSR Roam (Connection Status) callback - * -------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_RoamCallback() - - DESCRIPTION - Callback for Roam (connection status) Events - - DEPENDENCIES - NA. - - PARAMETERS - - IN - pContext: is the pContext passed in with the roam request - pParam: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and - eRoamCmdResult: for detail valid members. It may be NULL - roamId: is to identify the callback related roam request. 0 means unsolicited - roamStatus: is a flag indicating the status of the callback - roamResult: is the result - - RETURN VALUE - The result code associated with performing the operation - - eHAL_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -eHalStatus -WLANBAP_RoamCallback -( - void *pContext, - tCsrRoamInfo *pCsrRoamInfo, - tANI_U32 roamId, - eRoamCmdStatus roamStatus, - eCsrRoamResult roamResult -); - -/*---------------------------------------------------------------------------- - * Utility Function prototypes - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_CleanCB - - DESCRIPTION - Clear out all fields in the BAP context. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - freeFlag: flag indicating whether to free any allocations. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CleanCB -( - ptBtampContext pBtampCtx, - v_U32_t freeFlag // 0 /*do not empty*/); -); - -/*========================================================================== - - FUNCTION WLANBAP_GetCtxFromStaId - - DESCRIPTION - Called inside the BT-AMP PAL (BAP) layer whenever we need either the - BSL context or the BTAMP context from the StaId. - - - DEPENDENCIES - - PARAMETERS - - IN - ucSTAId: The StaId (used by TL, PE, and HAL) - - OUT - hBtampHandle: Handle (pointer to a pointer) to return the - btampHandle value in. - hHddHdl: Handle to return the BSL context pointer in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetCtxFromStaId -( - v_U8_t ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - ptBtampHandle *hBtampHandle, /* Handle to return per app btampHandle value in */ - ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */ - v_PVOID_t *hHddHdl /* Handle to return BSL context in */ -); - -/*========================================================================== - - FUNCTION WLANBAP_GetStaIdFromLinkCtx - - DESCRIPTION - Called inside the BT-AMP PAL (BAP) layer whenever we need the - StaId (or hHddHdl) from the BTAMP context and phy_link_handle. - - - DEPENDENCIES - - PARAMETERS - - IN - hBtampHandle: Handle (pointer to a pointer) to return the - btampHandle value in. - phy_link_handle: physical link handle value. Unique per assoc. - - OUT - pucSTAId: The StaId (used by TL, PE, and HAL) - hHddHdl: Handle to return the BSL context pointer in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetStaIdFromLinkCtx -( - ptBtampHandle btampHandle, /* btampHandle value in */ - v_U8_t phy_link_handle, /* phy_link_handle value in */ - v_U8_t *pucSTAId, /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t *hHddHdl /* Handle to return BSL context */ -); - -/*========================================================================== - - FUNCTION WLANBAP_CreateNewPhyLinkCtx - - DESCRIPTION - Called in order to create (or update) a BAP Physical Link "context" - - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: BAP app context handle - phy_link_handle: phy_link_handle from the Command - pHddHdl: BSL passes in its specific context - - OUT - hBtampContext: Handle (pointer to a pointer) to return the - per "Phy Link" ptBtampContext value in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CreateNewPhyLinkCtx -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */ - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */ - tWLAN_BAPRole BAPDeviceRole /* Needed to determine which MAC address to use for self MAC */ -); - -/*========================================================================== - - FUNCTION WLANBAP_UpdatePhyLinkCtxStaId - - DESCRIPTION - Called to update the STAId value associated with Physical Link "context" - - - DEPENDENCIES - - PARAMETERS - - IN - pBtampContext: ptBtampContext to update. - ucSTAId: The StaId (used by TL, PE, and HAL) - - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_UpdatePhyLinkCtxStaId -( - ptBtampContext pBtampContext, /* btampContext value in */ - v_U8_t ucSTAId -); - -/*========================================================================== - - FUNCTION WLANBAP_CreateNewLogLinkCtx - - DESCRIPTION - Called in order to allocate a BAP Logical Link "context" and "index" - - - DEPENDENCIES - - PARAMETERS - - IN - pBtampContext: Pointer to the ptBtampContext value in. - phy_link_handle: phy_link_handle involved - - OUT - pLog_link_handle: return the log_link_handle here - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CreateNewLogLinkCtx -( - ptBtampContext pBtampContext, /* pointer to the per assoc btampContext value */ - v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */ - v_U8_t tx_flow_spec[18], - v_U8_t rx_flow_spec[18], - v_U16_t *pLog_link_handle /* Return the logical link index here */ -); - - /*========================================================================== - - FUNCTION WLANBAP_pmcFullPwrReqCB - - DESCRIPTION - Callback provide to PMC in the pmcRequestFullPower API. - - - DEPENDENCIES - - PARAMETERS - - IN - callbackContext: The user passed in a context to identify - status: The halStatus - - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -void -WLANBAP_pmcFullPwrReqCB -( - void *callbackContext, - eHalStatus status -); - -/*=========================================================================== - - FUNCTION WLANBAP_RxProcLsPkt - - DESCRIPTION - - This API will be called when Link Supervision frames are received at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - pucAC: Pointer to return the access category - RxProtoType: Protocol type of Received Packet - vosDataBuff: The data buffer containing the 802.3 frame to be - translated to BT HCI Data Packet - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_RxProcLsPkt -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - v_U16_t RxProtoType, /* Protocol Type from the frame received */ - vos_pkt_t *vosRxLsBuff -); - - -/*---------------------------------------------------------------------------- - - FUNCTION WLANBAP_TxLinkSupervisionReq() - - DESCRIPTION - Implements the LinkSupervision Tx Request procedure.This will be called by APIs that want - to transmit LinkSupervision Packets - Calls PktPending CB to indicate a packet is pending for transmission - - - DEPENDENCIES - NA. - - PARAMETERS - - IN - btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl. - phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) - vosDataBuff:The actual packet being sent in Tx request - protoType : specifies if it is a LS REQ or LS REP packet - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: Failure of Transmit procedure - VOS_STATUS_SUCCESS: Success - - SIDE EFFECTS - -----------------------------------------------------------------------------*/ -VOS_STATUS -WLANBAP_TxLinkSupervision -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ - vos_pkt_t *vosDataBuff, - v_U16_t protoType -); - -/*========================================================================== - - FUNCTION WLANBAP_ReadMacConfig - - DESCRIPTION - This function sets the MAC config (Address and SSID to BT-AMP context - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -void -WLANBAP_ReadMacConfig -( - ptBtampContext pBtampCtx -); - -/*========================================================================== - - FUNCTION WLANBAP_NeedBTCoexPriority - - DESCRIPTION - This function will cause a message to be sent to BTC firmware - if a change in priority has occurred. (From AMP's point-of-view.) - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to HAL's - control block can be extracted from its context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -void -WLANBAP_NeedBTCoexPriority -( - ptBtampContext pBtampCtx, - v_U32_t needCoexPriority -); - - -/*========================================================================== - - FUNCTION WLANBAP_RxCallback - - DESCRIPTION - This function is called by TL call this function for all frames except for Data frames - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - pPacket Vos packet - frameType Frame type - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS WLANBAP_RxCallback -( - v_PVOID_t pvosGCtx, - vos_pkt_t *pPacket, - WLANTL_BAPFrameEnumType frameType -); - - -/*=========================================================================== - - FUNCTION WLANBAP_InitLinkSupervision - - DESCRIPTION - - This API will be called when Link Supervision module is to be initialized when connected at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -#define TX_LS_DATALEN 32 - -VOS_STATUS -WLANBAP_InitLinkSupervision -( - ptBtampHandle btampHandle -); - - -/*=========================================================================== - - FUNCTION WLANBAP_DeInitLinkSupervision - - DESCRIPTION - - This API will be called when Link Supervision module is to be stopped after disconnected at BAP - - PARAMETERS - - btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: BAP handle is NULL - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_DeInitLinkSupervision -( - ptBtampHandle btampHandle -); - -void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext); - - #ifdef __cplusplus - } - - -#endif - - -#endif /* #ifndef WLAN_QCT_WLANBAP_INTERNAL_H */ diff --git a/CORE/BAP/src/bapModule.c b/CORE/BAP/src/bapModule.c deleted file mode 100644 index bb52a4af8fa0..000000000000 --- a/CORE/BAP/src/bapModule.c +++ /dev/null @@ -1,1405 +0,0 @@ -/* - * Copyright (c) 2012-2014 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 M o d u l e . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN BAP modules - Module support functions. It is also where the global BAP module - context, and per-instance (returned in BAP_Open device open) contexts. - - The functions externalized by this module are to be called by the device - specific BAP Shim Layer (BSL) (in HDD) which implements a stream device on a - particular platform. - - DEPENDENCIES: - - Are listed for each API below. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapModule.c,v 1.1 2010/07/12 19:05:35 labuser Exp labuser $$DateTime$$Author: labuser $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-09-15 jez Created module - -===========================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -// Pull in some message types used by BTC -#include "sirParams.h" -//#include "halFwApi.h" - -#include "wlan_qct_tl.h" -#include "vos_trace.h" -// Pick up the sme callback registration API -#include "sme_Api.h" -#include "ccmApi.h" - -/* BT-AMP PAL API header file */ -#include "bapApi.h" -#include "bapInternal.h" - -// Pick up the BTAMP RSN definitions -#include "bapRsnTxRx.h" -//#include "assert.h" -#include "bapApiTimer.h" - -#if defined(ANI_OS_TYPE_ANDROID) -#include "bap_hdd_main.h" -#endif - -//#define BAP_DEBUG -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -//#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx) - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ -// include the phy link state machine structure here -static tWLAN_BAPbapPhysLinkMachine bapPhysLinkMachineInitial - = BTAMPFSM_INSTANCEDATA_INIT; - -/*---------------------------------------------------------------------------- - * External declarations for global context - * -------------------------------------------------------------------------*/ -// No! Get this from VOS. -// The main per-Physical Link (per WLAN association) context. -//tBtampContext btampCtx; -ptBtampContext gpBtampCtx; - -// Include the Local AMP Info structure. -tBtampHCI_AMP_Info btampHCI_AMP_Info; -// Include the Local Data Block Size info structure. -tBtampHCI_Data_Block_Size btampHCI_Data_Block_Size; -// Include the Local Version info structure. -tBtampHCI_Version_Info btampHCI_Version_Info; -// Include the Local Supported Cmds info structure. -tBtampHCI_Supported_Cmds btampHCI_Supported_Cmds; - -static unsigned char pBtStaOwnMacAddr[VOS_MAC_ADDR_SIZE]; - - /*BT-AMP SSID; per spec should have this format: "AMP-00-0a-f5-04-05-08" */ -#define WLAN_BAP_SSID_MAX_LEN 21 -static char pBtStaOwnSsid[WLAN_BAP_SSID_MAX_LEN]; - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Externalized Function Definitions -* -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_Open - - DESCRIPTION - Called at driver initialization (vos_open). BAP will initialize - all its internal resources and will wait for the call to start to - register with the other modules. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Open -( - v_PVOID_t pvosGCtx -) -{ - ptBtampContext pBtampCtx = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - Allocate (and sanity check?!) BAP control block - ------------------------------------------------------------------------*/ - vos_alloc_context(pvosGCtx, VOS_MODULE_ID_BAP, (v_VOID_t**)&pBtampCtx, sizeof(tBtampContext)); - - pBtampCtx = VOS_GET_BAP_CB(pvosGCtx); - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on WLANBAP_Open"); - //"Failed to allocate BAP pointer from pvosGCtx on WLANBAP_Open"); - return VOS_STATUS_E_FAULT; - } - - /*------------------------------------------------------------------------ - Clean up BAP control block, initialize all values - ------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Open"); - - WLANBAP_CleanCB(pBtampCtx, 0 /*do not empty*/); - - // Setup the "link back" to the VOSS context - pBtampCtx->pvosGCtx = pvosGCtx; - - // Store a pointer to the BAP context provided by VOSS - gpBtampCtx = pBtampCtx; - - /*------------------------------------------------------------------------ - Allocate internal resources - ------------------------------------------------------------------------*/ - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_Open */ - - -/*========================================================================== - - FUNCTION WLANBAP_Start - - DESCRIPTION - Called as part of the overall start procedure (vos_start). BAP will - use this call to register with TL as the BAP entity for - BT-AMP RSN frames. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - Other codes can be returned as a result of a BAL failure; - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Start -( - v_PVOID_t pvosGCtx -) -{ - ptBtampContext pBtampCtx = NULL; - VOS_STATUS vosStatus; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - Sanity check - Extract BAP control block - ------------------------------------------------------------------------*/ - pBtampCtx = VOS_GET_BAP_CB(pvosGCtx); - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on WLANBAP_Start"); - return VOS_STATUS_E_FAULT; - } - - /*------------------------------------------------------------------------ - Register with TL as an BT-AMP RSN client - ------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Start TL register"); - - /*------------------------------------------------------------------------ - Register with CSR for Roam (connection status) Events - ------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Start CSR Register"); - - - /* Initialize the BAP Tx packet monitor timer */ - WLANBAP_InitConnectionAcceptTimer (pBtampCtx ); - WLANBAP_InitLinkSupervisionTimer(pBtampCtx); - - vosStatus = vos_timer_init( - &pBtampCtx->bapTxPktMonitorTimer, - VOS_TIMER_TYPE_SW, /* use this type */ - WLANBAP_TxPacketMonitorHandler, - pBtampCtx); - - vosStatus = vos_lock_init(&pBtampCtx->bapLock); - if(!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"Lock Init Fail"); - } - - return vosStatus; -}/* WLANBAP_Start */ - -/*========================================================================== - - FUNCTION WLANBAP_Stop - - DESCRIPTION - Called by vos_stop to stop operation in BAP, before close. BAP will suspend all - BT-AMP Protocol Adaption Layer operation and will wait for the close - request to clean up its resources. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Stop -( - v_PVOID_t pvosGCtx -) -{ - ptBtampContext pBtampCtx = NULL; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - Sanity check - Extract BAP control block - ------------------------------------------------------------------------*/ - pBtampCtx = VOS_GET_BAP_CB(pvosGCtx); - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on WLANBAP_Stop"); - return VOS_STATUS_E_FAULT; - } - - /*------------------------------------------------------------------------ - Stop BAP (de-register RSN handler!?) - ------------------------------------------------------------------------*/ - vosStatus = WLANBAP_DeinitConnectionAcceptTimer(pBtampCtx); - if ( VOS_STATUS_SUCCESS != vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Couldn't destroy bapConnectionAcceptTimer"); - } - - vosStatus = WLANBAP_DeinitLinkSupervisionTimer(pBtampCtx); - if ( VOS_STATUS_SUCCESS != vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Couldn't destroy bapLinkSupervisionTimer"); - } - - vosStatus = vos_timer_destroy ( - &pBtampCtx->bapTxPktMonitorTimer ); - if ( VOS_STATUS_SUCCESS != vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Couldn't destroy bapTxPktMonitorTimer"); - } - vos_lock_destroy(&pBtampCtx->bapLock); - return VOS_STATUS_SUCCESS; -}/* WLANBAP_Stop */ - -/*========================================================================== - - FUNCTION WLANBAP_Close - - DESCRIPTION - Called by vos_close during general driver close procedure. BAP will clean up - all the internal resources. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_Close -( - v_PVOID_t pvosGCtx -) -{ - ptBtampContext pBtampCtx = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - Sanity check - Extract BAP control block - ------------------------------------------------------------------------*/ - pBtampCtx = VOS_GET_BAP_CB(pvosGCtx); - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on WLANBAP_Close"); - return VOS_STATUS_E_FAULT; - } - - /*------------------------------------------------------------------------ - Cleanup BAP control block. - ------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_Close"); - WLANBAP_CleanCB(pBtampCtx, 1 /* empty queues/lists/pkts if any*/); -#if defined(ANI_OS_TYPE_ANDROID) && defined(WLAN_BTAMP_FEATURE) - BSL_Deinit(pvosGCtx); -#endif - /*------------------------------------------------------------------------ - Free BAP context from VOSS global - ------------------------------------------------------------------------*/ - vos_free_context(pvosGCtx, VOS_MODULE_ID_BAP, pBtampCtx); - return VOS_STATUS_SUCCESS; -}/* WLANBAP_Close */ - -/*---------------------------------------------------------------------------- - HDD interfaces - Per instance initialization - ---------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_GetNewHndl - - DESCRIPTION - Called by HDD at driver open (BSL_Open). BAP will initialize - allocate a per-instance "file handle" equivalent for this specific - open call. - - There should only ever be one call to BSL_Open. Since - the open app user is the BT stack. - - - DEPENDENCIES - - PARAMETERS - - IN - hBtampHandle: Handle to return btampHandle value in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ - -VOS_STATUS -WLANBAP_GetNewHndl -( - ptBtampHandle *hBtampHandle /* Handle to return btampHandle value in */ -) -{ - ptBtampContext btampContext = NULL; - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == hBtampHandle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle pointer in WLANBAP_GetNewHndl"); - return VOS_STATUS_E_FAULT; - } - -#ifndef BTAMP_MULTIPLE_PHY_LINKS - /*------------------------------------------------------------------------ - Sanity check the BAP control block pointer - ------------------------------------------------------------------------*/ - if ( NULL == gpBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in WLANBAP_GetNewHndl"); - return VOS_STATUS_E_FAULT; - } - - //*hBtampHandle = (ptBtampHandle) &btampCtx; - /* return a pointer to the tBtampContext structure - allocated by VOS for us */ - *hBtampHandle = (ptBtampHandle) gpBtampCtx; - btampContext = gpBtampCtx; - - /* Update the MAC address and SSID if in case the Read Local AMP Assoc - * Request is made before Create Physical Link creation. - */ - WLANBAP_ReadMacConfig (btampContext); - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_GetNewHndl */ - - -/*========================================================================== - - FUNCTION WLANBAP_ReleaseHndl - - DESCRIPTION - Called by HDD at driver open (BSL_Close). BAP will reclaim (invalidate) - the "file handle" passed into this call. - - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: btampHandle value to invalidate. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: btampHandle is NULL ; access would cause a - page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_ReleaseHndl -( - ptBtampHandle btampHandle /* btamp handle value to release */ -) -{ - /* obtain btamp Context */ - ptBtampContext btampContext = (ptBtampContext) btampHandle; - tHalHandle halHandle; - eHalStatus halStatus = eHAL_STATUS_SUCCESS; - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == btampHandle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in WLANBAP_ReleaseHndl"); - return VOS_STATUS_E_FAULT; - } - - /* JEZ081001: TODO: Major: */ - /* Check to see if any wireless associations are still active */ - /* ...if so, I have to call - * sme_RoamDisconnect(VOS_GET_HAL_CB(btampHandle->pvosGCtx), - * btampHandle->sessionId, - * eCSR_DISCONNECT_REASON_UNSPECIFIED); - * on all of them */ - - halHandle = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if(NULL == halHandle) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "halHandle is NULL in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - if( btampContext->isBapSessionOpen == TRUE ) - { - halStatus = sme_CloseSession(halHandle, - btampContext->sessionId, NULL, NULL); - if(eHAL_STATUS_SUCCESS == halStatus) - { - btampContext->isBapSessionOpen = FALSE; - } - } - - /* release the btampHandle */ - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_ReleaseHndl */ - -/*---------------------------------------------------------------------------- - * Utility Function implementations - * -------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANBAP_CleanCB - - DESCRIPTION - Clear out all fields in the BAP context. - - DEPENDENCIES - - PARAMETERS - - IN - pBtampCtx: pointer to the BAP control block - freeFlag: flag indicating whether to free any allocations. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page - fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CleanCB -( - ptBtampContext pBtampCtx, - v_U32_t freeFlag // 0 /*do not empty*/); -) -{ - v_U16_t i; /* Logical Link index */ - tpBtampLogLinkCtx pLogLinkContext = NULL; - - /*------------------------------------------------------------------------ - Sanity check BAP control block - ------------------------------------------------------------------------*/ - - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer in WLANBAP_CleanCB"); - return VOS_STATUS_E_FAULT; - } - - /*------------------------------------------------------------------------ - Clean up BAP control block, initialize all values - ------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_CleanCB"); - - // First, clear out EVERYTHING in the BT-AMP context - vos_mem_set( pBtampCtx, sizeof( *pBtampCtx), 0); - - pBtampCtx->pvosGCtx = NULL; - - // Initialize physical link state machine to DISCONNECTED state - //pBtampCtx->bapPhysLinkMachine = BTAMPFSM_INSTANCEDATA_INIT; - - // Initialize physical link state machine to DISCONNECTED state - vos_mem_copy( - &pBtampCtx->bapPhysLinkMachine, - &bapPhysLinkMachineInitial, /* BTAMPFSM_INSTANCEDATA_INIT; */ - sizeof( pBtampCtx->bapPhysLinkMachine)); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d", __func__, bapPhysLinkMachineInitial.stateVar); - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initialized State: %d", __func__, pBtampCtx->bapPhysLinkMachine.stateVar); - - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __func__, pBtampCtx); -#ifdef BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __func__, __LINE__ ); -#endif //BAP_DEBUG - - - pBtampCtx->sessionId = 0; - pBtampCtx->pAppHdl = NULL; // Per-app BSL context - pBtampCtx->pHddHdl = NULL; // Per-app BSL context - /* 8 bits of phy_link_handle identifies this association */ - pBtampCtx->phy_link_handle = 0; - pBtampCtx->channel = 0; - pBtampCtx->BAPDeviceRole = BT_RESPONDER; - pBtampCtx->ucSTAId = 0; - - // gNeedPhysLinkCompEvent - pBtampCtx->gNeedPhysLinkCompEvent = VOS_FALSE; - // gPhysLinkStatus - pBtampCtx->gPhysLinkStatus = WLANBAP_STATUS_SUCCESS; - // gDiscRequested - pBtampCtx->gDiscRequested = VOS_FALSE; - // gDiscReason - pBtampCtx->gDiscReason = WLANBAP_STATUS_SUCCESS; - - /* Connection Accept Timer interval*/ - pBtampCtx->bapConnectionAcceptTimerInterval = WLANBAP_CONNECTION_ACCEPT_TIMEOUT; - /* Link Supervision Timer interval*/ - pBtampCtx->bapLinkSupervisionTimerInterval = WLANBAP_LINK_SUPERVISION_TIMEOUT; - /* Logical Link Accept Timer interval*/ - pBtampCtx->bapLogicalLinkAcceptTimerInterval = WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT; - /* Best Effort Flush timer interval*/ - pBtampCtx->bapBEFlushTimerInterval = WLANBAP_BE_FLUSH_TIMEOUT; - - // Include the associations MAC addresses - vos_mem_copy( - pBtampCtx->self_mac_addr, - pBtStaOwnMacAddr, /* Where do I get the current MAC address? */ - sizeof(pBtampCtx->self_mac_addr)); - - vos_mem_set( - pBtampCtx->peer_mac_addr, - sizeof(pBtampCtx->peer_mac_addr), - 0); - - // The array of logical links - pBtampCtx->current_log_link_index = 0; /* assigned mod 16 */ - pBtampCtx->total_log_link_index = 0; /* should never be >16 */ - - // Clear up the array of logical links - for (i = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) - { - pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; - pLogLinkContext->present = 0; - pLogLinkContext->uTxPktCompleted = 0; - pLogLinkContext->log_link_handle = 0; - } - - - // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt - pBtampCtx->pfnBtampFetchPktCB = NULL; - pBtampCtx->pfnBtamp_STARxCB = NULL; - pBtampCtx->pfnBtampTxCompCB = NULL; - /* Implements the callback for ALL asynchronous events. */ - pBtampCtx->pBapHCIEventCB = NULL; - - /* Set the default for event mask */ - vos_mem_set( - pBtampCtx->event_mask_page_2, - sizeof(pBtampCtx->event_mask_page_2), - 0); - - /* Set the default for location data. */ - pBtampCtx->btamp_Location_Data_Info.loc_options = 0x58; - /* Set the default data transfer mode */ - pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED; - - return VOS_STATUS_SUCCESS; -}/* WLANBAP_CleanCB */ - -/*========================================================================== - - FUNCTION WLANBAP_GetCtxFromStaId - - DESCRIPTION - Called inside the BT-AMP PAL (BAP) layer whenever we need either the - BSL context or the BTAMP context from the StaId. - - - DEPENDENCIES - - PARAMETERS - - IN - ucSTAId: The StaId (used by TL, PE, and HAL) - - OUT - hBtampHandle: Handle (pointer to a pointer) to return the - btampHandle value in. - hHddHdl: Handle to return the BSL context pointer in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetCtxFromStaId -( - v_U8_t ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - ptBtampHandle *hBtampHandle, /* Handle to return per app btampHandle value in */ - ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */ - v_PVOID_t *hHddHdl /* Handle to return BSL context in */ -) -{ -#ifndef BTAMP_MULTIPLE_PHY_LINKS - - /* For now, we know there is only one application context */ - /* ...and only one physical link context */ - //*hBtampHandle = &((ptBtampContext) btampCtx); - //*hBtampHandle = &btampCtx; - *hBtampHandle = (v_VOID_t*)gpBtampCtx; - - //*hBtampContext = &btampCtx; - *hBtampContext = gpBtampCtx; - - /* Handle to return BSL context in */ - //*hHddHdl = btampCtx.pHddHdl; - *hHddHdl = gpBtampCtx->pHddHdl; - - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_GetCtxFromStaId */ - -/*========================================================================== - - FUNCTION WLANBAP_GetStaIdFromLinkCtx - - DESCRIPTION - Called inside the BT-AMP PAL (BAP) layer whenever we need the - StaId (or hHddHdl) from the BTAMP context and phy_link_handle. - - - DEPENDENCIES - - PARAMETERS - - IN - hBtampHandle: Handle (pointer to a pointer) to return the - btampHandle value in. - phy_link_handle: physical link handle value. Unique per assoc. - - OUT - pucSTAId: The StaId (used by TL, PE, and HAL) - hHddHdl: Handle to return the BSL context pointer in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_GetStaIdFromLinkCtx -( - ptBtampHandle btampHandle, /* btampHandle value in */ - v_U8_t phy_link_handle, /* phy_link_handle value in */ - v_U8_t *pucSTAId, /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t *hHddHdl /* Handle to return BSL context */ -) -{ -#ifndef BTAMP_MULTIPLE_PHY_LINKS - ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* Since there is only one physical link...we have stored all - * the physical link specific context in the application context - */ - /* The StaId (used by TL, PE, and HAL) */ - *pucSTAId = pBtampCtx->ucSTAId; - - /* Handle to return BSL context */ - *hHddHdl = pBtampCtx->pHddHdl; - - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_GetStaIdFromLinkCtx */ - -/*========================================================================== - - FUNCTION WLANBAP_CreateNewPhyLinkCtx - - DESCRIPTION - Called in order to create (or update) a BAP Physical Link "context" - - - DEPENDENCIES - - PARAMETERS - - IN - btampHandle: BAP app context handle - phy_link_handle: phy_link_handle from the Command - pHddHdl: BSL passes in its specific context - - OUT - hBtampContext: Handle (pointer to a pointer) to return the - per "Phy Link" ptBtampContext value in. - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CreateNewPhyLinkCtx -( - ptBtampHandle btampHandle, - v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */ - v_PVOID_t pHddHdl, /* BSL passes in its specific context */ - ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */ - tWLAN_BAPRole BAPDeviceRole -) -{ -#ifndef BTAMP_MULTIPLE_PHY_LINKS - ptBtampContext pBtampCtx = gpBtampCtx; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /* Read and Set MAC address and SSID to BT-AMP context */ - WLANBAP_ReadMacConfig (pBtampCtx); - - /*------------------------------------------------------------------------ - For now, presume security is not enabled. - ------------------------------------------------------------------------*/ - pBtampCtx->ucSecEnabled = WLANBAP_SECURITY_ENABLED_STATE; - - /*------------------------------------------------------------------------ - Initial Short Range Mode for this physical link is 'disabled' - ------------------------------------------------------------------------*/ - pBtampCtx->phy_link_srm = 0; - - /*------------------------------------------------------------------------ - Clear out the logical links. - ------------------------------------------------------------------------*/ - pBtampCtx->current_log_link_index = 0; - pBtampCtx->total_log_link_index = 0; - - /*------------------------------------------------------------------------ - Now configure the roaming profile links. To SSID and bssid. - ------------------------------------------------------------------------*/ - // We have room for two SSIDs. - pBtampCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now. - pBtampCtx->csrRoamProfile.SSIDs.SSIDList = pBtampCtx->SSIDList; //Array of two - pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0; - pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE; - pBtampCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = VOS_FALSE; - - pBtampCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now. - pBtampCtx->csrRoamProfile.BSSIDs.bssid = &pBtampCtx->bssid; - - // Now configure the auth type in the roaming profile. To open. - //pBtampCtx->csrRoamProfile.AuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default - //pBtampCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default - pBtampCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_RSN_PSK; - pBtampCtx->csrRoamProfile.negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_AES; - - pBtampCtx->phy_link_handle = phy_link_handle; - /* For now, we know there is only one physical link context */ - //*hBtampContext = &btampCtx; - - pBtampCtx->pHddHdl = pHddHdl; - - *hBtampContext = pBtampCtx; - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Btamp Ctxt = %p", pBtampCtx); - - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_CreateNewPhyLinkCtx */ - -/*========================================================================== - - FUNCTION WLANBAP_UpdatePhyLinkCtxStaId - - DESCRIPTION - Called to update the STAId value associated with Physical Link "context" - - - DEPENDENCIES - - PARAMETERS - - IN - pBtampContext: ptBtampContext to update. - ucSTAId: The StaId (used by TL, PE, and HAL) - - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_UpdatePhyLinkCtxStaId -( - ptBtampContext pBtampContext, /* btampContext value in */ - v_U8_t ucSTAId -) -{ -#ifndef BTAMP_MULTIPLE_PHY_LINKS - - /*------------------------------------------------------------------------ - Sanity check params - ------------------------------------------------------------------------*/ - if ( NULL == pBtampContext) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP handle value in %s", __func__); - return VOS_STATUS_E_FAULT; - } - - /* The StaId (used by TL, PE, and HAL) */ - pBtampContext->ucSTAId = ucSTAId; - - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_UpdatePhyLinkCtxStaId */ - -v_U8_t -bapAllocNextLogLinkIndex -( - ptBtampContext pBtampContext, /* Pointer to the per assoc btampContext value */ - v_U8_t phy_link_handle /* I get phy_link_handle from the Command */ -) -{ - return ++(pBtampContext->current_log_link_index) % WLANBAP_MAX_LOG_LINKS; -}/* bapAllocNextLogLinkIndex */ - -/*========================================================================== - - FUNCTION WLANBAP_CreateNewLogLinkCtx - - DESCRIPTION - Called in order to allocate a BAP Logical Link "context" and "index" - - - DEPENDENCIES - - PARAMETERS - - IN - pBtampContext: Pointer to the ptBtampContext value in. - phy_link_handle: phy_link_handle involved - - OUT - pLog_link_handle: return the log_link_handle here - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANBAP_CreateNewLogLinkCtx -( - ptBtampContext pBtampContext, /* Pointer to the per assoc btampContext value */ - v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */ - v_U8_t tx_flow_spec[18], - v_U8_t rx_flow_spec[18], - v_U16_t *pLog_link_handle /* Return the logical link index here */ -) -{ -#ifndef BTAMP_MULTIPLE_PHY_LINKS - v_U16_t i; /* Logical Link index */ - tpBtampLogLinkCtx pLogLinkContext; - v_U32_t retval; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /*------------------------------------------------------------------------ - For now, allocate the logical links serially. - ------------------------------------------------------------------------*/ - i = pBtampContext->current_log_link_index - = bapAllocNextLogLinkIndex(pBtampContext, phy_link_handle); - pBtampContext->total_log_link_index++; - - *pLog_link_handle = (i << 8) + ( v_U16_t ) phy_link_handle ; /* Return the logical link index here */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - " %s:*pLog_link_handle=%x", __func__,*pLog_link_handle); - - /*------------------------------------------------------------------------ - Evaluate the Tx and Rx Flow specification for this logical link. - ------------------------------------------------------------------------*/ - // Currently we only support flow specs with service types of BE (0x01) - -#ifdef BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: pBtampContext value = %p in %s:%d", pBtampContext, __func__, __LINE__ ); -#endif //BAP_DEBUG - - /*------------------------------------------------------------------------ - Now configure the Logical Link context. - ------------------------------------------------------------------------*/ - pLogLinkContext = &(pBtampContext->btampLogLinkCtx[i]); - - /* Extract Tx flow spec into the context structure */ - retval = btampUnpackTlvFlow_Spec((void *)pBtampContext, tx_flow_spec, - WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN, - &pLogLinkContext->btampFlowSpec); - if (retval != BTAMP_PARSE_SUCCESS) - { - /* Flow spec parsing failed, return failure */ - return VOS_STATUS_E_BADMSG; - } - - /* Save the Logical link handle in the logical link context - As of now, only the index is saved as logical link handle since - same is returned in the event. - FIXME: Decide whether this index has to be combined with physical - link handle to generate the Logical link handle. - */ - pLogLinkContext->log_link_handle = *pLog_link_handle; - - // Mark this entry as OCCUPIED - pLogLinkContext->present = VOS_TRUE; - // Now initialize the Logical Link context - pLogLinkContext->btampAC = 1; - // Now initialize the values in the Logical Link context - pLogLinkContext->ucTID = 0; // Currently we only support BE TID (0x00) - pLogLinkContext->ucUP = 0; - pLogLinkContext->uTxPktCompleted = 0; - - return VOS_STATUS_SUCCESS; -#else // defined(BTAMP_MULTIPLE_PHY_LINKS) - -#endif //BTAMP_MULTIPLE_PHY_LINKS -}/* WLANBAP_CreateNewLogLinkCtx */ - -/*========================================================================== - - FUNCTION WLANBAP_pmcFullPwrReqCB - - DESCRIPTION - Callback provide to PMC in the pmcRequestFullPower API. - - - DEPENDENCIES - - PARAMETERS - - IN - callbackContext: The user passed in a context to identify - status: The halStatus - - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -void -WLANBAP_pmcFullPwrReqCB -( - void *callbackContext, - eHalStatus status -) -{ - -}/* WLANBAP_pmcFullPwrReqCB */ - - -/*========================================================================== - - FUNCTION WLANBAP_ReadMacConfig - - DESCRIPTION - This function sets the MAC config (Address and SSID to BT-AMP context - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -void -WLANBAP_ReadMacConfig -( - ptBtampContext pBtampCtx -) -{ - tANI_U32 len = VOS_MAC_ADDR_SIZE; - tHalHandle pMac = NULL; - - /*------------------------------------------------------------------------ - Temporary method to get the self MAC address - ------------------------------------------------------------------------*/ - if (NULL == pBtampCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "pBtampCtx is NULL in %s", __func__); - - return; - } - - pMac = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pBtampCtx->pvosGCtx); - if (NULL == pMac) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "pMac is NULL in %s", __func__); - - return; - } - - ccmCfgGetStr( pMac, WNI_CFG_STA_ID, pBtStaOwnMacAddr, &len ); - - if (VOS_MAC_ADDR_SIZE != len) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "len is improper %s", __func__); - return; - } - - /* Form the SSID from Mac address */ - VOS_SNPRINTF( pBtStaOwnSsid, WLAN_BAP_SSID_MAX_LEN, - "AMP-%02x-%02x-%02x-%02x-%02x-%02x", - pBtStaOwnMacAddr[0], pBtStaOwnMacAddr[1], pBtStaOwnMacAddr[2], - pBtStaOwnMacAddr[3], pBtStaOwnMacAddr[4], pBtStaOwnMacAddr[5]); - - /*------------------------------------------------------------------------ - Set the MAC address for this instance - ------------------------------------------------------------------------*/ - vos_mem_copy( - pBtampCtx->self_mac_addr, - pBtStaOwnMacAddr, - sizeof(pBtampCtx->self_mac_addr)); - - /*------------------------------------------------------------------------ - Set our SSID value - ------------------------------------------------------------------------*/ - pBtampCtx->ownSsidLen = 21; - vos_mem_copy( - pBtampCtx->ownSsid, - pBtStaOwnSsid, - pBtampCtx->ownSsidLen); -} - -/*========================================================================== - - FUNCTION WLANBAP_NeedBTCoexPriority - - DESCRIPTION - This function will cause a message to be sent to BTC firmware - if a change in priority has occurred. (From AMP's point-of-view.) - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to HAL's - control block can be extracted from its context - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -// Global -static int gBapCoexPriority; - -void -WLANBAP_NeedBTCoexPriority -( - ptBtampContext pBtampCtx, - v_U32_t needCoexPriority -) -{ - tHalHandle pMac = NULL; - tSmeBtAmpEvent btAmpEvent; - - - /*------------------------------------------------------------------------ - Retrieve the pMac (HAL context) - ------------------------------------------------------------------------*/ - pMac = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pBtampCtx->pvosGCtx); - - // Is re-entrancy protection needed for this? - if (needCoexPriority != gBapCoexPriority) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "Calling %s with needCoexPriority=%d.", __func__, needCoexPriority); - - gBapCoexPriority = needCoexPriority; - switch ( needCoexPriority) - { - case 0: /* Idle */ - btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_TERMINATED; - pBtampCtx->btamp_session_on = FALSE; - sme_sendBTAmpEvent(pMac, btAmpEvent); - - break; - - case 1: /* Associating */ - btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_START; - pBtampCtx->btamp_session_on = TRUE; - sme_sendBTAmpEvent(pMac, btAmpEvent); - - break; - - case 2: /* Post-assoc */ - btAmpEvent.btAmpEventType = BTAMP_EVENT_CONNECTION_STOP; - sme_sendBTAmpEvent(pMac, btAmpEvent); - - break; - - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Invalid Coexistence priority request: %d", - __func__, needCoexPriority); - } - - } -} - - -/*========================================================================== - - FUNCTION WLANBAP_RxCallback - - DESCRIPTION - This function is called by TL call this function for all frames except for Data frames - - DEPENDENCIES - - PARAMETERS - - pvosGCtx: pointer to the global vos context; a handle to BAP's - control block can be extracted from its context - pPacket Vos packet - frameType Frame type - - RETURN VALUE - None - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS WLANBAP_RxCallback -( - v_PVOID_t pvosGCtx, - vos_pkt_t *pPacket, - WLANTL_BAPFrameEnumType frameType -) -{ - ptBtampContext pBtampCtx = NULL; - - pBtampCtx = VOS_GET_BAP_CB(pvosGCtx); - if ( NULL == pBtampCtx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on WLANBAP_Start"); - return VOS_STATUS_E_FAULT; - } - - switch (frameType) - { - case WLANTL_BT_AMP_TYPE_LS_REQ: /* Fall through */ - case WLANTL_BT_AMP_TYPE_LS_REP: - { - /* Link supervision frame, process this frame */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: link Supervision packet received over TL: %d, => BAP", - __func__, frameType); - WLANBAP_RxProcLsPkt((ptBtampHandle)pBtampCtx, - pBtampCtx->phy_link_handle, - frameType, - pPacket); - break; - } - - case WLANTL_BT_AMP_TYPE_AR: /* Fall through */ - case WLANTL_BT_AMP_TYPE_SEC: - { - /* Call the RSN callback handler */ - bapRsnRxCallback (pvosGCtx, pPacket); - break; - } - - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Invalid frametype from TL: %d, => BAP", - __func__, frameType); - } - - return ( VOS_STATUS_SUCCESS ); -} diff --git a/CORE/BAP/src/bapRsn8021xAuthFsm.c b/CORE/BAP/src/bapRsn8021xAuthFsm.c deleted file mode 100644 index 9d67cd899f87..000000000000 --- a/CORE/BAP/src/bapRsn8021xAuthFsm.c +++ /dev/null @@ -1,1625 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xAuthRsnFsm.c $ - * - */ -/* - * Contains definitions for the RSN EAPOL-Key FSM on the - * authenticator side. This is based on 802.11i. - * - * Author: Mayank D. Upadhyay - * Date: 19-December-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#include "vos_types.h" -#include "bapRsnSsmServices.h" -#include "bapRsnSsmEapol.h" -#include "bapRsnErrors.h" -#include "bapInternal.h" -#include "bapRsn8021xFsm.h" -#include "bapRsn8021xAuthFsm.h" -#include "vos_utils.h" -#include "vos_memory.h" -#include "vos_timer.h" -#include "bapRsnTxRx.h" -#include "bapRsnSsmAesKeyWrap.h" -#include "btampFsm.h" - -// The different states that this FSM transitions through -#define DISCONNECT 0 -#define DISCONNECTED 1 -#define INITIALIZE 2 -#define AUTHENTICATION 3 -#define AUTHENTICATION_2 4 -#define GET_PSK 5 -#define GET_EAP_KEY 6 -#define PTK_START 7 -#define PTK_INIT_NEGO 8 -#define PTK_INIT_NEGO_TX 9 -#define PTK_INIT_DONE 10 -#define UPDATE_KEYS_REQ 11 -#define INTEG_FAILURE 12 -#define KEY_UPDATE 13 -#define NUM_STATES (KEY_UPDATE + 1) - - - -static tAuthRsnFsmConsts authConsts = { 2000, 3 }; //timeout, retry limit -static v_U8_t aniSsmIeRsnOui[] = ANI_SSM_IE_RSN_OUI; - - -/************************************** - * Static functions in this module - **************************************/ - -static -int zeroOutPtk(tAuthRsnFsm *fsm); -static -int stopAllTimers(tAuthRsnFsm *fsm); - -static -int checkMic(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - -static -int checkLocalReplayCounter(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); -static -int checkPeerReplayCounter(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - -static int checkInfoElement(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - -static -int derivePtk(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - - -static int checkTransition(tAuthRsnFsm *fsm, void *arg); - -static int -gotoStateInit(tAuthRsnFsm *fsm); - -static void msg2TimerCallback( void * ); -static void msg4TimerCallback( void * ); - -static int authRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ); -static int authRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ); - -/******************************** - * Functions Forward Declarations - ********************************/ - -int authRsnAuthStartEventHandler( tAuthRsnFsm *fsm ); -int authRsnAuthDisconEventHandler( tAuthRsnFsm *fsm ); - -/************************* - * The exported functions - *************************/ - -/** - * authRsnFsmInit - * - * FUNCTION: - * Initializes the constants and the callbacks needed by this FSM - * module. - * - * @param consts the various constant values needed by this FSM - * @param cb callbacks to the various procedures needed by this FSM - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmInit(tAuthRsnFsmConsts *constsIn) -{ - // TODO: Read the constants in from config - // authConsts = *constsIn; - authConsts.timeoutPeriod = 2000; //ms - authConsts.maxTries = 3; - - return ANI_OK; -} - -/** - * authRsnFsmCreate - * - * FUNCTION - * Allocates and initializes the state of an RSN key FSM instance for - * the given STA context. - * - * @parm staCtx the STA context whose instance is being created - * @param pskBased pass in eANI_BOOLEAN_TRUE is this STA is to be - * authenticated based on a pre-shared key as opposed to EAP. - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmCreate(tBtampContext *ctx) -{ - int retVal = ANI_OK; - tAuthRsnFsm *fsm = &ctx->uFsm.authFsm; - - // First, clear everything out - vos_mem_zero( fsm, sizeof(tAuthRsnFsm)); - - if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( authRsnTxCompleteHandler, - authRsnRxFrameHandler ) ) ) - { - return ANI_ERROR; - } - - if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) ) - { - return ANI_ERROR; - } - - // Allocate the station context - fsm->staCtx = (tStaContext *)vos_mem_malloc( sizeof(tStaContext) ); - if (fsm->staCtx == NULL) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - // Clear out the station context - vos_mem_zero( fsm->staCtx, sizeof(tStaContext) ); - - fsm->ctx = ctx; - fsm->staCtx->authRsnFsm = fsm; - //Only support CCMP - fsm->staCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES; - - if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg2Timer, VOS_TIMER_TYPE_SW, msg2TimerCallback, fsm ) ) ) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg4Timer, VOS_TIMER_TYPE_SW, msg4TimerCallback, fsm ) ) ) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, - RSN_MAX_PACKET_SIZE, - EAPOL_TX_HEADER_SIZE ); - if (retVal != ANI_OK) - { - VOS_ASSERT( 0 ); - goto error; - } - - aniAsfPacketAllocate(&fsm->staCtx->pmk); - if (fsm->staCtx->pmk == NULL) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - aniAsfPacketAllocateExplicit(&fsm->staCtx->ieSta, - RSN_IE_MAX_PACKET_SIZE, - RSN_IE_HEADER_SIZE ); - if (fsm->staCtx->ieSta == NULL) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - fsm->cryptHandle = 0; - if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) ) - { - retVal = ANI_E_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - fsm->currentState = INITIALIZE; - gotoStateInit(fsm); - - //We can call this function here because it is connected at this time - authRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL ); - - return ANI_OK; - - error: - authRsnFsmFree(ctx); - - return retVal; - -} - -/** - * authRsnFsmFree - * - * FUNCTION - * Frees a previously allocated RSN Key FSM in a STA context. If the - * RSN Key FSM is not yet allocated, then this is an error. - * - * @param ctx the STA context whose FSM instance is to be freed - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmFree(tBtampContext *ctx) -{ - tAuthRsnFsm *fsm = &ctx->uFsm.authFsm; - - VOS_ASSERT(fsm); - - if( fsm->cryptHandle) - { - vos_crypto_deinit( fsm->cryptHandle ); - } - - bapRsnClearTxRxCallbacks(); - - if ( fsm->staCtx ) - { - fsm->staCtx->authRsnFsm = NULL; - } - - if ( VOS_TIMER_STATE_UNUSED != fsm->msg2Timer.state ) vos_timer_destroy( &fsm->msg2Timer ); - if ( VOS_TIMER_STATE_UNUSED != fsm->msg4Timer.state ) vos_timer_destroy( &fsm->msg4Timer ); - - if (fsm->lastEapol) - { - aniAsfPacketFree(fsm->lastEapol); - fsm->lastEapol = NULL; - } - - if( fsm->staCtx ) - { - if( fsm->staCtx->pmk ) - { - aniAsfPacketFree( fsm->staCtx->pmk ); - fsm->staCtx->pmk = NULL; - } - vos_mem_free(fsm->staCtx); - fsm->staCtx = NULL; - } - - vos_mem_zero( fsm, sizeof(tAuthRsnFsm) ); - - return ANI_OK; -} - -/** - * authRsnFsmProcessEvent - * - * FUNCTION - * Passes an event to the RSN key FSM instance for immediate processing. - * - * @param fsm the RSN Key FSM instance - * @param eventId the AAG event to process - * @param arg an optional argument for this event - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmProcessEvent(tAuthRsnFsm *fsm, tRsnFsmEvent eventId, void *arg) -{ - VOS_ASSERT(fsm); - - switch (eventId) { - case RSN_FSM_TIMER_EXPIRED: - // Proceed straight to checkTransition - break; - case RSN_FSM_AUTH_START: - fsm->authReq = eANI_BOOLEAN_TRUE; - authRsnAuthStartEventHandler(fsm); - break; - case RSN_FSM_EAPOL_FRAME_AVAILABLE: - fsm->eapolAvail = eANI_BOOLEAN_TRUE; - break; - case RSN_FSM_DISCONNECT: - fsm->disconnect = eANI_BOOLEAN_TRUE; - authRsnAuthDisconEventHandler(fsm); - break; - case RSN_FSM_INTEG_FAILED: - fsm->integFailed = eANI_BOOLEAN_TRUE; - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Unknown event for Auth RSN Key Fsm: %d\n", eventId); - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - break; - } - - checkTransition(fsm, arg); - - return ANI_OK; -} - - -int -authRsnAuthStartEventHandler(tAuthRsnFsm *fsm) -{ - static v_U8_t btampStaRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, - 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 }; - // Copy required info - vos_mem_copy( &fsm->staCtx->authMac, fsm->ctx->self_mac_addr, 6); - vos_mem_copy( &fsm->staCtx->suppMac, fsm->ctx->peer_mac_addr, 6); - aniAsfPacketAppendBuffer( fsm->staCtx->pmk, fsm->ctx->key_material, fsm->ctx->key_length); - - aniAsfPacketAppendBuffer( fsm->staCtx->ieSta, btampStaRSNIE, sizeof(btampStaRSNIE)); - return ANI_OK; -} - -int -authRsnAuthDisconEventHandler(tAuthRsnFsm *fsm) -{ - // Free Stactx .? - return ANI_OK; -} - -/*********************** - * The static functions - ***********************/ - -static int -gotoStateInit(tAuthRsnFsm *fsm) -{ - fsm->currentState = INITIALIZE; - - // TODO: Move this to a global position which applies to WEP as - // well - //initGlobalKeys = eANI_BOOLEAN_FALSE; - - fsm->authReq = eANI_BOOLEAN_FALSE; - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - fsm->disconnect = eANI_BOOLEAN_FALSE; - fsm->integFailed = eANI_BOOLEAN_FALSE; - - fsm->numTries = 0; - - // Create two replay counter's..one for our requests, and another - // for STA's requests. Initialize the first one randomly. - aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->staCtx->localReplayCtr, - ANI_EAPOL_KEY_RSN_RSC_SIZE, 0); - aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->staCtx->peerReplayCtr, - ANI_EAPOL_KEY_RSN_RSC_SIZE, 0); - - return ANI_OK; -} - -static int -gotoStateAuthentication(tAuthRsnFsm *fsm) -{ - fsm->currentState = AUTHENTICATION; - - zeroOutPtk(fsm); - fsm->authReq = eANI_BOOLEAN_FALSE; - - checkTransition(fsm, NULL); // UCT rule - - return ANI_OK; -} - -static int -gotoStateAuthentication2(tAuthRsnFsm *fsm) -{ - fsm->currentState = AUTHENTICATION_2; - - if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( fsm->cryptHandle, fsm->aNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE ) ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "gotoStateAuthentication2 fail to get random number. Disconnect\n" ); - bapAuthDisconnect( fsm->ctx ); - return ANI_ERROR; - } - fsm->numTries = 0; - - checkTransition(fsm, NULL); // UCT rule - - return ANI_OK; -} - - -static int -gotoStateGetPsk(tAuthRsnFsm *fsm) -{ - //This is simply a transaction because we already have the PMK. We always do. - fsm->currentState = GET_PSK; - - fsm->numTries = 0; - - checkTransition(fsm, NULL); - - return ANI_OK; -} - -static int -gotoStatePtkStart(tAuthRsnFsm *fsm) -{ - tAniEapolRsnKeyDesc txDesc; - int retVal; - - fsm->msg2TimeOut = VOS_FALSE; - fsm->currentState = PTK_START; - - // Create a new packet if we don't have one to retransmit - //if (aniAsfPacketGetLen(fsm->lastEapol) == 0) -#if 0 - if( fsm->lastEapol ) - { - aniAsfPacketFree( fsm->lastEapol ); - fsm->lastEapol = NULL; - - retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, - RSN_MAX_PACKET_SIZE, - EAPOL_TX_HEADER_SIZE ); -#endif - aniAsfPacketEmptyExplicit(fsm->lastEapol, - EAPOL_TX_HEADER_SIZE); - //} - // if (1) - //{ - - vos_mem_zero( &txDesc, sizeof(txDesc) ); - - // The Key Information bits... - if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) - { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; - } - else { - return ANI_E_ILLEGAL_ARG; - } - txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; - txDesc.info.ackFlag = eANI_BOOLEAN_TRUE; - - // The other fields... - txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType); - aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter); - vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce)); - - retVal = aniEapolWriteKey(fsm->cryptHandle, - fsm->lastEapol, - fsm->staCtx->suppMac, - fsm->staCtx->authMac, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - &txDesc, - NULL, 0); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } -#if 0 - } - else { - retransmit = eANI_BOOLEAN_TRUE; - } -#endif - - if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - retVal = ANI_OK; - } - else - { - //we fail to send the eapol frame disconnect - bapAuthDisconnect( fsm->ctx ); - retVal = ANI_ERROR; - } - - return retVal; -} - -static int -gotoStatePtkInitNego(tAuthRsnFsm *fsm, void *arg) -{ - fsm->currentState = PTK_INIT_NEGO; - - // Replay counter will be automatically updated when we create a - // new packet - - fsm->numTries = 0; - aniAsfPacketEmptyExplicit(fsm->lastEapol, - EAPOL_TX_HEADER_SIZE); - - checkTransition(fsm, arg); - - return ANI_OK; -} - -// Use this only with trusted IE like the one we generated locally -static int -getRsnIeFromAdvertizedIes(tAuthRsnFsm *fsm, v_U8_t **rsnIe) -{ - int retVal = ANI_E_ILLEGAL_ARG; - v_U8_t *ptr = fsm->advertizedRsnIe; - - if (*ptr == ANI_SSM_IE_RSN_ELEM_ID) - { - retVal = *(ptr + 1) + 2; // The L field from the TLV + 2B TL - *rsnIe = ptr; - } - - return retVal; -} - -// Use this only with trusted IE like the one we generated locally -static void -addPad( - v_U8_t *dataBytes, - int dataLen, - int padLen) -{ - int i; - - // The first byte of padding is 0xdd. The rest are 0x00's - // See 802.11i section 8.5.2 subsection "Key Data Encapsulation" - - for ( i=dataLen ; i < dataLen+padLen; i++) - { - if ( i == dataLen ) - { - dataBytes[i] = 0xdd; - } - else { - dataBytes[i] = 0x00; - } - } - - return; -} - -/** - * aagAppendGroupKeyForRsn - * - * Appends the group key to the packet in the RSN key encapulation format. - * - * @param packet - the packet to append to - * @param radioId - the radio whose group key needs to be appended - * - * @return ANI_OK if the operation succeeds - */ -#define STATIC_WEP_KEY_LEN 16 -#define GROUP_KEY_ID 0 -#define ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID 0xDD -#define ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID 1 - -int -aagAppendGroupKeyForRsn(tAniPacket *packet) -{ -#if 0 - tAniPacket *groupKey = NULL; -#else - tANI_U8 groupKey[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15}; -#endif - tANI_U8 *groupKeyBytes = NULL; - tANI_U8 *lenPtr = NULL; - tANI_U8 *endPtr = NULL; - int groupKeyLen; - int retVal; - -#if 0 - groupKey = AAG_GROUP_KEY(radioId); - if (groupKey == NULL) { - ANI_AAG_LOG_E("Group key is not yet set on radio %d, id %d!", - radioId, AAG_GROUP_KEY_ID(radioId)); - assert(0 && "Group key is still NULL!"); - return ANI_E_FAILED; - } - - groupKeyLen = aniAsfPacketGetBytes(groupKey, &groupKeyBytes); - CHECK_NO_ERROR(groupKeyLen); - - if (aagConfig.logLevel >= LOG_INFO) { - ANI_AAG_LOG_D("Will encapsulate group key bytes %s", - aniAsfHexStr(groupKeyBytes, groupKeyLen)); - } -#else - groupKeyBytes = groupKey; - - groupKeyLen = STATIC_WEP_KEY_LEN; -#endif - - /* - * Add the key data encapsulation needed for RSN/WPA2 - */ - - // The IE ID - retVal = aniAsfPacketAppend8(packet, ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID); - //CHECK_NO_ERROR(retVal); - - // Obtain the position for the length - aniAsfPacketGetBytesFromTail(packet, &lenPtr); - - // Write out a dummy length - we'll fill this in later. It will be - // 6 bytes more than the length of the GTK - retVal = aniAsfPacketAppend8(packet, 0); - //CHECK_NO_ERROR(retVal); - - // Copy the RSN OUI - retVal = aniAsfPacketAppendBuffer(packet, aniSsmIeRsnOui, sizeof(aniSsmIeRsnOui)); - //CHECK_NO_ERROR(retVal); - - // Indicate that the key type is group key - retVal = aniAsfPacketAppend8(packet, ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID); - //CHECK_NO_ERROR(retVal); - - // Copy the key-id to the first two bits of the next byte - // Copy the Tx bit the third bit of the same byte - // (Here, I assume the Group Key is to be used for both STA Tx and Rx) - retVal = aniAsfPacketAppend8( - packet, - GROUP_KEY_ID ); - //AAG_GROUP_KEY_ID(radioId) ); - //CHECK_NO_ERROR(retVal); - - retVal = aniAsfPacketMoveRight(packet, 1); // Reserved bits (1 byte) - //CHECK_NO_ERROR(retVal); - - // Copy the real key bytes - retVal = aniAsfPacketAppendBuffer(packet, groupKeyBytes, groupKeyLen); - //CHECK_NO_ERROR(retVal); - - // Calculate and enter the length of the entire encoding - aniAsfPacketGetBytesFromTail(packet, &endPtr); - *lenPtr = endPtr - (lenPtr + 1) ; // subtract one to avoid tail - - return retVal; -} - -static int -gotoStatePtkInitNegoTx(tAuthRsnFsm *fsm) -{ - tAniEapolRsnKeyDesc txDesc; - v_BOOL_t retransmit = eANI_BOOLEAN_FALSE; - v_U8_t *rsnWpaIe = NULL; - int rsnWpaIeLen; - static tAniPacket *keyData; - // The longest length...the extra 8 bytes account for RSN key data - // encapsulation - v_U8_t paddedGroupKeyEncaps[1024]; - int padLen = 0; - v_U8_t *groupKeyBytes; - int groupKeyLen; - v_U8_t *wrappedKey = NULL; - // Variables used for RC4 GTK wrap - //v_U8_t keyIv[ANI_EAPOL_KEY_RSN_IV_SIZE]; - //v_U32_t keyIvLsb; - int retVal = 0; - - //invalidate this - fsm->msg4TimeOut = VOS_FALSE; - fsm->currentState = PTK_INIT_NEGO_TX ; - - if (keyData == NULL) - { - // Allocate the packet the first time around that you enter - retVal = aniAsfPacketAllocateExplicit(&keyData, 1024, 10); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } - } - else { - // Just empty out the packet - aniAsfPacketEmptyExplicit(keyData, 10); - } - - do - { - // Create a new EAPOL frame if we don't have one to retransmit - //if (aniAsfPacketGetLen(fsm->lastEapol) == 0) -#if 0 - if( fsm->lastEapol ) - { - aniAsfPacketFree( fsm->lastEapol ); - fsm->lastEapol = NULL; - - retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, - RSN_MAX_PACKET_SIZE, - EAPOL_TX_HEADER_SIZE ); -#endif - aniAsfPacketEmptyExplicit(fsm->lastEapol, - EAPOL_TX_HEADER_SIZE); - // } - - if (1) - { - - vos_mem_zero( &txDesc, sizeof(txDesc) ); - - // The Key Information bits... - if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) - { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; - } - else { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_RC4; - } - txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; - txDesc.info.installFlag = eANI_BOOLEAN_TRUE; - txDesc.info.ackFlag = eANI_BOOLEAN_TRUE; - txDesc.info.micFlag = eANI_BOOLEAN_TRUE; - - txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType); - aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter); - vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce)); - - // Add the RSN IE (but not any WPA IE) - rsnWpaIeLen = getRsnIeFromAdvertizedIes(fsm, &rsnWpaIe); - - if( !ANI_IS_STATUS_SUCCESS( rsnWpaIeLen) ) break; - - retVal = aniAsfPacketAppendBuffer(keyData, rsnWpaIe, rsnWpaIeLen); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - // Add the RSN group key encapsulation - retVal = aagAppendGroupKeyForRsn ( keyData ); - - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - groupKeyLen = aniAsfPacketGetBytes(keyData, &groupKeyBytes); - if( !ANI_IS_STATUS_SUCCESS( groupKeyLen ) ) - { - retVal = ANI_E_FAILED; - break; - } - - txDesc.info.secureFlag = eANI_BOOLEAN_TRUE; - txDesc.info.encKeyDataFlag = eANI_BOOLEAN_TRUE; - - if ( fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES ) - { - /* - * Use the AES key wrap algorithm if either one of the pairwise - * key or the group key is an AES key. - * - * If the key being sent is not a multiple of - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then pad it with - * zeroes. e.g., if we are sending a WEP key of 5 or 13 - * bytes. - */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "AES Key Wrap invoked. groupKeyLen = %d", groupKeyLen); - - padLen = groupKeyLen % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; - if (padLen != 0) { - padLen = ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE - padLen; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Before AES Key Wrap: padLen = %d", padLen); - - if (groupKeyLen + padLen > sizeof(paddedGroupKeyEncaps)) { -#if 0 - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Cannot encode group key encapsulation of len %d and cipher type %s " - "to send to %s %s (aid %d, radio %d, user %s)", - groupKeyLen, - aniSsmIntGetCipherStr(AAG_GROUP_CIPHER(fsm->ctx->radioId)), - (fsm->ctx->bpIndicator ? "BP" : "STA"), - aniAsfHexStr(fsm->ctx->suppMac, sizeof(tAniMacAddr)), - fsm->ctx->aid, - fsm->ctx->radioId, - aagGetStaUserId(fsm->ctx)); -#endif - retVal = ANI_E_FAILED; - } - // OK, after you compute the pad length, you need to - // add the padding - 0xdd followed by 0x00's - addPad( groupKeyBytes , groupKeyLen , padLen ); - // add the padding length - groupKeyLen += padLen; - // IMMEDIATELY adjust the packet size to reflect the pad - aniAsfPacketMoveRight(keyData, padLen); - if( !ANI_IS_STATUS_SUCCESS( retVal) ) break; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Before AES Key Wrap: padded groupKeyLen = %d", groupKeyLen); - - retVal = aniSsmAesKeyWrap(fsm->cryptHandle, groupKeyBytes, groupKeyLen, - fsm->staCtx->ptk + ANI_EAPOL_KEY_RSN_MIC_SIZE, - ANI_EAPOL_KEY_RSN_ENC_KEY_SIZE, - &wrappedKey); - if( !ANI_IS_STATUS_SUCCESS( retVal) ) break; - // This doesn't work... - //groupKeyBytes = wrappedKey; - //groupKeyLen += ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; - // ...here is the right way to do it - // Add the length of the prepended IV A[0] - if (NULL == wrappedKey) - { - break; - } - groupKeyLen += ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; - memcpy( groupKeyBytes, wrappedKey, groupKeyLen); - // Free the array used to hold the wrapped key - if (wrappedKey) vos_mem_free( wrappedKey); - // IMMEDIATELY adjust the packet size to reflect the IV - aniAsfPacketMoveRight(keyData, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - } - else { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth RC4 Key Wrap invoked. groupKeyLen = %d", groupKeyLen); - } - txDesc.keyDataLen = aniAsfPacketGetBytes(keyData, &txDesc.keyData); - - retVal = aniEapolWriteKey(fsm->cryptHandle, - fsm->lastEapol, - fsm->staCtx->suppMac, - fsm->staCtx->authMac, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - &txDesc, - fsm->staCtx->ptk, - CSR_AES_KEY_LEN); - if( !ANI_IS_STATUS_SUCCESS( retVal) ) break; - } - else { - retransmit = eANI_BOOLEAN_TRUE; - } - - if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - retVal = ANI_OK; - } - else - { - //we fail to send the eapol frame disconnect - bapAuthDisconnect( fsm->ctx ); - retVal = ANI_ERROR; - } - - }while( 0 ); - - return retVal; -} - -static int -gotoStatePtkInitDone(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data) -{ - int retVal; - tAniEapolRsnKeyDesc *rxDesc; - tCsrRoamSetKey setKeyInfo; - - fsm->currentState = PTK_INIT_DONE; - - rxDesc = data->keyDesc; - - vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); - setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; - setKeyInfo.keyDirection = eSIR_TX_RX; - vos_mem_copy( setKeyInfo.peerMac, fsm->staCtx->suppMac, sizeof( tAniMacAddr ) ); - setKeyInfo.paeRole = 0; //this is a supplicant - setKeyInfo.keyId = 0; //always - setKeyInfo.keyLength = CSR_AES_KEY_LEN; - vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->staCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); - //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one. - if( VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) - { - //Done - aniAsfPacketEmptyExplicit(fsm->lastEapol, EAPOL_TX_HEADER_SIZE); - retVal = ANI_OK; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Auth: gotoStatePtkInitDone fail to set key\n" ); - retVal = ANI_ERROR; - } - - return retVal; -} - -static int -gotoStateUpdateKeysReq(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data) -{ - tAniEapolRsnKeyDesc *rxDesc; - - fsm->currentState = UPDATE_KEYS_REQ; - - rxDesc = data->keyDesc; - - aniSsmReplayCtrUpdate(fsm->staCtx->peerReplayCtr, rxDesc->replayCounter); - - checkTransition(fsm, data); - - return ANI_OK; -} - -static int -gotoStateIntegFailure(tAuthRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo) -{ - fsm->currentState = INTEG_FAILURE; - - fsm->integFailed = eANI_BOOLEAN_FALSE; - - checkTransition(fsm, NULL); // UCT - - return ANI_OK; -} - -static int -gotoStateKeyUpdate(tAuthRsnFsm *fsm) -{ - fsm->currentState = KEY_UPDATE; - - if( VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes(fsm->cryptHandle, fsm->aNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE) ) ) - { - - // Replay counter will be automatically updated when we create a - // new packet - - checkTransition(fsm, NULL); // UCT - - return ANI_OK; - } - return ANI_ERROR; -} - -static int -gotoStateDisconnect(tAuthRsnFsm *fsm) -{ - fsm->currentState = DISCONNECT; - - //What else do we need to clean up? Or BAP will call our vleanup function? - - // FSM does not exist after this... - bapAuthDisconnect( fsm->ctx ); - - return ANI_OK; -} - -static -int zeroOutPtk(tAuthRsnFsm *fsm) -{ - return ANI_OK; -} - -static -int stopAllTimers(tAuthRsnFsm *fsm) -{ - vos_timer_stop( &fsm->msg2Timer ); - vos_timer_stop( &fsm->msg4Timer ); - - return ANI_OK; -} - -static -int derivePtk(tAuthRsnFsm *fsm, tAniEapolKeyAvailEventData *data) -{ - v_U32_t prfLen; - tAniEapolRsnKeyDesc *rxDesc; - - if (NULL == fsm->staCtx->pmk) - { - VOS_ASSERT(0); - return ANI_E_NULL_VALUE; - } - - switch (fsm->staCtx->pwCipherType) - { - case eCSR_ENCRYPT_TYPE_AES: - prfLen = AAG_RSN_PTK_PRF_LEN_CCMP; - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth cannot generate PTK for invalid algorithm %d\n", - fsm->staCtx->pwCipherType); - return ANI_E_ILLEGAL_ARG; - break; - }; - - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - return aagPtkPrf(fsm->cryptHandle, - fsm->staCtx->ptk, - prfLen, - fsm->staCtx->pmk, - fsm->staCtx->authMac, - fsm->staCtx->suppMac, - fsm->aNonce, - rxDesc->keyNonce); -} - -static int -checkMic(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - int retVal; - - retVal = aniEapolKeyCheckMic(fsm->cryptHandle, - data->eapolFrame, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - data->keyDesc, - fsm->staCtx->ptk, - CSR_AES_KEY_LEN); - - if (retVal == ANI_E_MIC_FAILED) - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth failed EAPOL-MIC check in pairwise key exchange!\n"); - } - - return retVal; -} - -static int -checkLocalReplayCounter(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - int retVal = ANI_E_NULL_VALUE; - int cmp; - tAniEapolRsnKeyDesc *rxDesc; - - rxDesc = data->keyDesc; - if( rxDesc ) - { - cmp = aniSsmReplayCtrCmp(fsm->staCtx->localReplayCtr, rxDesc->replayCounter); - - // The STA should have sent back the same replay ctr as in our request - if (cmp != 0) - { - retVal = ANI_E_REPLAY_CHECK_FAILED; - } - else - { - retVal = ANI_OK; - } - } - - return retVal; -} - -static -int checkPeerReplayCounter(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - int retVal = ANI_E_NULL_VALUE; - int cmp; - tAniEapolRsnKeyDesc *rxDesc; - - rxDesc = data->keyDesc; - if( rxDesc ) - { - cmp = aniSsmReplayCtrCmp(fsm->staCtx->peerReplayCtr, rxDesc->replayCounter); - - // The STA should have sent a newer replay ctr than its old - // request. The first message is exempted from the check. - if (fsm->staCtx->pastFirstPeerRequest && cmp >= 0) - { - retVal = ANI_E_REPLAY_CHECK_FAILED; - } - - fsm->staCtx->pastFirstPeerRequest = eANI_BOOLEAN_TRUE; - } - - return retVal; -} - -static int checkInfoElement(tAuthRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - tAniEapolRsnKeyDesc *desc; - v_U8_t *ieStaBytes; - int ieStaLen; - - desc = (tAniEapolRsnKeyDesc *) data->keyDesc; - if( desc ) - { - ieStaLen = aniAsfPacketGetBytes(fsm->staCtx->ieSta, &ieStaBytes); - if( !ANI_IS_STATUS_SUCCESS( ieStaLen ) ) - { - return ieStaLen; - } - - if ((desc->keyDataLen != ieStaLen) || - ( !vos_mem_compare(desc->keyData, ieStaBytes, ieStaLen-2) )) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth STA sent inconsistent RSN IE!\n"); - return ANI_E_FAILED; - } - // Copy RSN IE - //vos_mem_copy(fsm->advertizedRsnIe, desc->keyData, ieStaLen); - vos_mem_copy(fsm->advertizedRsnIe, ieStaBytes, ieStaLen); - - return ANI_OK; - } - else - { - return ANI_E_NULL_VALUE; - } - -} - -static -int checkTransition(tAuthRsnFsm *fsm, void *arg) -{ - int retVal; - tAniEapolKeyAvailEventData *data; - tAniEapolRsnKeyDesc *rxDesc; - tSirMicFailureInfo *micFailureInfo; - - if (fsm->disconnect) - { - stopAllTimers(fsm); - gotoStateDisconnect(fsm); - return ANI_OK; - } - - if (fsm->authReq) - { - stopAllTimers(fsm); - gotoStateAuthentication(fsm); - return ANI_OK; - } - - switch (fsm->currentState) - { - case INITIALIZE: - break; - case AUTHENTICATION: - gotoStateAuthentication2(fsm); - break; - case AUTHENTICATION_2: - gotoStateGetPsk( fsm ); - break; - case GET_PSK: - //We always have PMK otherwise BAP won't let us here - gotoStatePtkStart(fsm); - break; - case PTK_START: - if ( fsm->eapolAvail ) - { - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - if (NULL == arg) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "arg is NULL, exiting checkTransition()"); - return ANI_E_FAILED; - } - data = (tAniEapolKeyAvailEventData *) arg; - retVal = checkLocalReplayCounter(fsm, data); - if (retVal != ANI_OK) - return ANI_OK; // Caller should not fail - retVal = derivePtk(fsm, data); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth derivePtk failed with code %d!\n", retVal); - return retVal; - } - retVal = checkMic(fsm, data); - if (retVal != ANI_OK) - { - bapAuthDisconnect( fsm->ctx ); - return retVal; - } - retVal = gotoStatePtkInitNego(fsm, arg); - } - else if ( fsm->msg2TimeOut ) - { - if (fsm->numTries <= authConsts.maxTries) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth Retransmitting EAPOL-Key Msg1\n"); - // Stay in the same state but repeat actions - gotoStatePtkStart(fsm); - } - else { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth failed to recv EAPOL-Key Msg2 " - "Disconnecting...\n"); - - gotoStateDisconnect(fsm); - } - } - break; - case PTK_INIT_NEGO: - if (NULL == arg) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "arg is NULL, exiting checkTransition()"); - return ANI_E_FAILED; - } - data = (tAniEapolKeyAvailEventData *) arg; - retVal = checkInfoElement(fsm, data); - if (retVal != ANI_OK) - { - gotoStateDisconnect(fsm); - } - else { - gotoStatePtkInitNegoTx(fsm); - } - break; - case PTK_INIT_NEGO_TX: - if (fsm->eapolAvail) - { - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - if (NULL == arg) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "arg is NULL, exiting checkTransition()"); - return ANI_E_FAILED; - } - data = (tAniEapolKeyAvailEventData *) arg; - retVal = checkLocalReplayCounter(fsm, data); - if (retVal != ANI_OK) - return ANI_OK; // Caller should not fail - retVal = checkMic(fsm, data); - if (retVal != ANI_OK) - { - bapAuthDisconnect( fsm->ctx ); - return retVal; - } - retVal = gotoStatePtkInitDone(fsm, data); - } else if ( fsm->msg4TimeOut ) - { - if (fsm->numTries <= authConsts.maxTries) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth retransmitting EAPOL-Key Msg3 \n"); - // Stay in the same state but repeat actions - gotoStatePtkInitNegoTx(fsm); - } - else { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth failed to recv EAPOL-Key Msg4 " - "Disconnecting...\n" ); - - gotoStateDisconnect(fsm); - } - } - break; - case PTK_INIT_DONE: - if (fsm->eapolAvail) { - - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - if (NULL == arg) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "arg is NULL, exiting checkTransition()"); - return ANI_E_FAILED; - } - data = (tAniEapolKeyAvailEventData *) arg; - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - - if (rxDesc->info.requestFlag) - { - - retVal = checkPeerReplayCounter(fsm, data); - if (retVal != ANI_OK) - return ANI_OK; // Caller should not fail - - retVal = checkMic(fsm, data); - if (retVal != ANI_OK) - { - bapAuthDisconnect( fsm->ctx->pvosGCtx ); - return retVal; - } - - retVal = gotoStateUpdateKeysReq(fsm, arg); - } - } - else if (fsm->integFailed) { - - micFailureInfo = (tSirMicFailureInfo *) arg; - gotoStateIntegFailure(fsm, arg); - - } - break; - case UPDATE_KEYS_REQ: - - if (NULL == arg) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "arg is NULL, exiting checkTransition()"); - return ANI_E_FAILED; - } - data = (tAniEapolKeyAvailEventData *) arg; - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - - if (rxDesc->info.errorFlag) - { - - /* - * This was generated by a unicast packet sent from the AP to the STA/BP. - * The TX address is the AP's address. The src address is lost. - * If the STA is a BP, then the true dst is lost. We will treat - * the dst field as the address of the reporter of the MIC failure. - */ - - micFailureInfo = (tSirMicFailureInfo *) vos_mem_malloc( sizeof(tSirMicFailureInfo) ); - if( NULL == micFailureInfo ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Fail to allocate memory for AuthRsnFsm: %d\n", - fsm->currentState); - return ANI_E_MALLOC_FAILED; - } - - vos_mem_copy(micFailureInfo->taMacAddr, fsm->staCtx->authMac, sizeof(tAniMacAddr)); - vos_mem_copy(micFailureInfo->dstMacAddr, fsm->staCtx->suppMac, sizeof(tAniMacAddr)); - micFailureInfo->multicast = eANI_BOOLEAN_FALSE; - // Copy whatever sequence number came in the EAPOL-key message - vos_mem_copy(micFailureInfo->TSC, rxDesc->keyRecvSeqCounter, SIR_CIPHER_SEQ_CTR_SIZE); - gotoStateIntegFailure(fsm, micFailureInfo); - vos_mem_free(micFailureInfo); - } - else { - // TBD: Untested. Why are local aNonce and local replyCtr not incremented in spec? - gotoStatePtkStart(fsm); - } - break; - case INTEG_FAILURE: - gotoStateKeyUpdate(fsm); - break; - case KEY_UPDATE: - gotoStatePtkStart(fsm); - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Nothing to do in this state for AuthRsnFsm: %d\n", - fsm->currentState); - // Catch all for states that need no change: - // assert(eANI_BOOLEAN_FALSE && "Illegal AuthRsnFsm state!"); - return ANI_E_FAILED; - } - - return ANI_OK; -} - - -static void msg2TimerCallback( void *pv ) -{ - tAuthRsnFsm *fsm = (tAuthRsnFsm *)pv; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return; - } - - //Only when waiting for msg2 - if( PTK_START == fsm->currentState ) - { - fsm->msg2TimeOut = eANI_BOOLEAN_TRUE; - } - //We may need to synchronize this call - authRsnFsmProcessEvent( fsm, RSN_FSM_TIMER_EXPIRED, NULL ); -} - -static void msg4TimerCallback( void *pv ) -{ - tAuthRsnFsm *fsm = (tAuthRsnFsm *)pv; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return; - } - - //Only when we are waiting for msg4 - if( PTK_INIT_NEGO_TX == fsm->currentState ) - { - fsm->msg4TimeOut = eANI_BOOLEAN_TRUE; - } - //We may need to synchronize this call - authRsnFsmProcessEvent( fsm, RSN_FSM_TIMER_EXPIRED, NULL ); -} - - -// -//This function alwasy assume the incoming vos_packet is 802_3 frame. -static int authRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ) -{ - int retVal = ANI_ERROR; - tAniPacket *pAniPacket; - tBtampContext *ctx; - tAuthRsnFsm *fsm; - - /* Validate params */ - if ((pvosGCtx == NULL) || (NULL == pPacket)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "param is NULL in %s", __func__); - - return retVal; - } - - ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx ); - if (NULL == ctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "ctx is NULL in %s", __func__); - - return retVal; - } - - fsm = &ctx->uFsm.authFsm; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return retVal; - } - - do - { - //ToDO: We need to synchronize this. For now, use the simplest form, drop the packet comes later. - if( fsm->fReceiving ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " ******authRsnRxFrameHandler receive eapol packet while processing. Drop the new comer\n" ); - break; - } - fsm->fReceiving = VOS_TRUE; - retVal = bapRsnFormPktFromVosPkt( &pAniPacket, pPacket ); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - //Now we can process the eapol frame - //handler will free the pAniPacket - bapRsnEapolHandler( fsm, pAniPacket, VOS_TRUE ); - }while( 0 ); - - fsm->fReceiving = VOS_FALSE; - vos_pkt_return_packet( pPacket ); - - return retVal; -} - - -static int authRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ) -{ - tBtampContext *ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx ); - tAuthRsnFsm *fsm; - - vos_pkt_return_packet( pPacket ); - if (NULL == ctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "ctx is NULL in %s", __func__); - - return ANI_ERROR; - } - - fsm = &ctx->uFsm.authFsm; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return ANI_ERROR; - } - - if(!VOS_IS_STATUS_SUCCESS( retStatus ) ) - { - //No need to do anything. Retransmit is handled by timeout - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth: TL Tx complete with error %d current state is %d \n", retStatus, fsm->currentState ); - } - if( PTK_START == fsm->currentState ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - " Auth: start msg2 timer\n" ); - //Start msg2Timer - fsm->numTries++; - vos_timer_stop( &fsm->msg2Timer ); - vos_timer_start(&fsm->msg2Timer, authConsts.timeoutPeriod); - } - else if( ( PTK_INIT_NEGO == fsm->currentState ) || - ( PTK_INIT_NEGO_TX == fsm->currentState ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - " Auth: start msg4 timer\n" ); - fsm->numTries++; - vos_timer_stop( &fsm->msg4Timer ); - vos_timer_start(&fsm->msg4Timer, authConsts.timeoutPeriod); - } - - return ANI_OK; -} - - -static int -authEapolKeyHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame, tAniMacAddr staMac ) -{ - int retVal; - - int descType; - void *keyDesc; - tAniEapolRsnKeyDesc *rsnDesc; - tAniEapolKeyAvailEventData data; - - do - { - retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) - { - rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc; - data.keyDesc = keyDesc; - data.eapolFrame = eapolFrame; - // Pass on the event to the RSN FSM only if it is for a pairwise key - if (rsnDesc->info.unicastFlag) - { - retVal = authRsnFsmProcessEvent(fsm, - RSN_FSM_EAPOL_FRAME_AVAILABLE, - &data); - } - else { - //Not worry about GTK stuff - } - } - else { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Got unexpected legacy 802.1x RC4 Key message \n" ); - retVal = ANI_E_FAILED; - break; - } - }while( 0 ); - - aniEapolKeyFreeDesc(descType, keyDesc); - return retVal; -} - - -void authEapolHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - v_U8_t *type) -{ - switch (*type) - { - case ANI_EAPOL_TYPE_START: - //No doing anything because we only support WPA2-PSK - break; - case ANI_EAPOL_TYPE_LOGOFF: - //ignore - break; - case ANI_EAPOL_TYPE_KEY: - authEapolKeyHandler(fsm, eapolFrame, srcMac); - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Auth: EAPOL type not implemented: 0x%.2x\n", *type); - break; - } -} diff --git a/CORE/BAP/src/bapRsn8021xAuthFsm.h b/CORE/BAP/src/bapRsn8021xAuthFsm.h deleted file mode 100644 index 9758cca7a675..000000000000 --- a/CORE/BAP/src/bapRsn8021xAuthFsm.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xAuthRsnFsm.h $ - * - * Contains declarations for the RSN EAPOL-Key FSM on the - * authenticator side. This is based on 802.11i. - * - * Author: Mayank D. Upadhyay - * Date: 19-December-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef __AAG_AUTH_RSN_FSM_H -#define __AAG_AUTH_RSN_FSM_H - -#include "vos_types.h" -#include "vos_timer.h" - -#include "bapInternal.h" -#include "bapRsn8021xFsm.h" - - - -/** - * authRsnFsmInit - * - * FUNCTION: - * Initializes the constants and the callbacks needed by this FSM - * module. - * - * @param consts the various constant values needed by this FSM - * @param cb callbacks to the various procedures needed by this FSM - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmInit(tAuthRsnFsmConsts *consts); - -/** - * authRsnFsmCreate - * - * FUNCTION - * Allocates and initializes the state of an RSN key FSM instance for - * the given STA context. - * - * @parm ctx the STA context whose instance is being created - * @param pskBased pass in eANI_BOOLEAN_TRUE is this STA is to be - * authenticated based on a pre-shared key as opposed to EAP. - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmCreate(tBtampContext *ctx); - - - -int -authRsnFsmSetPmk(tStaContext *ctx, v_U8_t *pmk); - -#endif //__AAG_AUTH_RSN_FSM_H diff --git a/CORE/BAP/src/bapRsn8021xFsm.h b/CORE/BAP/src/bapRsn8021xFsm.h deleted file mode 100644 index bbfab979d8d6..000000000000 --- a/CORE/BAP/src/bapRsn8021xFsm.h +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xFsm.h $ - * Contains the declarations for the Auth Agent's FSM's to work. - * - * Author: Mayank D. Upadhyay - * Date: 21-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef __AAG_FSM_H_ -#define __AAG_FSM_H_ - -#include "vos_types.h" -#include "vos_trace.h" -#include "vos_timer.h" -#include <bapRsnSsmReplayCtr.h> -#include <bapRsnAsfPacket.h> -#include <bapRsnSsmEapol.h> -#include "bapRsn8021xPrf.h" -//#include "bapInternal.h" -#include "csrApi.h" - -typedef struct sBtampContext tBtampContext; -typedef struct tStaContext tStaContext; -typedef struct tSuppContext tSuppContext; - -#define RSN_MAX_PACKET_SIZE 512 -#define RSN_80211_KEY_LEN 16 -#define RSN_IE_MAX_PACKET_SIZE 256 -#define RSN_IE_HEADER_SIZE 0 -#define ACCTG_SESSION_ID_SIZE 8 -#define ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE 8 // Bytes - -#define BAP_SET_RSN_KEY 1 -#define BAP_RESET_RSN_KEY 0 - - -#define AAG_ACL_LOOKUP_NEEDED(ctx) \ - ((ctx)->authType == eANI_SSM_AT_NONE || \ - (ctx)->authType == eANI_SSM_AT_RSN_PSK || \ - (ctx)->authType == eANI_SSM_AT_SHARED_KEY) - -#define AAG_ACL_LOOKUP_PENDING(ctx) \ - ((ctx)->aclLookupFsm != NULL && (ctx)->radiusInfo.req != NULL) - -#define AAG_STA_AWAITING_CLEANUP(ctx) \ - ((ctx)->ssid == NULL) - -#define AAG_MARK_STA_AS_AWAITING_CLEANUP(ctx) \ - ((ctx)->ssid = NULL) - -/************************ - * AuthRsnFsm structure: - *************************/ -typedef struct tagAuthRsnFsm -{ - v_U8_t currentState; - - tBtampContext *ctx; - tStaContext *staCtx; - - // Variables used for EAPOL-Key messages - v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]; - v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]; - - // Flags set by external events - v_U8_t authReq; - v_U8_t eapolAvail; - v_U8_t disconnect; - v_U8_t integFailed; - v_U8_t pmkAvailable; - - // Variables maintained internally - v_U8_t numTries; - tAniPacket *lastEapol; //Tx - v_BOOL_t fReceiving; - v_U32_t cryptHandle; - - // Timers used..alternate them in different states - vos_timer_t msg2Timer; - vos_timer_t msg4Timer; - v_BOOL_t msg2TimeOut; - v_BOOL_t msg4TimeOut; - v_U8_t advertizedRsnIe[256]; -} tAuthRsnFsm; - -/************************ - * SuppRsnFsm structure: - *************************/ - -typedef struct tagSuppRsnFsm { - - v_U8_t currentState; - - tBtampContext *ctx; - tSuppContext *suppCtx; - - // Variables used for EAPOL-Key messages - tAniSsmReplayCtr *localReplayCtr; - tAniSsmReplayCtr *peerReplayCtr; - v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]; - v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]; - - // Flags set by external events - v_U8_t authReq; - v_U8_t pmkAvail; - v_U8_t eapolAvail; - v_U8_t integFailed; - v_U8_t updateKeys; - - // Variables maintained internally - int numTries; - tAniPacket *lastEapol; - v_BOOL_t fReceiving; - v_U32_t cryptHandle; -} tSuppRsnFsm; - - -typedef struct sAagZoneEntry tAagZoneEntry; -typedef struct sAagSsidEntry tAagSsidEntry; - -typedef enum -{ - //Internal to RSN - //This event is triggered by RSN’s timers - RSN_FSM_TIMER_EXPIRED, - //BAP use this event to inform auth/supp to start processing - //authentication. When BAP send this event to RSN, it is presumed - //that the PMK is available. - RSN_FSM_AUTH_START, - //Internal to RSN - //This event is triggered by the Rx routine when called by TL - RSN_FSM_EAPOL_FRAME_AVAILABLE, - //BAP use this event to inform RSN that the connection is lost - RSN_FSM_DISCONNECT, - //Internal to RSN - //This event hannpens when RSN detect key integraty check fails - RSN_FSM_INTEG_FAILED, - -}tRsnFsmEvent; - -/** - * Stores information about an EAP message that was last received or - * EAPOL messages that were last sent. - * - * 1. EAP messages last received are stripped out of their outer - * encapsulation which may be either EAPOL or RADIUS, and are - * preserved within this structure for the lifetime of one event: - * - EAPOL_MESSAGE_AVAILABLE => process and send to RADIUS - * - RADIUS_MESSAGE_AVAILABLE => process and send to STA - * When the event is fully handled, the incoming packet is freed, - * therefore, the contents of this structure are no longer valid. - * - * 2. EAPOL messages last sent are stored in their entirety. They are - * created and delete a little differently on the AP and BP sides: - * - AP side: The EAPOL message contains the last EAP message - * that was sent to the STA. As soon as a new EAP message arrives - * from RADIUS, this EAPOL mesage is freed because a new one will - * be generated. - * - BP side: The EAPOL message contains the last EAP message - * generated by the local supplicant. As soon as a new EAPOL - * message is generated, this one is freed and the new one is - * stored. - */ -typedef struct tEapInfo - -{ - tAniPacket *message; - v_U8_t id; -} tEapInfo; - - -typedef enum eAniSsmAuthState { - eANI_SSM_AUTH_STATE_INIT = 0, - eANI_SSM_AS_PW_KEY_CONF_AWAITED, - eANI_SSM_AS_PW_KEY_SET, -} tAniSsmAuthState; - - -/** - * The Station's context is stored in this structure. It contains - * pointers to the FSM's used by the STA (which in turn point back to - * the context). It also contains the transient event data like - * EAP-Message and RADIUS state that is obtained from various network - * packets. - */ -struct tStaContext { - - // STA identification information - tAniMacAddr suppMac; - v_BOOL_t bpIndicator; - - // Local association point - tAniMacAddr authMac; - v_U8_t ssidName[SIR_MAC_MAX_SSID_LENGTH + 1]; - tAagSsidEntry *ssid; - - // The different FSM's that can be instantiated for the STA - tAuthRsnFsm *authRsnFsm; - - // Keys derived for STA - v_U8_t ptk[AAG_PRF_MAX_OUTPUT_SIZE]; - tAniPacket *pmk; // MS-MPPE-Recv-Key - tAniPacket *serverKey; // MS-MPPE-Send-Key - v_U8_t keyId; - - // STA context timers - v_U32_t sessionTimeout; - vos_timer_t reAuthTimer; - vos_timer_t sessionCleanupTimer; - - // Radius Authentication attributes - v_U8_t *authClassAttr; - - // Misc. authentication related state - eCsrAuthType authType; - eCsrEncryptionType pwCipherType; - tAniPacket *ieSta; - tAniSsmAuthState authState; - v_BOOL_t prmLookupInProgress; - v_BOOL_t firstTimeAuth; - v_BOOL_t secureLink; // 4-way h/s requries this to be 0 at startup or on MIC failures - tAniSsmReplayCtr *localReplayCtr; - tAniSsmReplayCtr *peerReplayCtr; // Goes hand in hand with flag below - v_BOOL_t pastFirstPeerRequest; // For use with peer replay counter - - tAniPacket *cachedPmk; // MS-MPPE-Recv-Key - tAniPacket *cachedServerKey; // MS-MPPE-Send-Key - v_U8_t cachedKeyId; - -}; - - -struct tSuppContext { - - // AP (peer) identification information - tAniMacAddr authMac; - v_U8_t *ssidStr; - - // Local association point - tAniMacAddr suppMac; - - // Keys derived on supplicant - v_U8_t ptk[AAG_PRF_MAX_OUTPUT_SIZE]; - v_U8_t pwKeyLen; // # of bytes of PTK to send to LIM - tAniPacket *pmk; // MS-MPPE-Recv-Key - tAniPacket *serverKey; // MS-MPPE-Send-Key - - // Misc. authentication related state - eCsrAuthType authType; - eCsrEncryptionType pwCipherType; - eCsrEncryptionType grpCipherType; - tAniPacket *ieBp; - tAniPacket *ieAp; - v_BOOL_t firstTimeAuth; - -}; - -typedef struct tAniEapolKeyAvailEventData { - void *keyDesc; - tAniPacket *eapolFrame; -} tAniEapolKeyAvailEventData; - -typedef struct tAniAagTimerEventData { - vos_timer_t timer; - void *appData; -} tAniAagTimerEventData; - - -/** - * Callback funtion that sets some status for a given STA context, - * e.g., the status of the controlled port. - */ -#if 0 -typedef int (*tAagSetStatus)(tStaContext *ctx); - -typedef int (*tAagTxEapolSupp)(tSuppContext *ctx); -typedef int (*tAagSetStatusSupp)(tSuppContext *ctx); -typedef int (*tAagSendEventToFsmSupp)(tSuppContext *ctx); -#endif - -/** - * Callback function that posts a XXX_TIMER_EXPIRED event when a timer - * goes off. XXX represents the kind of timer that caused the event. - */ -typedef void (*tAagTimerCallback)(void *data); - -/** - * Callbacks provided to the GroupKeyFsm module from the FSM Manager - * module so that it can access procedures needed for network - * transmission, inter-FSM signalling, and communication with the main - * application. - */ -/*typedef struct tGroupKeyFsmCallbacks { - int (*getDefaultWepKeyId)(v_U32_t radioId); - int (*copyDefaultWepKey)(v_U32_t radioId); - int (*updateAllSta)(v_U32_t radioId); -} tGroupKeyFsmCallbacks;*/ - -/** - * This structure stores contants used by the AuthFsm as defined in - * [802.1X]. - */ -typedef struct tAuthFsmConsts { - // Amount of time to ignore a misbehaving STA - v_U16_t quietPeriod; - // Number of reauthentication attempts allowed before ignoring STA - v_U8_t reAuthMax; - // Amount of time to wait for response from STA - v_U16_t txPeriod; -} tAuthFsmConsts; - - - -/** - * This structure stores constants used by the AuthRsnFsm as defined in - * [802.11i]. - */ -typedef struct tAuthRsnFsmConsts { - v_U32_t timeoutPeriod; - v_U32_t maxTries; -} tAuthRsnFsmConsts; - - -/** - * This structure stores contants used by the SuppFsm as defined in - * [802.1X]. - */ -typedef struct tSuppFsmConsts { - v_U16_t authPeriod; - v_U16_t heldPeriod; - v_U16_t startPeriod; - v_U8_t maxStart; -} tSuppFsmConsts; - -/** - * This structure stores constants used by the SuppRsnFsm as defined in - * [802.11i]. - */ -typedef struct tSuppRsnFsmConsts { - v_U32_t timeoutPeriod; - v_U32_t maxTries; -} tSuppRsnFsmConsts; - - -/** - * This structure stores constants used by the AuthRsnGroupKeyFsm as - * defined in [802.11i]. - */ -typedef struct tAuthRsnGroupKeyFsmConsts { - v_U32_t timeoutPeriod; - v_U32_t maxTries; -} tAuthRsnGroupKeyFsmConsts; - -/** - * authRsnFsmFree - * - * FUNCTION - * Frees a previously allocated RSN Key FSM in a STA context. If the - * RSN Key FSM is not yet allocated, then this is an error. - * - * @param ctx the STA context whose FSM instance is to be freed - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmFree(tBtampContext *ctx); - -/** - * authRsnFsmProcessEvent - * - * FUNCTION - * Passes an event to the RSN key FSM instance for immediate processing. - * - * @param fsm the RSN Key FSM instance - * @param eventId the AAG event to process - * @param arg an optional argument for this event - * - * @return ANI_OK if the operation succeeds - */ -int -authRsnFsmProcessEvent(tAuthRsnFsm *fsm, tRsnFsmEvent eventId, void *arg); - - -/** - * suppFsmCreate - * - * FUNCTION - * Allocates and initializes the state of an SuppFsm instance for the - * given STA context. - * - * @parm ctx the supplicant context whose SuppFsm is being created - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmCreate(tBtampContext *ctx); - -/** - * suppFsmFree - * - * FUNCTION - * Frees a previously allocated SuppFsm. - * - * @param suppCtx the supplicant context whose suppFsm is to be freed - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmFree(tBtampContext *ctx); - -/** - * suppFsmProcessEvent - * - * FUNCTION - * Passes an event to the suppFsm for immediate processing. - * - * Note: The pertinent event data is already stored in the context. - * - * @param suppFsm the suppFsm - * @param eventId the AAG event to process - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmProcessEvent(tSuppRsnFsm *fsm, tRsnFsmEvent eventId, void *arg); - -#endif // __AAG_FSM_H_ diff --git a/CORE/BAP/src/bapRsn8021xPrf.c b/CORE/BAP/src/bapRsn8021xPrf.c deleted file mode 100644 index 156f7f6b99d7..000000000000 --- a/CORE/BAP/src/bapRsn8021xPrf.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xPrf.c $ - * - */ -/* - * Contains definitions for routines to calculate the 802.11i PRF - * functions. - * - * Author: Mayank D. Upadhyay - * Date: 19-March-2003 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - */ - -/*#include <assert.h> -#include <stdlib.h> -#include <aniSsmSha1.h> -*/ -#include "vos_utils.h" -#include "vos_memory.h" -#include "bapRsn8021xPrf.h" -#include "bapRsnErrors.h" -//#include "ani8021xUtils.h" - -#define AAG_PTK_PRF_ADD_PARAM 159 -#define AAG_PTK_PRF_DIV_PARAM 160 - -#define AAG_PTK_PRF_CONST "Pairwise key expansion" -#define AAG_PTK_PRF_CONST_LEN 22 - -#define AAG_PTK_PRF_LM_POS 0 -#define AAG_PTK_PRF_HM_POS 6 -#define AAG_PTK_PRF_LN_POS 12 -#define AAG_PTK_PRF_HN_POS (AAG_PTK_PRF_LN_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE) - -#define AAG_PTK_PRF_TEXT_LEN (AAG_PTK_PRF_HN_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE) - -#define AAG_GTK_PRF_CONST "Group key expansion" -#define AAG_GTK_PRF_CONST_LEN 19 - -#define AAG_GTK_PRF_MAC_POS 0 -#define AAG_GTK_PRF_NONCE_POS 6 - -#define AAG_GTK_PRF_TEXT_LEN (AAG_GTK_PRF_NONCE_POS + ANI_EAPOL_KEY_RSN_NONCE_SIZE) - -/** - * aagGetKeyMaterialLen - * - * Returns the number of bytes of the PTK that have to be provided to - * the MAC layer for a given cipher type. - * - * @param cipherType the cipher-type - * - * @return the number of bytes of key material for this cipher type, - * or 0 for invalid cipher types. - */ -int -aagGetKeyMaterialLen(eCsrEncryptionType cipherType) -{ - switch (cipherType) { - case eCSR_ENCRYPT_TYPE_AES: - return AAG_RSN_KEY_MATERIAL_LEN_CCMP; - break; - default: - return 0; - break; - }; -} - -/** - * aagPtkPrf - * - * The PRF used for calculating the pairwise temporal key under IEEE - * 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param prfLen the number of BITS desired from the PRF result - * @param pmk the pairwise master-key - * @param authAddr the MAC address of the authenticator - * @param suppAddr the MAC address of the supplicant - * @param aNonce the nonce generated by the authenticator - * @param sNonce the nonce generated by the supplicant - * - * @return ANI_OK if the operation succeeds - */ -int -aagPtkPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U32_t prfLen, - tAniPacket *pmk, - tAniMacAddr authAddr, - tAniMacAddr suppAddr, - v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE], - v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]) -{ - v_U8_t *lowMac; - v_U8_t *highMac; - v_U8_t *lowNonce; - v_U8_t *highNonce; - - v_U8_t *keyBytes; - int keyLen; - - v_U8_t text[AAG_PTK_PRF_TEXT_LEN]; - - //Cannot use voss function here because vos_mem_compare doesn't tell whihc is larger - if (vos_mem_compare2(authAddr, suppAddr, sizeof(tAniMacAddr)) < 0) { - lowMac = authAddr; - highMac = suppAddr; - } else { - lowMac = suppAddr; - highMac = authAddr; - } - - if (vos_mem_compare2(aNonce, sNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE) < 0) { - lowNonce = aNonce; - highNonce = sNonce; - } else { - lowNonce = sNonce; - highNonce = aNonce; - } - - vos_mem_copy(text + AAG_PTK_PRF_LM_POS, lowMac, sizeof(tAniMacAddr)); - vos_mem_copy(text + AAG_PTK_PRF_HM_POS, highMac, sizeof(tAniMacAddr)); - vos_mem_copy(text + AAG_PTK_PRF_LN_POS, lowNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE); - vos_mem_copy(text + AAG_PTK_PRF_HN_POS, highNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE); - - keyLen = aniAsfPacketGetBytes(pmk, &keyBytes); - if( !ANI_IS_STATUS_SUCCESS( keyLen ) ) - { - return keyLen; - } - - return aagPrf(cryptHandle, - result, - keyBytes, keyLen, - (v_U8_t *)AAG_PTK_PRF_CONST, AAG_PTK_PRF_CONST_LEN, - text, sizeof(text), - prfLen); -} - -/** - * aagGtkPrf - * - * The PRF used for calculating the group temporal key under IEEE - * 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param prfLen the number of BITS desired from the PRF result - * @param gmk the group master-key - * @param authAddr the MAC address of the authenticator - * @param gNonce the nonce generated by the authenticator for this purpose - * - * @return ANI_OK if the operation succeeds - */ -int -aagGtkPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U32_t prfLen, - v_U8_t gmk[AAG_RSN_GMK_SIZE], - tAniMacAddr authAddr, - v_U8_t gNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]) -{ - v_U8_t text[AAG_GTK_PRF_TEXT_LEN]; - - vos_mem_copy(text + AAG_GTK_PRF_MAC_POS, authAddr, sizeof(tAniMacAddr)); - vos_mem_copy(text + AAG_GTK_PRF_NONCE_POS, gNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE); - - return aagPrf(cryptHandle, - result, - gmk, AAG_RSN_GMK_SIZE, - (v_U8_t *)AAG_GTK_PRF_CONST, AAG_GTK_PRF_CONST_LEN, - text, sizeof(text), - prfLen); - -} - -/** - * aagPrf - * - * The raw PRF function that is used in IEEE 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param key the key to use in the PRF - * @param keyLen the length of the key - * @param a the parameter A which is usually a unique label - * @param aLen the length of the parameter A - * @ param b the parameter B - * @param bLen the length of parameter B - * @param prfLen the number to BITS desired from the PRF result - * - * @return ANI_OK if the operation succeeds - */ -int -aagPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U8_t *key, v_U8_t keyLen, - v_U8_t *a, v_U8_t aLen, - v_U8_t *b, v_U8_t bLen, - v_U32_t prfLen) -{ - static v_U8_t y; - - v_U8_t *hmacText = NULL; - v_U8_t *resultOffset = result; - int numLoops; - int loopCtrPos; - int i, retVal=0; - - hmacText = vos_mem_malloc( aLen + bLen + 2 ); - if( NULL == hmacText ) - { - return ANI_E_NULL_VALUE; - } - - vos_mem_copy(hmacText + 0, a, aLen); - hmacText[aLen] = y; - vos_mem_copy(hmacText + aLen + 1, b, bLen); - loopCtrPos = aLen + 1 + bLen; - - numLoops = prfLen + AAG_PTK_PRF_ADD_PARAM; - numLoops /= AAG_PTK_PRF_DIV_PARAM; - - for (i = 0; i < numLoops; i++) - { - if ((resultOffset - result + VOS_DIGEST_SHA1_SIZE) > AAG_PRF_MAX_OUTPUT_SIZE) - { - VOS_ASSERT(0); - return ANI_ERROR; - } - - hmacText[loopCtrPos] = i; - if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, hmacText, loopCtrPos + 1, key, keyLen, resultOffset) ) ) - { - resultOffset += VOS_DIGEST_SHA1_SIZE; - retVal = ANI_OK; - } - else - { - retVal = ANI_ERROR; - } - } - - vos_mem_free(hmacText); - - return retVal; -} diff --git a/CORE/BAP/src/bapRsn8021xPrf.h b/CORE/BAP/src/bapRsn8021xPrf.h deleted file mode 100644 index de4ffea3a482..000000000000 --- a/CORE/BAP/src/bapRsn8021xPrf.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xPrf.h $ - * - */ -/* - * Contains declarations for routines to calculate the 802.11i PRF - * functions. - * - * Author: Mayank D. Upadhyay - * Date: 19-March-2003 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - */ - -#ifndef __AAG_PRF_H_ -#define __AAG_PRF_H_ - -#include "vos_types.h" -#include <bapRsnAsfPacket.h> -#include <bapRsnSsmEapol.h> -#include "csrApi.h" - - -/* - * Define the maximum size needed for the result array so that SHA-1 - * overflow is accounted for. - */ -#define AAG_PRF_MAX_OUTPUT_SIZE 80 - -#define AAG_RSN_PTK_TK1_OFFSET \ - (AAG_RSN_EAPOL_MIC_KEY_LEN + AAG_RSN_EAPOL_ENC_KEY_LEN) - -// Pairwise key related definitions... - -#define AAG_RSN_PTK_PRF_LEN_TKIP 512 //bits -#define AAG_RSN_PTK_PRF_LEN_CCMP 384 //bits -#define AAG_RSN_PTK_PRF_LEN_WEP104 384 //bits -#define AAG_RSN_PTK_PRF_LEN_WEP40 384 //bits - -// Group key related definitions... - -#define AAG_RSN_GMK_SIZE 16 - -#define AAG_RSN_GTK_PRF_LEN_TKIP 256 //bits -#define AAG_RSN_GTK_PRF_LEN_CCMP 128 //bits -#define AAG_RSN_GTK_PRF_LEN_WEP104 128 //bits -#define AAG_RSN_GTK_PRF_LEN_WEP40 128 //bits - -// Key material length that is sent to the MAC layer... - -#define AAG_RSN_KEY_MATERIAL_LEN_CCMP 16 -#define AAG_RSN_KEY_MATERIAL_LEN_TKIP 32 -#define AAG_RSN_KEY_MATERIAL_LEN_WEP104 13 -#define AAG_RSN_KEY_MATERIAL_LEN_WEP40 5 - -/** - * aagGetKeyMaterialLen - * - * Returns the number of bytes of the PTK that have to be provided to - * the MAC layer for a given cipher type. - * - * @param cipherType the cipher-type - * - * @return the number of bytes of key material for this cipher type, - * or 0 for invalid cipher types. - */ -int -aagGetKeyMaterialLen(eCsrEncryptionType cipherType); - -/** - * aagPtkPrf - * - * The PRF used for calculating the pairwise temporal key under IEEE - * 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param prfLen the number of BITS desired from the PRF result - * @param pmk the pairwise master-key - * @param authAddr the MAC address of the authenticator - * @param suppAddr the MAC address of the supplicant - * @param aNonce the nonce generated by the authenticator - * @param sNonce the nonce generated by the supplicant - * - * @return ANI_OK if the operation succeeds - */ -int -aagPtkPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U32_t prfLen, - tAniPacket *pmk, - tAniMacAddr authAddr, - tAniMacAddr suppAddr, - v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE], - v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]); - - -/** - * aagGtkPrf - * - * The PRF used for calculating the group temporal key under IEEE - * 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param prfLen the number of BITS desired from the PRF result - * @param gmk the group master-key - * @param authAddr the MAC address of the authenticator - * @param gNonce the nonce generated by the authenticator for this purpose - * - * @return ANI_OK if the operation succeeds - */ -int -aagGtkPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U32_t prfLen, - v_U8_t gmk[AAG_RSN_GMK_SIZE], - tAniMacAddr authAddr, - v_U8_t gNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]); - -/** - * aagPrf - * - * The raw PRF function that is used in IEEE 802.11i. - * - * @param result a fixed size array where the outputis stored. Should - * have enough place for the SHA-1 overflow. - * @param key the key to use in the PRF - * @param keyLen the length of the key - * @param a the parameter A which is usually a unique label - * @param aLen the length of the parameter A - * @ param b the parameter B - * @param bLen the length of parameter B - * @param prfLen the number to BITS desired from the PRF result - * - * @return ANI_OK if the operation succeeds - */ -int -aagPrf(v_U32_t cryptHandle, - v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE], - v_U8_t *key, v_U8_t keyLen, - v_U8_t *a, v_U8_t aLen, - v_U8_t *b, v_U8_t bLen, - v_U32_t prfLen); - -#endif //__AAG_PRF_H_ diff --git a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c deleted file mode 100644 index 6071ab73a70c..000000000000 --- a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c +++ /dev/null @@ -1,1166 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xSuppRsnFsm.c $ - * - */ -/* - * Contains definitions for the RSN EAPOL-Key FSM on the - * supplicant side. This is based on 802.11i. - * - * Author: Mayank D. Upadhyay - * Date: 19-December-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#include "bapRsnSsmServices.h" -#include "bapRsnSsmEapol.h" -#include "bapRsnErrors.h" -#include "bapRsn8021xSuppRsnFsm.h" -#include "vos_utils.h" -#include "bapRsnTxRx.h" -#include "btampFsm.h" - -// The different states that this FSM transitions through -#define INITIALIZE 0 -#define AUTHENTICATION 1 -#define GOT_PMK 2 -#define STA_KEY_START 3 -#define STA_KEY_SET 4 -#define KEY_UPDATE 5 -#define REKEY_MSG 6 -#define GROUP_KEY_SET 7 -#define NUM_STATES (GROUP_KEY_SET + 1) - - -static tSuppRsnFsmConsts suppConsts = { 2000, 3 }; //timeout, retry limit - -int gReadToSetKey; - -/************************************** - * Static functions in this module - **************************************/ - -static -int zeroOutPtk(tSuppRsnFsm *fsm); - -static -int checkMic(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t pwKeyExchange); - -static int checkInfoElement(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - -static -int checkPeerReplayCounter(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t *retransmit, - v_BOOL_t actualMicFlag, - v_BOOL_t reTxMicFlag - ); - -static -int derivePtk(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data); - -static -int checkTransition(tSuppRsnFsm *fsm, void *arg); - -static int -gotoStateInit(tSuppRsnFsm *fsm); - -static int suppRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ); -static int suppRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ); - -/************************* - * Internal Functions - *************************/ -int suppRsnAuthStartEventHandler(tSuppRsnFsm *fsm); - -/************************* - * The exported functions - *************************/ - -/** - * suppRsnFsmInit - * - * FUNCTION: - * Initializes the constants and the callbacks needed by this FSM - * module. - * - * @param cb callbacks to the various procedures needed by this FSM - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmInit(void) -{ - // TODO: Read the constants in from config - // consts = constsIn; - suppConsts.timeoutPeriod = 2000; - suppConsts.maxTries = 3; - - return ANI_OK; -} - -/** - * suppRsnFsmCreate - * - * FUNCTION - * Allocates and initializes the state of an RSN key FSM instance for - * the given BP context. - * - * @parm ctx the BP context whose instance is being created - * @param pskBased pass in eANI_BOOLEAN_TRUE is this BP is to be - * authenticated based on a pre-shared key as opposed to EAP. - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmCreate(tBtampContext *ctx) -{ - int retVal = ANI_OK; - tSuppRsnFsm *fsm = &ctx->uFsm.suppFsm; - - // First, clear everything out - vos_mem_zero( fsm, sizeof(tSuppRsnFsm)); - - if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( suppRsnTxCompleteHandler, - suppRsnRxFrameHandler ) ) ) - { - return ANI_ERROR; - } - - if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) ) - { - return ANI_ERROR; - } - - // Allocate the supplicant context - fsm->suppCtx = (tSuppContext *)vos_mem_malloc( sizeof(tSuppContext) ); - if (fsm->suppCtx == NULL) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - // Clear out the supplicant context - vos_mem_zero( fsm->suppCtx, sizeof(tSuppContext)); - - fsm->ctx = ctx; - //Only support CCMP - fsm->suppCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES; - - retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, - RSN_MAX_PACKET_SIZE, - EAPOL_TX_HEADER_SIZE); - if (retVal != ANI_OK) - { - VOS_ASSERT( 0 ); - goto error; - } - - aniAsfPacketAllocate(&fsm->suppCtx->pmk); - if (fsm->suppCtx->pmk == NULL) - { - retVal = ANI_E_MALLOC_FAILED; - VOS_ASSERT( 0 ); - goto error; - } - - fsm->suppCtx->ieAp = NULL; - - fsm->cryptHandle = 0; - if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) ) - { - retVal = ANI_E_FAILED; - VOS_ASSERT( 0 ); - } - - fsm->currentState = INITIALIZE; - gotoStateInit(fsm); - - suppRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL ); - - return ANI_OK; - - error: - suppRsnFsmFree( ctx ); - - return retVal; - -} - -/** - * suppRsnFsmFree - * - * FUNCTION - * Frees a previously allocated RSN Key FSM in a BP context. If the - * RSN Key FSM is not yet allocated, then this is an error. - * - * @param ctx the BP context whose FSM instance is to be freed - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmFree(tBtampContext *ctx) -{ - tSuppRsnFsm *fsm; - - fsm = &ctx->uFsm.suppFsm; - - if( fsm->cryptHandle ) - { - vos_crypto_deinit( fsm->cryptHandle ); - } - - bapRsnClearTxRxCallbacks(); - - if (fsm->lastEapol) - aniAsfPacketFree(fsm->lastEapol); - - if( fsm->suppCtx ) - { - if ( fsm->suppCtx->pmk ) - { - aniAsfPacketFree(fsm->suppCtx->pmk); - } - vos_mem_free( fsm->suppCtx ); - } - - // Finally, clear everything out - vos_mem_zero( fsm, sizeof(tSuppRsnFsm)); - - return ANI_OK; -} - -/** - * suppRsnFsmProcessEvent - * - * FUNCTION - * Passes an event to the RSN key FSM instance for immediate processing. - * - * @param fsm the RSN Key FSM instance - * @param eventId the AAG event to process - * @param arg an optional argument for this event - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmProcessEvent(tSuppRsnFsm *fsm, tRsnFsmEvent eventId, void *arg) -{ - - switch (eventId) - { - case RSN_FSM_TIMER_EXPIRED: - // Proceed straight to checkTransition - break; - case RSN_FSM_AUTH_START: - fsm->authReq = eANI_BOOLEAN_TRUE; - suppRsnAuthStartEventHandler(fsm); - break; - case RSN_FSM_EAPOL_FRAME_AVAILABLE: - fsm->eapolAvail = eANI_BOOLEAN_TRUE; - break; - case RSN_FSM_INTEG_FAILED: - fsm->integFailed = eANI_BOOLEAN_TRUE; - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp unknown event for SuppFsm: %d\n", - eventId); - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - break; - } - - checkTransition(fsm, arg); - - return ANI_OK; -} - -int -suppRsnAuthStartEventHandler(tSuppRsnFsm *fsm) -{ - // Copy required info - vos_mem_copy( &fsm->suppCtx->authMac, fsm->ctx->peer_mac_addr, 6); - vos_mem_copy( &fsm->suppCtx->suppMac, fsm->ctx->self_mac_addr, 6); - aniAsfPacketAppendBuffer( fsm->suppCtx->pmk, fsm->ctx->key_material, fsm->ctx->key_length); - - return ANI_OK; -} - -/*********************** - * The static functions - ***********************/ - -static int -gotoStateInit(tSuppRsnFsm *fsm) -{ - fsm->currentState = INITIALIZE; - - fsm->authReq = eANI_BOOLEAN_FALSE; - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - fsm->integFailed = eANI_BOOLEAN_FALSE; - fsm->pmkAvail = eANI_BOOLEAN_FALSE; - - // Create two replay counter's..one for our requests, and another - // for STA's requests. Initialize the first one randomly. - aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->localReplayCtr, ANI_EAPOL_KEY_RSN_RSC_SIZE, 0); - aniSsmReplayCtrCreate(fsm->cryptHandle, &fsm->peerReplayCtr, ANI_EAPOL_KEY_RSN_RSC_SIZE, 0); - - return ANI_OK; -} - -static int -gotoStateAuthentication(tSuppRsnFsm *fsm) -{ - fsm->currentState = AUTHENTICATION; - - if( VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( fsm->cryptHandle, fsm->sNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE ) ) ) - { - zeroOutPtk(fsm); - // TODO: Zero out all GTK's - fsm->authReq = eANI_BOOLEAN_FALSE; - /////getPmk(fsm->suppCtx); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp fail to random number\n" ); - return ANI_ERROR; - } - - return ANI_OK; -} - -static int -gotoStateGotPmk(tSuppRsnFsm *fsm) -{ - fsm->currentState = GOT_PMK; - - return ANI_OK; -} - -static int -gotoStateStaKeyStart(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t retransmit) -{ - int retVal; - tAniEapolRsnKeyDesc txDesc; - tAniEapolRsnKeyDesc *rxDesc; - static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, - 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 }; - - fsm->currentState = STA_KEY_START; - - // Create a new EAPOL frame if we don't have to retransmit - // if (!retransmit) - //{ - - rxDesc = data->keyDesc; - if( NULL == rxDesc) - { - return ANI_E_NULL_VALUE; - } - aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE ); - retVal = derivePtk(fsm, data); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp derivePtk failed with code %d!\n", retVal); - return retVal; - } - - vos_mem_zero( &txDesc, sizeof(txDesc) ); - - // The Key Information bits... - if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) - { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; - } - txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; - txDesc.info.micFlag = eANI_BOOLEAN_TRUE; - txDesc.keyLen = 0; //RSN_80211_KEY_LEN; - - // Send back the same replayCtr that the authenticator sent - vos_mem_copy(txDesc.replayCounter, - rxDesc->replayCounter, - sizeof(txDesc.replayCounter)); - - vos_mem_copy(txDesc.keyNonce, fsm->sNonce, sizeof(txDesc.keyNonce)); - txDesc.keyDataLen = sizeof(btampRSNIE);//aniAsfPacketGetBytes(fsm->suppCtx->ieBp, - //&txDesc.keyData); - txDesc.keyData = btampRSNIE; - retVal = aniEapolWriteKey(fsm->cryptHandle, - fsm->lastEapol, - fsm->suppCtx->authMac, - fsm->suppCtx->suppMac, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - &txDesc, - fsm->suppCtx->ptk, - CSR_AES_KEY_LEN); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp gotoStateStaKeyStart fail to write key %d\n", - retVal); - return retVal; - } - //} - - if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - retVal = ANI_OK; - } - else - { - retVal = ANI_ERROR; - } - - return retVal; -} - -static int -gotoStateStaKeySet(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t retransmit) -{ - int retVal=0; - tAniEapolRsnKeyDesc txDesc; - tAniEapolRsnKeyDesc *rxDesc = NULL; - - fsm->currentState = STA_KEY_SET; - - if (data == NULL) - { - // We don't need to do anything - return ANI_OK; - } - - // Create a new EAPOL frame if we don't have to retransmit - if (!retransmit) - { - // First check the IE that the AP sent - retVal = checkInfoElement(fsm, data); - if (retVal != ANI_OK) - { - //FIX_RSN aagSetSuppFailureAndCleanup(fsm->suppCtx); - - // FSM does not exist after this... - - return retVal; - } - - // Create a new EAPOL frame - - rxDesc = data->keyDesc; - if( NULL == rxDesc ) - return ANI_E_NULL_VALUE; - - aniAsfPacketEmptyExplicit(fsm->lastEapol, - EAPOL_TX_HEADER_SIZE ); - - vos_mem_zero( &txDesc, sizeof(txDesc) ); - - // The Key Information bits... - if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) - { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; - } - - txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; - txDesc.info.micFlag = eANI_BOOLEAN_TRUE; - txDesc.info.secureFlag = eANI_BOOLEAN_TRUE; - txDesc.keyLen = 0; //RSN_80211_KEY_LEN; - - // Send back the same replayCtr that the authenticator sent - vos_mem_copy(txDesc.replayCounter, - rxDesc->replayCounter, - sizeof(txDesc.replayCounter)); - - retVal = aniEapolWriteKey(fsm->cryptHandle, - fsm->lastEapol, - fsm->suppCtx->authMac, - fsm->suppCtx->suppMac, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - &txDesc, - fsm->suppCtx->ptk, - CSR_AES_KEY_LEN); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } - } - gReadToSetKey = BAP_SET_RSN_KEY; - if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - /* making it global to access in bapTxRx file */ -#if 0 - tCsrRoamSetKey setKeyInfo; - - - vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); - setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; - setKeyInfo.keyDirection = eSIR_TX_RX; - vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) ); - setKeyInfo.paeRole = 0; //this is a supplicant - setKeyInfo.keyId = 0; //always - setKeyInfo.keyLength = CSR_AES_KEY_LEN; - vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); - //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one. - /* - We will move the Set key to EAPOL Completion handler. We found a race condition betweem - sending EAPOL frame and setting Key */ - - - if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" ); - retVal = ANI_ERROR; - } -#endif - gReadToSetKey = BAP_RESET_RSN_KEY; - retVal = ANI_ERROR; - } - - return retVal; -} - -static int -gotoStateGroupKeySet(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - int retVal; - tAniEapolRsnKeyDesc txDesc; - tAniEapolRsnKeyDesc *rxDesc; - - int groupKeyLen; - - fsm->currentState = GROUP_KEY_SET; - - do - { - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - if( NULL == rxDesc) - { - retVal = ANI_E_NULL_VALUE; - break; - } - - if (rxDesc->keyDataLen == 0 || rxDesc->keyData == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: AP sent no group key in group EAPOL-Key message!\n" ); - retVal = ANI_E_ILLEGAL_ARG; - break; - } - - if ( rxDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES ) - { - groupKeyLen = rxDesc->keyDataLen - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; - if( groupKeyLen <= 0 ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: AP sent GTK too short\n" ); - retVal = ANI_E_ILLEGAL_ARG; - break; - } - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: AP sent unsupported keyDescVer %d!\n", rxDesc->info.keyDescVers ); - retVal = ANI_E_ILLEGAL_ARG; - break; - } - - // Always create a new EAPOL frame - - aniAsfPacketEmptyExplicit( fsm->lastEapol, - EAPOL_TX_HEADER_SIZE ); - - vos_mem_zero( &txDesc, sizeof(txDesc) ); - - // The Key Information bits... - if (fsm->suppCtx->grpCipherType == eCSR_ENCRYPT_TYPE_AES) - { - txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; - } - - txDesc.info.unicastFlag = eANI_BOOLEAN_FALSE; - txDesc.info.keyId = rxDesc->info.keyId; - txDesc.info.micFlag = eANI_BOOLEAN_TRUE; - txDesc.info.secureFlag = eANI_BOOLEAN_TRUE; - txDesc.keyLen = RSN_80211_KEY_LEN; - - // Send back the same replayCtr that the authenticator sent - vos_mem_copy(txDesc.replayCounter, - rxDesc->replayCounter, - sizeof(txDesc.replayCounter)); - - retVal = aniEapolWriteKey(fsm->cryptHandle, - fsm->lastEapol, - fsm->suppCtx->authMac, - fsm->suppCtx->suppMac, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - &txDesc, - fsm->suppCtx->ptk, - CSR_AES_KEY_LEN); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - retVal = ANI_ERROR; - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp could not send eapol. Disconnect\n" ); - break; - } - - //FIX_RSN there is no need to set GTK retVal = setGtk(fsm->suppCtx, rxDesc->keyRecvSeqCounter); - - // This is never retransmitted - aniAsfPacketEmptyExplicit( fsm->lastEapol, - EAPOL_TX_HEADER_SIZE ); - - checkTransition(fsm, NULL); // UCT rule - }while( 0 ); - - return retVal; -} - -static int -gotoStateKeyUpdate(tSuppRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo) -{ - //we don't update keys - bapSuppDisconnect( fsm->ctx ); - - return ANI_OK; -} - -static int -gotoStateRekeyMsg(tSuppRsnFsm *fsm, tSirMicFailureInfo *micFailureInfo) -{ - //We don't support rekey, simply disconnect - bapSuppDisconnect( fsm->ctx ); - - return ANI_OK; -} - -static -int zeroOutPtk(tSuppRsnFsm *fsm) -{ - return ANI_OK; -} - -static -int derivePtk(tSuppRsnFsm *fsm, tAniEapolKeyAvailEventData *data) -{ - v_U32_t prfLen; - tAniEapolRsnKeyDesc *rxDesc; - - switch (fsm->suppCtx->pwCipherType) - { - case eCSR_ENCRYPT_TYPE_AES: - prfLen = AAG_RSN_PTK_PRF_LEN_CCMP; - fsm->suppCtx->pwKeyLen = AAG_RSN_KEY_MATERIAL_LEN_CCMP; - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Cannot generate PTK for BP for invalid algorithm %d\n", - fsm->suppCtx->pwCipherType); - return ANI_E_ILLEGAL_ARG; - break; - }; - - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - return aagPtkPrf(fsm->cryptHandle, - fsm->suppCtx->ptk, - prfLen, - fsm->suppCtx->pmk, - fsm->suppCtx->authMac, - fsm->suppCtx->suppMac, - rxDesc->keyNonce, - fsm->sNonce); -} - -static -int checkMic(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t pwKeyExchange) -{ - int retVal; - - retVal = aniEapolKeyCheckMic(fsm->cryptHandle, - data->eapolFrame, - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, - data->keyDesc, - fsm->suppCtx->ptk, - CSR_AES_KEY_LEN); - - return retVal; -} - - -static int checkInfoElement(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data) -{ - tAniEapolRsnKeyDesc *desc; - v_U8_t *ieApBytes; - int ieApLen; - - desc = (tAniEapolRsnKeyDesc *) data->keyDesc; - if( NULL == desc ) - { - return ANI_E_NULL_VALUE; - } - - ieApLen = aniAsfPacketGetBytes(fsm->suppCtx->ieAp, &ieApBytes); - if( ANI_IS_STATUS_SUCCESS( ieApLen ) ) - { - - if ((desc->keyDataLen != ieApLen) || - ( vos_mem_compare(desc->keyData, ieApBytes, ieApLen) )) - { - // TODO: Send a fault here - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp AP sent inconsistent RSN IE!\n" ); - return ANI_E_FAILED; - } - } - - return ANI_OK; -} - -static -int checkPeerReplayCounter(tSuppRsnFsm *fsm, - tAniEapolKeyAvailEventData *data, - v_BOOL_t *retransmit, - v_BOOL_t actualMicFlag, - v_BOOL_t reTxMicFlag) -{ - int retVal = ANI_OK; - int cmp; - tAniEapolRsnKeyDesc *rxDesc; - - rxDesc = data->keyDesc; - if( NULL == rxDesc ) - { - return ANI_E_NULL_VALUE; - } - - *retransmit = eANI_BOOLEAN_FALSE; - - cmp = aniSsmReplayCtrCmp(fsm->peerReplayCtr, rxDesc->replayCounter); - - // The AP should send us a replay counter greater than or equal to - // the last one it sent - /*Unless we are forgiving with this we will have interop issues with some vendros like CSR*/ - if (cmp > 0) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "BP got old EAPOL replay counter from AP" ); - retVal = ANI_E_REPLAY_CHECK_FAILED; - - } - else if (cmp <= 0) - { - if ( actualMicFlag == reTxMicFlag ) - { - *retransmit = eANI_BOOLEAN_TRUE; - } - } - - return retVal; -} - -static -int checkTransition(tSuppRsnFsm *fsm, void *arg) -{ - tAniEapolKeyAvailEventData *data; - tAniEapolRsnKeyDesc *rxDesc; - v_BOOL_t retransmit; - int retVal; - - if (fsm->authReq) - { - gotoStateAuthentication(fsm); - return ANI_OK; - } - - switch (fsm->currentState) - { - case INITIALIZE: - break; - case AUTHENTICATION: - gotoStateGotPmk(fsm); - checkTransition(fsm, arg); - break; - case GOT_PMK: - if (fsm->eapolAvail) { - - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - data = (tAniEapolKeyAvailEventData *) arg; - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - - if (rxDesc->info.ackFlag) - { - - aniSsmReplayCtrUpdate(fsm->peerReplayCtr, - rxDesc->replayCounter); - - // Going from one state to another cannot be a retransmit - retVal = gotoStateStaKeyStart(fsm, data, eANI_BOOLEAN_FALSE); - - } - } - break; - case STA_KEY_START: - if (fsm->eapolAvail) { - - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - data = (tAniEapolKeyAvailEventData *) arg; - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - - if (rxDesc->info.ackFlag) { - - retVal = checkPeerReplayCounter( - fsm, - data, - &retransmit, - rxDesc->info.micFlag, - 0); // MIC not set means check for re-Tx M1. - if (retVal != ANI_OK) - return ANI_OK; // Caller should not fail - - if (retransmit) { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Resending EAPOL-Key Msg2 from " - "supplicant to AP" ); - retVal = gotoStateStaKeyStart(fsm, data, eANI_BOOLEAN_TRUE); - - } - else { - retVal = checkMic(fsm, data, rxDesc->info.unicastFlag); - if (retVal != ANI_OK) - { - bapSuppDisconnect( fsm->ctx ); - return retVal; - } - - aniSsmReplayCtrUpdate(fsm->peerReplayCtr, - rxDesc->replayCounter); - - gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_FALSE); - - } - } - } - break; - case STA_KEY_SET: - if (fsm->eapolAvail) - { - fsm->eapolAvail = eANI_BOOLEAN_FALSE; - data = (tAniEapolKeyAvailEventData *) arg; - rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; - - retVal = checkPeerReplayCounter( - fsm, - data, - &retransmit, - rxDesc->info.micFlag, - 1); // MIC set means check for re-Tx M3. - if (retVal != ANI_OK) - return ANI_OK; // Caller should not fail - - if (!retransmit) - { - retVal = checkMic(fsm, data, rxDesc->info.unicastFlag); - if (retVal != ANI_OK) - { - bapSuppDisconnect( fsm->ctx ); - return retVal; - } - aniSsmReplayCtrUpdate(fsm->peerReplayCtr, - rxDesc->replayCounter); - - } - - if (rxDesc->info.unicastFlag) - { - /* - * Handle pairwise key message...in this state - * pairwise key messages can only be for retransmissions. - */ - if (retransmit) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Resending EAPOL-Key Msg4 from " - "supplicant \n" ); - retVal = gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_TRUE); - } - } - else - { - /* - * Handle group key message...with group key messages, - * the replay counter has to change on - * retransmissions. - */ - if (!retransmit) - { - retVal = gotoStateGroupKeySet(fsm, data); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - bapSuppDisconnect( fsm->ctx ); - return retVal; - } - } - } - } - else { - if (fsm->integFailed) - { - gotoStateKeyUpdate(fsm, arg); - } - } - break; - case GROUP_KEY_SET: - gotoStateStaKeySet(fsm, NULL, eANI_BOOLEAN_FALSE); - break; - case KEY_UPDATE: - gotoStateRekeyMsg(fsm, arg); - break; - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Illegal state for SuppRsnFsm: %d", - fsm->currentState); - VOS_ASSERT( 0 ); - return ANI_E_FAILED; - } - - return ANI_OK; -} - - - -static int -suppEapolKeyHandler( tSuppRsnFsm *fsm, - tAniPacket *eapolFrame, - tAniMacAddr suppMac) -{ - int retVal; - - int descType; - void *keyDesc; - tAniEapolRsnKeyDesc *rsnDesc; - tAniEapolKeyAvailEventData data; - - do - { - retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } - - if (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - { - rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc; - /* - * Pass on the event to the RSN FSM irrespective if it is - * pairwise or not. - */ - data.keyDesc = keyDesc; - data.eapolFrame = eapolFrame; - retVal = suppRsnFsmProcessEvent(fsm, - RSN_FSM_EAPOL_FRAME_AVAILABLE, - &data); - } - else { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: Got unexpected 802.1x RC4 Key message \n" ); - retVal = ANI_E_FAILED; - break; - } - }while( 0 ); - - aniEapolKeyFreeDesc(descType, keyDesc); - return retVal; -} - - - -// -//This function alwasy assume the incoming vos_packet is 802_3 frame. -static int suppRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ) -{ - int retVal = ANI_ERROR; - tAniPacket *pAniPacket; - tBtampContext *ctx; - tSuppRsnFsm *fsm; - /* Validate params */ - if ((pvosGCtx == NULL) || (NULL == pPacket)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "param is NULL in %s", __func__); - - return retVal; - } - ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx ); - if (NULL == ctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "ctx is NULL in %s", __func__); - - return retVal; - } - - fsm = &ctx->uFsm.suppFsm; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return retVal; - } - - do - { - //ToDO: We need to synchronize this. For now, use the simplest form, drop the packet comes later. - if( fsm->fReceiving ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " ******suppRsnRxFrameHandler receive eapol packet while processing. Drop the new comer\n" ); - break; - } - fsm->fReceiving = VOS_TRUE; - retVal = bapRsnFormPktFromVosPkt( &pAniPacket, pPacket ); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - //Now we can process the eapol frame - //handler will free the pAniPacket - bapRsnEapolHandler( fsm, pAniPacket, VOS_FALSE ); - }while( 0 ); - - fsm->fReceiving = VOS_FALSE; - vos_pkt_return_packet( pPacket ); - - return retVal; -} - - -static int suppRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ) -{ - tBtampContext *ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx ); - tAuthRsnFsm *fsm; - - vos_pkt_return_packet( pPacket ); - if (pvosGCtx == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "param is NULL in %s", __func__); - - return ANI_ERROR; - } - - if (NULL == ctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "ctx is NULL in %s", __func__); - - return ANI_ERROR; - } - - fsm = &ctx->uFsm.authFsm; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return ANI_ERROR; - } - - //Synchronization needed - - if(!VOS_IS_STATUS_SUCCESS( retStatus ) ) - { - //This is bad. - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: TL Tx complete with error %d current state is %d\n", retStatus, fsm->currentState ); - if( fsm->numTries <= suppConsts.maxTries ) - { - //retransmit - fsm->numTries++; - if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) - { - bapSuppDisconnect( fsm->ctx->pvosGCtx ); - } - } - else - { - bapSuppDisconnect( fsm->ctx->pvosGCtx ); - } - } - - return ANI_OK; -} - - -/** - * suppEapolHandler - * - * Handles an incoming EAPOL frame on the supplicant side. - * - * @param eapolFrame the packet containing the EAPOL frame, with the - * head of the packet still at the start of the EAPOL frame - * @param dstMac the dstMac pointing inside the frame - * @param srcMac the srcMac pointing inside the frame - * @param type the type pointing inside the frame at the type field - * - * @return ANI_OK if the operation succeeds - */ -void suppEapolHandler( tSuppRsnFsm *fsm, tAniPacket *eapolFrame, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - v_U8_t *type ) -{ - switch (*type) - { - case ANI_EAPOL_TYPE_PACKET: - // Ignore EAP becasue it is only WPA2-PSK - break; - case ANI_EAPOL_TYPE_KEY: - suppEapolKeyHandler( fsm, eapolFrame, dstMac ); - break; - case ANI_EAPOL_TYPE_ASF_ALERT: - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp: EAPOL type not implemented: %.2x\n", *type); - break; - } -} diff --git a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h b/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h deleted file mode 100644 index 88994b10fbce..000000000000 --- a/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xSuppRsnFsm.h $ - * - */ -/* - * Contains declarations for the RSN EAPOL-Key FSM on the - * supplicant side. This is based on 802.11i. - * - * Author: Mayank D. Upadhyay - * Date: 19-December-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef __AAG_SUPP_RSN_FSM_H -#define __AAG_SUPP_RSN_FSM_H - -#include "bapRsn8021xFsm.h" -#include "bapInternal.h" - -/** - * suppRsnFsmInit - * - * FUNCTION: - * Initializes the constants and the callbacks needed by this FSM - * module. - * - * @param cb callbacks to the various procedures needed by this FSM - * - * @return ANI_OK if the operation succeeds - */ -int -suppRsnFsmInit(void); - -int -suppRsnFsmSetPmk(tSuppContext *ctx, v_U8_t *pmk); - -#endif //__AAG_SUPP_RSN_FSM_H diff --git a/CORE/BAP/src/bapRsnAsfPacket.c b/CORE/BAP/src/bapRsnAsfPacket.c deleted file mode 100644 index d6561ea7c65a..000000000000 --- a/CORE/BAP/src/bapRsnAsfPacket.c +++ /dev/null @@ -1,1019 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $File: //depot/software/projects/feature_branches/nova_phase1/ap/apps/asf/aniAsfPacket.c $ - * Contains definitions for packet manipulation routines that make it - * easy to create and parse multi-layered network frames. This module - * minimizes buffer copies while adding or removing headers, and - * adding or removing payload. - * - * Author: Mayank D. Upadhyay - * Date: 19-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#include "vos_types.h" -#include "vos_trace.h" -#include <bapRsnAsfPacket.h> -#include <bapRsnErrors.h> -#include "vos_memory.h" -#include "vos_packet.h" - -/* - * Allocate one more than required because the last bytes is waste. We - * waste the last byte because in the adopted model, the tail always - * points to the next location where data should be stored. In a full - * buffer we don't want to position the tail to memory we haven't - * allocated ourself. - */ -#define ANI_INTERNAL_DEFAULT_PACKET_SIZE (ANI_DEFAULT_PACKET_SIZE + 4) - -#define TAIL_SPACE(packet) \ - ((packet)->buf + (packet)->size - (packet)->tail) - -#define HEAD_SPACE(packet) \ - ((packet)->head - (packet)->buf) - -#define ANI_CHECK_RANGE(x , upper) \ - ( (x) <= (upper) ) - -/** - * Opaque packet structure with internal storage for raw bytes. - * Conceptually, a tAniPacket is a pre-allocated buffer that contains - * data in the middle and free space on either side. The start of the - * data is called the head. Routines are provided to add data at the - * front or at the rear. The length of the packet is the total number - * of valid data bytes contained in it. The size of the packet is the - * total number of preallocated bytes. - */ -struct tAniPacket { - v_U8_t *buf; - v_U32_t size; - v_U8_t *head; - v_U8_t *tail; - v_U8_t *recordHeader; - v_U32_t len; -}; - -/** - * aniAsfPacketAllocate - * - * FUNCTION: - * Create a packet of size 2*ANI_DEFAULT_PACKET_SIZE and positions the - * head of the packet in the center. The allocated storage can be free - * with a call to aniAsfPacketFree. - * - * LOGIC: - * Allocates storage for tAniPacket and its internal raw data - * buffer. Positions the head and tail pointers in the middle of the - * raw data buffer. - * - * @param packetPtr pointer that will be set to newly allocated - * tAniPacket if the operation succeeds. - * - * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if - * memory could not be allocated. - * @see aniAsfPacketFree - */ -int -aniAsfPacketAllocate(tAniPacket **packetPtr) -{ - return aniAsfPacketAllocateExplicit(packetPtr, - ANI_INTERNAL_DEFAULT_PACKET_SIZE, - ANI_INTERNAL_DEFAULT_PACKET_SIZE/2); -} - -/** - * aniAsfPacketAllocateExplicit - * - * FUNCTION: - * Create a packet of the desired size and position the head of the - * packet at the desired offset in the internal raw data buffer. An - * application would normally set this offset to the expected length - * of the protocol header, then append the payload, and finally, - * prepend the header. The allocated storage can be free with a call - * to aniAsfPacketFree. - * - * LOGIC: - * Allocates storage for tAniPacket and its internal raw data - * buffer. Positions the head and tail pointers at the given offset in - * the internal raw data buffer. - * - * @param packetPtr pointer that will be set to newly allocated - * tAniPacket if the operation succeeds. - * @param size the size of the internal raw data buffer - * @param offset the offset in the internal raw data buffer where the - * head of the packet will be positioned initially - * - * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if - * memory could not be allocated. - * @see aniAsfPacketFree - */ -int -aniAsfPacketAllocateExplicit(tAniPacket **packetPtr, - v_U32_t size, - v_U32_t offset) -{ - tAniPacket *packet = NULL; - v_U32_t maxHead = size; - - *packetPtr = NULL; - if (size == 0) - return ANI_E_ILLEGAL_ARG; - - VOS_ASSERT(ANI_CHECK_RANGE(offset, maxHead)); - if (!ANI_CHECK_RANGE(offset, maxHead)) - return ANI_E_ILLEGAL_ARG; - - packet = (tAniPacket *) vos_mem_malloc( sizeof(tAniPacket) ); - - if (packet == NULL) - { - VOS_ASSERT( 0 ); - return ANI_E_MALLOC_FAILED; - } - - // transparently add one to the size since last byte is wasted - size = (size + 4) & 0xfffffffc; - - packet->buf = (v_U8_t *)vos_mem_malloc( sizeof(v_U8_t) * size ); - if (packet->buf == NULL) - { - vos_mem_free( packet ); - VOS_ASSERT( 0 ); - return ANI_E_MALLOC_FAILED; - } - - packet->size = size; // Should not be visible to the user - packet->head = packet->buf + offset; - packet->tail = packet->head; - packet->len = 0; - - *packetPtr = packet; - return ANI_OK; -} - -/** - * aniAsfPacketDuplicate - * - * Duplicates a given packet exactly. That is, the contents, the size - * of the packet, and the positions of the pointers are maintained in - * the new copy. - * - * @param newPacketPtr is set to a newly allocated packet that is a - * duplicate of oldPacket - * @param oldPacket the original packet that should be duplicated - * - * @return ANI_OK if the operation succeeds; ANI_E_NULL if oldPacket - * is NULL; - */ -int -aniAsfPacketDuplicate(tAniPacket **newPacketPtr, tAniPacket *oldPacket) -{ - int retVal; - int recordPos; - tAniPacket *packet = NULL; - - if (oldPacket == NULL) - return ANI_E_NULL_VALUE; - - retVal = aniAsfPacketAllocateExplicit(&packet, - oldPacket->size, - oldPacket->head - oldPacket->buf); - if (retVal != ANI_OK) - return retVal; - - retVal = aniAsfPacketAppendBuffer(packet, - oldPacket->head, - oldPacket->len); - if (retVal != ANI_OK) - { - VOS_ASSERT( 0 ); - aniAsfPacketFree(packet); - return ANI_E_FAILED; - } - - if (oldPacket->recordHeader != NULL) - { - recordPos = oldPacket->recordHeader - oldPacket->buf; - packet->recordHeader = packet->buf + recordPos; - } - *newPacketPtr = packet; - - return ANI_OK; -} - -/** - * aniAsfPacketFree - * - * FUNCTION: - * Free a previously allocated tAniPacket and its internal raw data - * buffer. - * - * @param packet the packet to free - * - * @return ANI_OK if the operation succeeds; ANI_E_NULL_VALUE if an - * unexpected NULL pointer is encountered - */ -int -aniAsfPacketFree(tAniPacket *packet) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (packet->buf != NULL) - vos_mem_free( packet->buf ); - - vos_mem_free( packet ); - - return ANI_OK; -} - - -/** - * aniAsfPacketAppendBuffer - * - * FUNCTION: - * Appends the data contained in buf to the end of the data in - * destAniPacket. The head of destAniPacket remains unchanged, while its - * length increases by len. - * - * If there isn't enough free space in destAniPacket for all len bytes - * then the routine fails and the length of destAniPacket remains - * unchanged. - * - * LOGIC: - * Check that there is enough free space in the packet to append the - * buffer. If not, bail. Otherwise, copy bytes from the buffer into - * the packet's internal raw data buffer and increase the value of its - * length to reflect this. - * - * @param packet the packet to append to - * @param buf the buffer containing data to be appended to the packet - * @param len the number of bytes to append - * - * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the - * packet does not have enough free space for the complete buffer - * @see aniAsfPacketPrependBuffer - */ -int -aniAsfPacketAppendBuffer(tAniPacket *destPacket, - const v_U8_t *buf, - v_U32_t len) -{ - if (aniAsfPacketCanAppendBuffer(destPacket, len) != ANI_OK) - return ANI_E_FAILED; - - if (buf == NULL) - return ANI_E_NULL_VALUE; - - vos_mem_copy(destPacket->tail, buf, len); - destPacket->tail += len; - destPacket->len += len; - return ANI_OK; -} - -/** - * aniAsfPacketPrependBuffer - * - * FUNCTION: - * Prepends the data contained in buf to the start of the data in - * destPacket. The head of destPacket is repositioned and the length - * of destPacket increases by len. - * - * If there isn't enough free space in destPacket for all len bytes - * then the routine fails and the length of destPacket remains - * unchanged. - * - * LOGIC: - * Check that there is enough free space in the packet to prepend the - * buffer. If not, bail. Otherwise, copy bytes from the buffer into - * the packet's internal raw data buffer and increase the value of its - * length to reflect this. - * - * @param packet the packet to prepend to - * @param buf the buffer containing data to be prepended to the packet - * @param len the number of bytes to prepend - * - * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the - * packet does not have enough free space for the complete buffer - * @see aniAsfPacketAppendBuffer - */ -int -aniAsfPacketPrependBuffer(tAniPacket *destPacket, - const v_U8_t *buf, - v_U32_t len) -{ - if (aniAsfPacketCanPrependBuffer(destPacket, len) != ANI_OK) - return ANI_E_FAILED; - - if (buf == NULL) - return ANI_E_NULL_VALUE; - - destPacket->head -= len; - destPacket->len += len; - vos_mem_copy(destPacket->head, buf, len); - return ANI_OK; - -} - -/** - * aniAsfPacketCanAppendBuffer - * - * FUNCTION: - * Determines if len bytes can be safely appended to destPacket - * without overflowing. - * - * LOGIC: - * Current packet tail plus len of buffer should not exceed packet - * start plus packet size - * - * Note: This does not return a boolean value, but instead an integer - * code. - * - * @param packet the packet to append to - * @param len the number of bytes to append - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketCanAppendBuffer(tAniPacket *destPacket, - v_U32_t len) -{ - if (destPacket == NULL) - return ANI_E_FAILED; - - if ((int)len <= TAIL_SPACE(destPacket)) - return ANI_OK; - else - return ANI_E_FAILED; -} - -/** - * aniAsfPacketCanPrependBuffer - * - * FUNCTION: - * Determines if len bytes can be safely prepended to destPacket - * without overflowing. - * - * LOGIC: - * Current packet head minus len of buffer should not be less than - * start of packet. - * - * Note: This does not return a boolean value, but instead an integer - * code. - * - * @param packet the packet to prepend to - * @param len the number of bytes to prepend - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketCanPrependBuffer(tAniPacket *destPacket, - v_U32_t len) -{ - if (destPacket == NULL) - return ANI_E_FAILED; - - if (!(len > 0)) - return ANI_E_FAILED; - - if ((int)len <= HEAD_SPACE(destPacket)) - return ANI_OK; - else - return ANI_E_FAILED; -} - -/** - * aniAsfPacketTruncateFromFront - * - * FUNCTION: - * Removes len bytes from the front of the packet by moving its - * head. The length of the packet is decremented by len. - * - * @param packet the packet to truncate from the front - * @param len the number of bytes to truncate - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketTruncateFromFront(tAniPacket *packet, - v_U32_t len) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (!ANI_CHECK_RANGE(len, packet->len)) - return ANI_E_FAILED; - - packet->head += len; - packet->len -= len; - - return ANI_OK; -} - -/** - * aniAsfPacketTruncateFromRear - * - * FUNCTION: - * Removes len bytes from the rear of the packet by moving its - * tail. The length of the packet is decremented by len. - * - * @param packet the packet to truncate from the rear - * @param len the number of bytes to truncate - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketTruncateFromRear(tAniPacket *packet, - v_U32_t len) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (!ANI_CHECK_RANGE(len, packet->len)) - return ANI_E_FAILED; - - packet->tail -= len; - packet->len -= len; - - return ANI_OK; -} - -/** - * aniAsfPacketGetLen - * - * FUNCTION: - * Returns the number of valid data bytes stored in the packet. - * - * @param packet the packet whose len we need - * - * @return the non-negative number of bytes stored in the packet - */ -int -aniAsfPacketGetLen(tAniPacket *packet) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - return packet->len; -} - -/** - * aniAsfPacketGetBytes - * - * FUNCTION: - * Returns a pointer to the head of the valid data stored in the - * packet. - * - * @param packet the packet whose bytes we need - * @param rawBytesPtr the pointer that will be set the start of the - * raw bytes. - * - * @return The non-negative number of bytes stored in the packet if - * the operation succeeded. That is the same value as what would be - * returned by aniAsfPacketGetLen. - */ -int -aniAsfPacketGetBytes(tAniPacket *packet, v_U8_t **rawBytesPtr) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - *rawBytesPtr = packet->head; - return packet->len; -} - -/** - * aniAsfPacketGetN - * - * Returns N bytes from the packet and moves the head of the packet - * beyond those bytes. - * - * @param packet the packet to read from - * @param n the number of bytes to read - * @param bytesPtr is set to the start of the octets - * - * @return ANI_OK if the operation succeeds; ANI_E_SHORT_PACKET if the - * packet does not have n bytes. - */ -int -aniAsfPacketGetN(tAniPacket *packet, int n, v_U8_t **bytesPtr) -{ - int retVal; - v_U8_t *bytes = NULL; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - retVal = aniAsfPacketGetBytes(packet, &bytes); - if (retVal < n) - return ANI_E_SHORT_PACKET; - - aniAsfPacketTruncateFromFront(packet, n); - - *bytesPtr = bytes; - - return ANI_OK; -} - -/** - * aniAsfPacketEmpty - * - * FUNCTION: - * Re-initializes the packet by positioning the head to the middle and - * setting the length to zero. - * - * @param packet the packet to empty - * - * @return ANI_OK if the operation succeeded - */ -int -aniAsfPacketEmpty(tAniPacket *packet) -{ - return aniAsfPacketEmptyExplicit(packet, packet->size/2); -} - -/** - * aniAsfPacketEmptyExplicit - * - * FUNCTION: - * Re-initializes the packet by positioning the head to the desired - * offset and setting the length to zero. - * - * @param packet the packet to empty - * @param offset the offset that the head of the packet should be set - * to. An application will be able to prepend and append data relative - * to this offset. - * - * @return ANI_OK if the operation succeeded - */ -int -aniAsfPacketEmptyExplicit(tAniPacket *packet, - v_U32_t offset) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - VOS_ASSERT(ANI_CHECK_RANGE(offset, packet->size)); - if (!ANI_CHECK_RANGE(offset, packet->size)) - return ANI_E_ILLEGAL_ARG; - - packet->head = packet->buf + offset; - packet->tail = packet->head; - packet->len = 0; - - return ANI_OK; -} - - - -/** - * aniAsfPacketPrependHdr - * - * FUNCTION: - * Prepends a tAniHdr at the start of the packet. All host to network - * byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param msgType the message type to write as part of the header - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrependHdr(tAniPacket *packet, v_U16_t msgType) -{ - int retVal; - int length; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - length = 4; - - length = 2 + 2 + packet->len; - - retVal = aniAsfPacketPrepend16(packet, length); - if (retVal < 0) - return retVal; - - retVal = aniAsfPacketPrepend16(packet, msgType); - if (retVal < 0) - return retVal; - - return ANI_OK; -} - -/** - * aniAsfPacketGet32 - * - * FUNCTION: - * Reads a ANI_U32 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet32(tAniPacket *packet, v_U32_t *val) -{ - v_U8_t u32Arr[4]; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (val == NULL) - return ANI_E_NULL_VALUE; - - if (packet->len < 4) - return ANI_E_SHORT_PACKET; - - //packet is in network order, make sure it is align - u32Arr[0] = packet->head[0]; - u32Arr[1] = packet->head[1]; - u32Arr[2] = packet->head[2]; - u32Arr[3] = packet->head[3]; - *val = vos_be32_to_cpu( *(v_U32_t *)u32Arr ); - aniAsfPacketTruncateFromFront(packet, 4); - - return ANI_OK; -} - -/** - * aniAsfPacketAppend32 - * - * FUNCTION: - * Appends a ANI_U32 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend32(tAniPacket *packet, v_U32_t val) -{ - v_U8_t *p8; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (TAIL_SPACE(packet) < 4) - return ANI_E_FAILED; - - val = vos_cpu_to_be32( val ); - p8 = (v_U8_t *)&val; - packet->tail[0] = p8[0]; - packet->tail[1] = p8[1]; - packet->tail[2] = p8[2]; - packet->tail[3] = p8[3]; - aniAsfPacketMoveRight(packet, 4); - - return ANI_OK; -} - -/** - * aniAsfPacketGet16 - * - * FUNCTION: - * Reads a ANI_U16 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet16(tAniPacket *packet, v_U16_t *val) -{ - v_U8_t u16Arr[2]; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (val == NULL) - return ANI_E_NULL_VALUE; - - if (packet->len < 2) - return ANI_E_SHORT_PACKET; - - u16Arr[0] = packet->head[0]; - u16Arr[1] = packet->head[1]; - *val = vos_be16_to_cpu( *(v_U16_t *)u16Arr ); - aniAsfPacketTruncateFromFront(packet, 2); - - return ANI_OK; -} - -/** - * aniAsfPacketPrepend16 - * - * FUNCTION: - * Prepends a ANI_U16 to the start of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to prepend - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrepend16(tAniPacket *packet, v_U16_t val) -{ - v_U8_t *p8; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (HEAD_SPACE(packet) < 2) - return ANI_E_FAILED; - - aniAsfPacketMoveLeft(packet, 2); - val = vos_cpu_to_be16( val ); - p8 = (v_U8_t *)&val; - packet->head[0] = p8[0]; - packet->head[1] = p8[1]; - - return ANI_OK; -} - -/** - * aniAsfPacketAppend16 - * - * FUNCTION: - * Appends a ANI_U16 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend16(tAniPacket *packet, v_U16_t val) -{ - v_U8_t *p8; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (TAIL_SPACE(packet) < 2) - return ANI_E_FAILED; - - val = vos_cpu_to_be16( val ); - p8 = (v_U8_t *)&val; - packet->tail[0] = p8[0]; - packet->tail[1] = p8[1]; - aniAsfPacketMoveRight(packet, 2); - - return ANI_OK; -} - -/** - * aniAsfPacketGet8 - * - * FUNCTION: - * Reads a ANI_U8 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet8(tAniPacket *packet, v_U8_t *val) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (val == NULL) - return ANI_E_NULL_VALUE; - - if (packet->len < 1) - return ANI_E_SHORT_PACKET; - - *val = *(packet->head); - aniAsfPacketTruncateFromFront(packet, 1); - - return ANI_OK; -} - -/** - * aniAsfPacketPrepend8 - * - * FUNCTION: - * Prepends a ANI_U8 to the start of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to prepend - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrepend8(tAniPacket *packet, v_U8_t val) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - VOS_ASSERT(HEAD_SPACE(packet) >= 1); - if (HEAD_SPACE(packet) < 1) - return ANI_E_FAILED; - - aniAsfPacketMoveLeft(packet, 1); - *(packet->head) = val; - - return ANI_OK; -} - -/** - * aniAsfPacketAppend8 - * - * FUNCTION: - * Appends a ANI_U8 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend8(tAniPacket *packet, v_U8_t val) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - if (TAIL_SPACE(packet) < 1) - return ANI_E_FAILED; - - *(packet->tail) = val; - aniAsfPacketMoveRight(packet, 1); - - return ANI_OK; -} - -/** - * aniAsfPacketGetMac - * - * FUNCTION: - * Returns a tAniMacAddr from the start of the packet. - * - * @param packet the packet to read from - * @param macAddr the destination to copy the MAC address to - * - * @return ANI_OK if the operation succeeds. Also, the packet head - * pointer is advanced past the MAC address. - */ -int -aniAsfPacketGetMac(tAniPacket *packet, tAniMacAddr macAddr) -{ - if (packet->len < sizeof(tAniMacAddr)) - return ANI_E_SHORT_PACKET; - - vos_mem_copy(macAddr, packet->head, sizeof(tAniMacAddr)); - - packet->head += sizeof(tAniMacAddr); - packet->len -= sizeof(tAniMacAddr); - - return ANI_OK; -} - -/** - * aniAsfPacketMoveLeft - * - * FUNCTION: - * Pretends that a certain number of bytes have been prepended to the - * packet, without actually copying any bytes in. The packet head and - * length are appropriately changed. This function is useful while - * interfacing with other libraries that only support byte array - * manipulation. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a two-step process - one: copy some bytes - * to the packet's internal buffer, two: move head and length. This - * violates the encapsulation the packet library aims to provide. - * - * @param packet the packet whose head and length needs to be modified - * @param count the number of bytes to modify by - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketMoveLeft(tAniPacket *packet, v_U32_t count) -{ - if (aniAsfPacketCanPrependBuffer(packet, count) != ANI_OK) - return ANI_E_FAILED; - - packet->head -= count; - packet->len += count; - - return ANI_OK; -} - -/** - * aniAsfPacketMoveRight - * - * FUNCTION: - * Pretends that a certain number of bytes have been appended to the - * packet, without actually copying any bytes in. The packet tail and - * length are appropriately changed. This function is useful while - * interfacing with other libraries that only support byte array - * manipulation. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a two-step process - one: copy some bytes - * to the packet's internal buffer, two: move tail and length. This - * violates the encapsulation the packet library aims to provide. - * - * @param packet the packet whose head and length needs to be modified - * @param count the number of bytes to modify by - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketMoveRight(tAniPacket *packet, v_U32_t count) -{ - if (aniAsfPacketCanAppendBuffer(packet, count) != ANI_OK) - return ANI_E_FAILED; - - packet->tail += count; - packet->len += count; - - return ANI_OK; -} - -/** - * aniAsfPacketGetBytesFromTail - * - * FUNCTION: - * Returns a pointer to the tail of the valid data stored - * in the packet. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a three-step process - one: call this - * routine to obtain a pointer to the current tail of the packet. - * two: treat this returned pointer like a simple array and copy - * some bytes to the packet's internal buffer, and finally - * three: move tail and length. This violates the encapsulation - * the packet library aims to provide. - * - * @param packet the packet whose bytes we need - * @param rawBytesPtr the pointer that will be set the start of the - * raw bytes. - * - * @return The non-negative number of bytes stored in the packet if - * the operation succeeded. That is the same value as what would be - * returned by aniAsfPacketGetLen. - */ -int -aniAsfPacketGetBytesFromTail(tAniPacket *packet, v_U8_t **rawBytesPtr) -{ - if (packet == NULL) - return ANI_E_NULL_VALUE; - - *rawBytesPtr = packet->tail; - return 0; // The length of used bytes returned is zero -} diff --git a/CORE/BAP/src/bapRsnAsfPacket.h b/CORE/BAP/src/bapRsnAsfPacket.h deleted file mode 100644 index c38c8d32caaa..000000000000 --- a/CORE/BAP/src/bapRsnAsfPacket.h +++ /dev/null @@ -1,612 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $File: //depot/software/projects/feature_branches/nova_phase1/ap/apps/include/aniAsfPacket.h $ - * Contains declarations for packet manipulation routines that make it - * easy to create and parse multi-layered network frames. This module - * minimizes buffer copies while adding or removing headers, and - * adding or removing payload. - * - * Author: Mayank D. Upadhyay - * Date: 19-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef _ANI_ASF_PACKET_H_ -#define _ANI_ASF_PACKET_H_ - -#include "vos_types.h" -#include "palTypes.h" - -#define ANI_ETH_FRAME_LEN 1516 -#define ANI_DEFAULT_PACKET_SIZE (ANI_ETH_FRAME_LEN*2) - -/** - * Opaque packet structure with internal storage for raw bytes. - * Conceptually, a tPacket is a pre-allocated buffer that contains - * data in the middle and free space on either side. The start of the - * data is called the head. Routines are provided to add data at the - * front or at the rear. The length of the packet is the total number - * of valid data bytes contained in it. The size of the packet is the - * total number of preallocated bytes. - */ -typedef struct tAniPacket tAniPacket; - -/** - * aniAsfPacketAllocate - * - * FUNCTION: - * Create a packet of size 2*ANI_DEFAULT_PACKET_SIZE and positions the - * head of the packet in the center. The allocated storage can be free - * with a call to aniAsfPacketFree. - * - * LOGIC: - * Allocates storage for tPacket and its internal raw data - * buffer. Positions the head and tail pointers in the middle of the - * raw data buffer. - * - * @param packetPtr pointer that will be set to newly allocated - * tPacket if the operation succeeds. - * - * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if - * memory could not be allocated. - * @see aniAsfPacketFree - */ -int -aniAsfPacketAllocate(tAniPacket **packetPtr); - -/** - * aniAsfPacketDuplicate - * - * Duplicates a given packet exactly. That is, the contents, the size - * of the packet, and the positions of the pointers are maintained in - * the new copy. - * - * @param newPacketPtr is set to a newly allocated packet that is a - * duplicate of oldPacket - * @param oldPacket the original packet that should be duplicated - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketDuplicate(tAniPacket **newPacketPtr, tAniPacket *oldPacket); - -/** - * aniAsfPacketAllocateExplicit - * - * FUNCTION: - * Create a packet of the desired size and position the head of the - * packet at the desired offset in the internal raw data buffer. An - * application would normally set this offset to the expected length - * of the protocol header, then append the payload, and finally, - * prepend the header. The allocated storage can be free with a call - * to aniAsfPacketFree. - * - * LOGIC: - * Allocates storage for tPacket and its internal raw data - * buffer. Positions the head and tail pointers at the given offset in - * the internal raw data buffer. - * - * @param packetPtr pointer that will be set to newly allocated - * tPacket if the operation succeeds. - * @param size the size of the internal raw data buffer - * @param offset the offset in the internal raw data buffer where the - * head of the packet will be positioned initially - * - * @return ANI_OK if the operation succeeds; ANI_E_MALLOC_FAILED if - * memory could not be allocated. - * @see aniAsfPacketFree - */ -int -aniAsfPacketAllocateExplicit(tAniPacket **packetPtr, - v_U32_t size, - v_U32_t offset); - -/** - * aniAsfPacketFree - * - * FUNCTION: - * Free a previously allocated tPacket and its internal raw data - * buffer. - * - * @param packet the packet to free - * - * @return ANI_OK if the operation succeeds; ANI_E_NULL_VALUE if an - * unexpected NULL pointer is encountered - */ -int -aniAsfPacketFree(tAniPacket *packet); - -/** - * aniAsfPacket2Str - * - * FUNCTION: - * Returns a printable representation of the data contained in the - * packet. - * Note: This function returns a static buffer used by aniAsfHexStr. - * - * @param packet the packet whose contents need to be printed - */ -v_U8_t *aniAsfPacket2Str(tAniPacket *packet); - -/** - * aniAsfPacketAppendBuffer - * - * FUNCTION: - * Appends the data contained in buf to the end of the data in - * destPacket. The head of destPacket remains unchanged, while its - * length increases by len. - * - * If there isn't enough free space in destPacket for all len bytes - * then the routine fails and the length of destPacket remains - * unchanged. - * - * LOGIC: - * Check that there is enough free space in the packet to append the - * buffer. If not, bail. Otherwise, copy bytes from the buffer into - * the packet's internal raw data buffer and increase the value of its - * length to reflect this. - * - * @param packet the packet to append to - * @param buf the buffer containing data to be appended to the packet - * @param len the number of bytes to append - * - * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the - * packet does not have enough free space for the complete buffer - * @see aniAsfPacketPrependBuffer - */ -int -aniAsfPacketAppendBuffer(tAniPacket *destPacket, - const v_U8_t *buf, - v_U32_t len); - -/** - * aniAsfPacketPrependBuffer - * - * FUNCTION: - * Prepends the data contained in buf to the start of the data in - * destPacket. The head of destPacket is repositioned and the length - * of destPacket increases by len. - * - * If there isn't enough free space in destPacket for all len bytes - * then the routine fails and the length of destPacket remains - * unchanged. - * - * LOGIC: - * Check that there is enough free space in the packet to prepend the - * buffer. If not, bail. Otherwise, copy bytes from the buffer into - * the packet's internal raw data buffer and increase the value of its - * length to reflect this. - * - * @param packet the packet to prepend to - * @param buf the buffer containing data to be prepended to the packet - * @param len the number of bytes to prepend - * - * @return ANI_OK if the operation succeeds; ANI_E_FAILED if the - * packet does not have enough free space for the complete buffer - * @see aniAsfPacketAppendBuffer - */ -int -aniAsfPacketPrependBuffer(tAniPacket *destPacket, - const v_U8_t *buf, - v_U32_t len); - -/** - * aniAsfPacketCanAppendBuffer - * - * FUNCTION: - * Determines if len bytes can be safely appended to destPacket - * without overflowing. - * - * LOGIC: - * Current packet tail plus len of buffer should not exceed packet - * start plus packet size - * - * Note: This does not return a boolean value, but instead an integer - * code. - * - * @param packet the packet to append to - * @param len the number of bytes to append - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketCanAppendBuffer(tAniPacket *destPacket, - v_U32_t len); - -/** - * aniAsfPacketCanPrependBuffer - * - * FUNCTION: - * Determines if len bytes can be safely prepended to destPacket - * without overflowing. - * - * LOGIC: - * Current packet head minus len of buffer should not be less than - * start of packet. - * - * Note: This does not return a boolean value, but instead an integer - * code. - * - * @param packet the packet to prepend to - * @param len the number of bytes to prepend - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketCanPrependBuffer(tAniPacket *destPacket, - v_U32_t len); - -/** - * aniAsfPacketTruncateFromFront - * - * FUNCTION: - * Removes len bytes from the front of the packet by moving its - * head. The length of the packet is decremented by len. - * - * @param packet the packet to truncate from the front - * @param len the number of bytes to truncate - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketTruncateFromFront(tAniPacket *packet, - v_U32_t len); - -/** - * aniAsfPacketTruncateFromRear - * - * FUNCTION: - * Removes len bytes from the rear of the packet by moving its - * tail. The length of the packet is decremented by len. - * - * @param packet the packet to truncate from the rear - * @param len the number of bytes to truncate - * - * @return ANI_OK if the append operation would succeed; ANI_E_FAILED - * otherwise - */ -int -aniAsfPacketTruncateFromRear(tAniPacket *packet, - v_U32_t len); - -/** - * aniAsfPacketGetLen - * - * FUNCTION: - * Returns the number of valid data bytes stored in the packet. - * - * @param packet the packet whose len we need - * - * @return the non-negative number of bytes stored in the packet - */ -int -aniAsfPacketGetLen(tAniPacket *packet); - -/** - * aniAsfPacketGetBytes - * - * FUNCTION: - * Returns a pointer to the head of the valid data stored in the - * packet. - * - * @param packet the packet whose bytes we need - * @param rawBytesPtr the pointer that will be set the start of the - * raw bytes. - * - * @return The non-negative number of bytes stored in the packet if - * the operation succeeded. That is the same value as what would be - * returned by aniAsfPacketGetLen. - */ -int -aniAsfPacketGetBytes(tAniPacket *packet, v_U8_t **rawBytesPtr); - -/** - * aniAsfPacketGetN - * - * Returns N bytes from the packet and moves the head of the packet - * beyond those bytes. - * - * @param packet the packet to read from - * @param n the number of bytes to read - * @param bytesPtr is set to the start of the octets - * - * @return ANI_OK if the operation succeeds; ANI_E_SHORT_PACKET if the - * packet does not have n bytes. - */ -int -aniAsfPacketGetN(tAniPacket *packet, int n, v_U8_t **bytesPtr); - -/** - * aniAsfPacketEmpty - * - * FUNCTION: - * Re-initializes the packet by positioning the head to the middle and - * setting the length to zero. - * - * @param packet the packet to empty - * - * @return ANI_OK if the operation succeeded - */ -int -aniAsfPacketEmpty(tAniPacket *packet); - -/** - * aniAsfPacketEmptyExplicit - * - * FUNCTION: - * Re-initializes the packet by positioning the head to the desired - * offset and setting the length to zero. - * - * @param packet the packet to empty - * @param offset the offset that the head of the packet should be set - * to. An application will be able to prepend and append data relative - * to this offset. - * - * @return ANI_OK if the operation succeeded - */ -int -aniAsfPacketEmptyExplicit(tAniPacket *packet, - v_U32_t offset); - - -/** - * aniAsfPacketPrependHdr - * - * FUNCTION: - * Prepends a tAniHdr at the start of the packet. All host to network - * byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param msgType the message type to write as part of the header - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrependHdr(tAniPacket *packet, v_U16_t msgType); - -/** - * aniAsfPacketGet32 - * - * FUNCTION: - * Reads a ANI_U32 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet32(tAniPacket *packet, v_U32_t *val); - -/** - * aniAsfPacketAppend32 - * - * FUNCTION: - * Appends a ANI_U32 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend32(tAniPacket *packet, v_U32_t val); - -/** - * aniAsfPacketGet16 - * - * FUNCTION: - * Reads a ANI_U16 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet16(tAniPacket *packet, v_U16_t *val); - -/** - * aniAsfPacketPrepend16 - * - * FUNCTION: - * Prepends a ANI_U16 to the start of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to prepend - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrepend16(tAniPacket *packet, v_U16_t val); - -/** - * aniAsfPacketAppend16 - * - * FUNCTION: - * Appends a ANI_U16 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend16(tAniPacket *packet, v_U16_t val); - -/** - * aniAsfPacketGet8 - * - * FUNCTION: - * Reads a ANI_U8 out of the packet and returns it. The packet's head - * is advanced and its length decremented by the appropriate length. - * All network to host byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to fill in - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketGet8(tAniPacket *packet, v_U8_t *val); - -/** - * aniAsfPacketPrepend8 - * - * FUNCTION: - * Prepends a ANI_U8 to the start of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to read from - * @param val the value to prepend - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketPrepend8(tAniPacket *packet, v_U8_t val); - -/** - * aniAsfPacketAppend8 - * - * FUNCTION: - * Appends a ANI_U8 to the end of the packet. - * All host to network byte order translation is also taken care of. - * - * @param packet the packet to write to - * @param val the value to append - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketAppend8(tAniPacket *packet, v_U8_t val); - -/** - * aniAsfPacketGetMac - * - * FUNCTION: - * Returns a tAniMacAddr from the start of the packet. - * - * @param packet the packet to read from - * @param macAddr the destination to copy the MAC address to - * - * @return ANI_OK if the operation succeeds. Also, the packet head - * pointer is advanced past the MAC address. - */ -int -aniAsfPacketGetMac(tAniPacket *packet, tAniMacAddr macAddr); - -/** - * aniAsfPacketMoveLeft - * - * FUNCTION: - * Pretends that a certain number of bytes have been prepended to the - * packet, without actually copying any bytes in. The packet head and - * length are appropriately changed. This function is useful while - * interfacing with other libraries that only support byte array - * manipulation. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a two-step process - one: copy some bytes - * to the packet's internal buffer, two: move head and length. This - * violates the encapsulation the packet library aims to provide. - * - * @param packet the packet whose head and length needs to be modified - * @param count the number of bytes to modify by - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketMoveLeft(tAniPacket *packet, v_U32_t count); - -/** - * aniAsfPacketMoveRight - * - * FUNCTION: - * Pretends that a certain number of bytes have been appended to the - * packet, without actually copying any bytes in. The packet tail and - * length are appropriately changed. This function is useful while - * interfacing with other libraries that only support byte array - * manipulation. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a two-step process - one: copy some bytes - * to the packet's internal buffer, two: move tail and length. This - * violates the encapsulation the packet library aims to provide. - * - * @param packet the packet whose head and length needs to be modified - * @param count the number of bytes to modify by - * - * @return ANI_OK if the operation succeeds - */ -int -aniAsfPacketMoveRight(tAniPacket *packet, v_U32_t count); - -/** - * aniAsfPacketGetBytesFromTail - * - * FUNCTION: - * Returns a pointer to the tail of the valid data stored - * in the packet. - * - * WARNING: - * Applications are discouraged from using this function - * because correct usage is a three-step process - one: call this - * routine to obtain a pointer to the current tail of the packet. - * two: treat this returned pointer like a simple array and copy - * some bytes to the packet's internal buffer, and finally - * three: move tail and length. This violates the encapsulation - * the packet library aims to provide. - * - * @param packet the packet whose bytes we need - * @param rawBytesPtr the pointer that will be set the start of the - * raw bytes. - * - * @return The non-negative number of bytes stored in the packet if - * the operation succeeded. That is the same value as what would be - * returned by aniAsfPacketGetLen. - */ -int -aniAsfPacketGetBytesFromTail(tAniPacket *packet, v_U8_t **rawBytesPtr); - - -#endif // _ANI_ASF_PACKET_H_ diff --git a/CORE/BAP/src/bapRsnErrors.h b/CORE/BAP/src/bapRsnErrors.h deleted file mode 100644 index a1f9712fe9f2..000000000000 --- a/CORE/BAP/src/bapRsnErrors.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniErrors.h $ - * - */ -/* - * Contains definitions of error codes that are globally visible - * across WNI applications. There are two kinds of error codes: - * generic error codes and module specific error codes. Module specific - * error codes can further be of two kinds: those that are used - * internally within sub-modules, and those that are made visible - * to other modules. Each module will be pre-allocated a range of - * negative integers from which to choose both internal and external - * error codes uniquely. Note that internally used error codes need - * not be defined in this file so long as they adhere to the allocated - * range. - * - * Author: Mayank D. Upadhyay - * Date: 17-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ - -#ifndef _ANI_ERRORS_H_ -#define _ANI_ERRORS_H_ - -/** - * Indicates that the function returned successfully and no error was - * reported. - */ -#define ANI_OK 0 -#define ANI_ERROR ANI_E_FAILED - -/** - * The range -1 to -1024 is reserved for generic error codes that are - * applicable to all modules. - */ - -#define ANI_E_FAILED -1 /// Generic error code for failure -#define ANI_E_MALLOC_FAILED -2 /// Mem allocation failed -#define ANI_E_ILLEGAL_ARG -3 /// Function argument is illegal -#define ANI_E_NULL_VALUE -4 /// Encountered unexpected NULL value -#define ANI_E_RAND_FAILED -5 /// RNG failed -#define ANI_E_SHORT_PACKET -6 /// Packet is too small to contain data -#define ANI_E_ELEM_NOT_FND -7 /// Element not found -#define ANI_E_INVALID_LEN -8 /// Element has invalid Length -#define ANI_E_INVALID_DT -9 /// Invalid Data Type -#define ANI_E_TIMEOUT -10 /// Timeout occurred -#define ANI_E_DBM_INVALID_ID -11 /// Invalid DB id sent to server -#define ANI_E_DBM_KEY_NOT_FOUND -12 /// Key's mapping was not found -#define ANI_E_FILE_EMPTY -13 /// file empty -#define ANI_E_INVALID_MT -14 /// Invalid ANI message type -#define ANI_E_NOT_IMPLEMENTED -15 /// Feature not implemented -#define ANI_E_INVALID_PT -16 /// Invalid Parameter Type -#define ANI_E_INVALID_PV -17 /// Invalid Paramter Value -#define ANI_E_IPCOPEN -18 /// IPC open failed -#define ANI_E_IPCCONNECT -19 /// IPC connect failed -#define ANI_E_IPCSEND -20 /// IPC send failed -#define ANI_E_FILE_NOT_FOUND -21 /// file not found -#define ANI_E_FILE_INVALID_CONTENT -22 /// invalid file content -#define ANI_E_FILE_READ_FAILED -23 /// file read failed - -// ***** SSM libraries and applications use the range -1025 to -2999 ***** - -/* - * The range -1025 to -2048 is reserved for use by the - * authentication agent and its sub-modules. The sub-range -1029 to - * -1150 is reserved for CLI usage. - */ -#define ANI_E_RANGE_START_AAG -1025 - -// CLI Range starts here... -#define ANI_E_RANGE_START_AAG_CLI -1029 -#define ANI_E_CLI_ARG_MISSING -1029 // CLI command param missing -#define ANI_E_CLI_ARG_INVALID -1030 // CLI command param invalid -#define ANI_E_CLI_PAM_RADIUS_DB_UPDATE_FAILURE -1031 // Failure to update PAM RADIUS DB -#define ANI_E_CLI_AUTH_SERVER_NOT_FOUND -1032 // Auth server not found -#define ANI_E_CLI_SYS_INTERNAL_ERROR_PACKET_NULL -1033 // Internal error -#define ANI_E_CLI_INVALID_DEVICE -1034 // Invalid device -#define ANI_E_CLI_AUTH_SERVER_INVALID_IPADDR -1035 // Invalid IP addr -#define ANI_E_CLI_AUTH_ZONE_NOT_EMPTY -1036 // zone not empty -#define ANI_E_CLI_AUTH_ZONE_AUTH_SERVERS_NOT_COPIED -1037 // zone not copied -#define ANI_E_CLI_AUTH_ZONE_NAME_MISSING -1038 // zone name missing -#define ANI_E_CLI_AUTH_ZONE_EMPTY -1039 // zone empty -#define ANI_E_CLI_AUTH_ZONE_NOT_FOUND -1040 // zone not found -#define ANI_E_CLI_AUTH_SERVER_ARG_NOT_FOUND -1041 // Cli Auth server arg missing -#define ANI_E_CLI_IFNAME_ARG_NOT_FOUND -1042 // Ifname arg missing -#define ANI_E_CLI_KEYINDEX_ARG_NOT_FOUND -1043 // Keyindex arg missing -#define ANI_E_CLI_KEYLENGTH_ARG_NOT_FOUND -1044 // KeyLength arg missing -#define ANI_E_CLI_KEYLENGTH_ARG_INVALID -1045 // KeyLength arg invalid -#define ANI_E_CLI_SET_WEP_KEY_FAILED -1046 // Set Wep key failed -#define ANI_E_CLI_SYS_INTERNAL_ERROR -1047 // Internal error -#define ANI_E_CLI_OLD_PASSWORD_MISSING -1048 // Old password missing -#define ANI_E_CLI_NEW_PASSWORD_MISSING -1049 // New password - // missing -#define ANI_E_CLI_WEP_KEY_LEN_ERROR -1051 // key length error -#define ANI_E_CLI_WEP_KEY_HEX_ERROR -1052 // no hex character -#define ANI_E_CLI_WPA_MODES_CFG_ERROR -1053 // WPA config error -#define ANI_E_CLI_WEP_AND_OPEN_CFG_ERROR -1054 // WEP and open error -#define ANI_E_CLI_OPEN_AND_WEP_CFG_ERROR -1055 // open and WEP error -#define ANI_E_CLI_LEGACY_WEP_AND_OPEN_CFG_ERROR -1056 // WEP and open error -#define ANI_E_CLI_OPEN_AND_LEGACY_WEP_CFG_ERROR -1057 // open and WEP error -#define ANI_E_CLI_WPA_MODES_NOT_AVAILABLE -1058 // WPA modes not active -#define ANI_E_CLI_INVALID_LISENCE_KEY -1059 // invalid license -#define ANI_E_CLI_EXISTING_LISENCE_KEY -1060 // duplicated license -#define ANI_E_CLI_WEP_INVALID_LENGTH_CHANGE -1061 // invalid length change -#define ANI_E_CLI_CNF_PASSWORD_MISMATCH -1062 // confirm password mismatch -#define ANI_E_CLI_INVALID_DISABLE -1063 // cannot disable all sec modes -#define ANI_E_CLI_PACKNUM_RANGE_ERROR -1064 // cannot disable all sec modes -#define ANI_E_CLI_IP_ADDR_INVALID -1065 // IP address invalid -#define ANI_E_CLI_AUTH_ZONE_NAME_INVALID -1066 // zone name invalid -#define ANI_E_CLI_OLD_PASSWORD_INVALID -1067 // Old password invalid -#define ANI_E_CLI_NO_EXT_RAD_ON_NONSECP -1068 // Cannot add ext auth-server on - // non-SEC/P with RAD proxying on -#define ANI_E_CLI_NO_EXT_AUTH_ZONE_ALLOWED -1069 // Cannot add ext auth-zone on - // with RAD proxying on -#define ANI_E_CLI_PORTAL_ZONE_AUTO_CONFIGURED -1070 // Cannot manage portal auth-zone -#define ANI_E_CLI_DEL_REQ_ON_REF_AUTH_SERVER -1071 // Cannot delete auth-server - // that is in a zone -#define ANI_E_CLI_DEL_REQ_ON_REF_AUTH_ZONE -1072 // Cannot delete auth-zone - // that is used by SSID -#define ANI_E_CLI_INVALID_INTERIM_UPDT_VALUE -1073 // Invalid Accounting interim update interval -#define ANI_E_RANGE_END_AAG_CLI -1199 -// ...CLI Range ends here - -// Non-CLI related error codes.. -#define ANI_E_MIC_FAILED -1200 // A MIC check failed -#define ANI_E_REPLAY_CHECK_FAILED -1201 // Replay Ctr mismatch -#define ANI_E_RADIUS_PROFILE_MISSING -1202 // User profile - // not found -#define ANI_E_AUTH_FAILED -1203 // Authentication failed -#define ANI_E_RADIUS_PRIV_LEVEL_MISSING -1204 // ANI_ADMIN_LEVEL is missing -#define ANI_E_RADIUS_PRIV_LEVEL_INCORRECT -1205 // ANI_ADMIN_LEVEL is incorrect - -// For some reason this is not contiguous with the other error codes(???) -#define ANI_E_INVALID_COOKIE -1300 // Invalid cookie - -#define ANI_E_RANGE_END_AAG -2048 - -/* - * The range -2049 to -2148 is reserved for use by the - * RADIUS client side library. - */ -#define ANI_E_RANGE_START_RAD -2049 -#define ANI_E_RAD_FAILED -2049 /// RADIUS operation failed -#define ANI_E_RAD_ATTR_TOO_LONG -2050 /// Attribute too long -#define ANI_E_RAD_UNSOLICITED_RESP -2051 /// Unsolicited response -#define ANI_E_RAD_BAD_RESP_AUTH -2052 /// Response auth check failed -#define ANI_E_RAD_BAD_MESSG_AUTH -2053 /// Response signature invalid -#define ANI_E_RAD_ATTR_NOT_FOUND -2054 /// Requested attr not found -#define ANI_E_RAD_TIMEOUT -2055 /// Request timed out waiting for server -#define ANI_E_RAD_REJECT -2056 /// Radius server did not accept user -#define ANI_E_RANGE_END_RAD -2148 - -/* - * The range -2149 to -2999 is reserved for use by the SSM library. - */ -#define ANI_E_RANGE_START_SSM -2149 -#define ANI_E_SSM_CERT_UNPARSEABLE (ANI_E_RANGE_START_SSM - 1) -#define ANI_E_SSM_CERT_EXPIRED (ANI_E_RANGE_START_SSM - 2) -#define ANI_E_SSM_CERT_THUMBPRINT_MISMATCH (ANI_E_RANGE_START_SSM - 3) -#define ANI_E_SSM_CERT_NEW_ID (ANI_E_RANGE_START_SSM - 4) -#define ANI_E_RANGE_END_SSM -2999 - -/* - * The range -3000 to -3500 is reserved for use by the - * NetSim Server, Client, Client Modules and Pseudo driver - */ -#define ANI_E_RANGE_START_NETSIM -3000 -#define ANI_E_RANGE_END_NETSIM -3500 - -/* - * The range -3501 to -4000 is reserved for use by the - * Discovery Server and its libraries. - */ -#define ANI_E_RANGE_START_DISC -3501 -#define ANI_E_RANGE_END_DISC -4000 - -/* - * The range -4001 to -4500 is reserved for use by the - * Ezcfg Server - */ -#define ANI_E_RANGE_START_EZC -4001 - -// See file aniNmpEzcSvcMsgs.h for EZC specific error codes and messages -#define ANI_E_RANGE_END_EZC -4500 - -/* - * The range -4501 to -4600 is reserved for use by the - * Software Download (SWD) Server - */ -#define ANI_E_RANGE_START_SWD -4501 - -// See file aniSwdSvcMsgs.h for SWD specific error codes and messages -#define ANI_E_RANGE_END_SWD -4600 - -/* - * The range -4601 to -4700 is reserved for use by the - * Data Distribution Service (DDS) Server - */ -#define ANI_E_RANGE_START_DDS -4601 - -// See file aniDdsSvcMsgs.h for DDS specific error codes and messages -#define ANI_E_RANGE_END_DDS -4700 - -/* - * The range -4701 to -4800 is reserved for use by - * HTTPS components. - */ -#define ANI_E_RANGE_START_HTTPS -4701 -#define ANI_E_HTTPS_UNREACHABLE (ANI_E_RANGE_START_HTTPS - 0) -#define ANI_E_HTTPS_UNTRUSTED_CERT (ANI_E_RANGE_START_HTTPS - 1) -#define ANI_E_HTTPS_RECVD_ALERT (ANI_E_RANGE_START_HTTPS - 2) -#define ANI_E_HTTPS_FAILED (ANI_E_RANGE_START_HTTPS - 3) -#define ANI_E_RANGE_END_HTTPS -4800 - -/* - * The range -4801 to -4900 is reserved for use by - * enrollment components. - */ -#define ANI_E_RANGE_START_ENROLLMENT -4801 -#define ANI_E_ENROLL_TP_AVAILABLE (ANI_E_RANGE_START_ENROLLMENT - 0) -#define ANI_E_ENROLL_ALREADY_TRUSTED (ANI_E_RANGE_START_ENROLLMENT - 1) -#define ANI_E_ENROLL_NOT_FOUND (ANI_E_RANGE_START_ENROLLMENT - 2) -#define ANI_E_ENROLL_PWD_FAILED (ANI_E_RANGE_START_ENROLLMENT - 3) -#define ANI_E_ENROLL_FAILED (ANI_E_RANGE_START_ENROLLMENT - 4) -#define ANI_E_ENROLL_NOT_PRISTINE (ANI_E_RANGE_START_ENROLLMENT - 5) -#define ANI_E_RANGE_END_ENROLLMENT -4900 - - -/* - * The range -4901 to -5000 is reserved for use by NSM. - */ -#define ANI_E_RANGE_START_NSM -4901 -#define ANI_E_NSM_IPADDR_ASSIGNED (ANI_E_RANGE_START_NSM - 0) -#define ANI_E_RANGE_END_NSM -5000 - -/* - * The range -5001 to -5100 is reserved for use by the image - * validation library. - */ -#define ANI_E_RANGE_START_IMAGE -5001 -#define ANI_E_IMAGE_INVALID (ANI_E_RANGE_START_IMAGE - 0) -#define ANI_E_IMAGE_UNSUPPORTED (ANI_E_RANGE_START_IMAGE - 1) -#define ANI_E_RANGE_END_IMAGE -5100 - -/* - * The range -5101 to -5200 is reserved for use by CM - */ -#define ANI_E_RANGE_START_CM -5101 -#define ANI_E_MESG_UNAVAILABLE (ANI_E_RANGE_START_IMAGE - 0) -#define ANI_E_RANGE_END_CM -5200 - - -#define ANI_IS_STATUS_SUCCESS( retVal ) ( ( retVal >= 0 ) ) - -#endif //_ANI_ERRORS_H_ diff --git a/CORE/BAP/src/bapRsnSsmAesKeyWrap.c b/CORE/BAP/src/bapRsnSsmAesKeyWrap.c deleted file mode 100644 index 1f826c4cd69d..000000000000 --- a/CORE/BAP/src/bapRsnSsmAesKeyWrap.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmAesKeyWrap.c $ - * - */ -/* - * Contains definitions for the AES Key Wrap algorithm from RFC 3394. - * - * Author: Mayank D. Upadhyay - * Date: 31-March-2003 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ - -#include "vos_types.h" -#include "bapRsnSsmServices.h" -#include "bapRsnSsmEapol.h" -#include "bapRsnErrors.h" -#include "bapInternal.h" -#include "bapRsn8021xFsm.h" -#include "bapRsn8021xAuthFsm.h" -#include "vos_utils.h" -#include "vos_memory.h" -#include "vos_timer.h" -#include "bapRsnTxRx.h" -#include "bapRsnSsmAesKeyWrap.h" - -#if 0 - -#include <assert.h> -#include <stdlib.h> -#include <openssl/aes.h> - -#include <aniAsfHdr.h> -#include <aniUtils.h> -#include <aniErrors.h> -#include <aniAsfLog.h> - -#include "aniSsmAesKeyWrap.h" -#include "aniSsmUtils.h" -#endif - -#define ANI_SSM_AES_KEY_WRAP_IC_SIZE ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE - -typedef struct tag_aes_key { - tANI_U32 eK[64], dK[64]; - int Nr; -} AES_KEY; - -static tANI_U8 gAniSsmAesKeyWrapIv[] = { - 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6 -}; - -static int -aes(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen, - tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 b[AES_BLOCK_SIZE]); - -static int -aes_1(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen, - tANI_U8 at[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 b[AES_BLOCK_SIZE]); - -static int -xor(tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U32 t); - -/** - * Implements the AES Key Wrap algorithm described in RFC 3394. - * If n is the number of blocks in plainText, of size - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1) - * blocks. The first block is the IV from section 2.2.3 o the - * RFC. Note: It is the caller's responsibility to free the returned - * value. - * - * @param plainText the plaintext data to wrap - * @param len the length of the plaintext, which must be a multiple of - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE. - * @param keyEncKey the encryption key - * @param keyEncKeyLen the length of keyEncKey - * @param cipherTextPtr is set to a newly allocated array containing - * the result if the operation succeeds. It is the caller's - * responsibility to free this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmAesKeyWrap(v_U32_t cryptHandle, tANI_U8 *plainText, tANI_U32 len, - tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen, - tANI_U8 **cipherTextPtr) -{ - int i, j, n; - int retVal; - - tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE]; - tANI_U8 *r = NULL; - tANI_U32 t; - - tANI_U8 b[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2]; - - n = len / ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; - if ((len % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Illegal number of input bytes to AES Key Wrap!"); - return ANI_E_ILLEGAL_ARG; - } - - // Allocate enough storage for 'A' as well as 'R' - r = vos_mem_malloc((n + 1) * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - if (r == NULL) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Could not allocate space for R"); - return ANI_E_MALLOC_FAILED; - } - - vos_mem_copy(a, gAniSsmAesKeyWrapIv, sizeof(a)); - vos_mem_copy(r + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, plainText, len); - - for (j = 0; j <= 5; j++) { - for (i = 1; i <= n; i++) { - - retVal = aes(cryptHandle, keyEncKey, keyEncKeyLen, - a, - r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - b); - - if( !ANI_IS_STATUS_SUCCESS( retVal) ) goto error; - - vos_mem_copy(a, b, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - t = n*j + i; - xor(a, t); - vos_mem_copy(r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - b + sizeof(b) - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - } - } - - vos_mem_copy(r, a, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - *cipherTextPtr = r; - - return ANI_OK; - - error: - if (r != NULL) - vos_mem_free(r); - - return retVal; - -} - -/** - * Implements the AES Key Unwrap algorithm described in RFC 3394. - * If (n+1) is the number of blocks in cipherText, of size - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1) - * blocks. The actual plaintext consists of n blocks that start at the - * second block. Note: It is the caller's responsibility to free the - * returned value. - * - * @param cipherText the cipertext data to unwrap - * @param len the length of the ciphertext, which must be a multiple of - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE. - * @param keyEncKey the encryption key - * @param keyEncKeyLen the length of keyEncKey - * @param plainTextPtr is set to a newly allocated array containing - * the result if the operation succeeds. It is the caller's - * responsibility to free this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmAesKeyUnwrap(v_U32_t cryptHandle, tANI_U8 *cipherText, tANI_U32 len, - tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen, - tANI_U8 **plainTextPtr) -{ - int i, j; - int retVal; - - tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE]; - tANI_U8 *r = NULL; - tANI_U32 n; - tANI_U32 t; - - tANI_U8 b[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2]; - - n = len / ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE - 1; - if ((len % ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Illegal number of input bytes to AES Key Unwrap!"); - return ANI_E_ILLEGAL_ARG; - } - - // Allocate enough storage for 'A' as well as 'R' - r = vos_mem_malloc((n + 1) * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - if (r == NULL) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Could not allocate space for R"); - return ANI_E_MALLOC_FAILED; - } - - vos_mem_copy(a, cipherText, sizeof(a)); - vos_mem_copy(r + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - cipherText + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - len - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - - for (j = 5; j >= 0; j--) { - for (i = n; i >= 1; i--) { - - t = n*j + i; - xor(a, t); - retVal = aes_1(cryptHandle, keyEncKey, keyEncKeyLen, - a, - r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - b); - if( !ANI_IS_STATUS_SUCCESS( retVal) ) goto error; - - vos_mem_copy(a, b, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - vos_mem_copy(r + i*ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - b + sizeof(b) - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - } - } - - if (vos_mem_compare2(a, gAniSsmAesKeyWrapIv, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE) != 0) { - retVal = ANI_E_MIC_FAILED; - goto error; - } - - *plainTextPtr = r; - - return ANI_OK; - - error: - if (r != NULL) - vos_mem_free(r); - - return retVal; -} - -static int -aes(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen, - tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 b[AES_BLOCK_SIZE]) { - - int retVal = 0; - -// AES_KEY aesKey; - - tANI_U8 in[AES_BLOCK_SIZE]; - tANI_U8 *out; - - // Concatenate A and R[i] - vos_mem_copy(in, a, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - vos_mem_copy(in + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - ri, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - out = b; - -#if 0 - retVal = AES_set_encrypt_key(keyBytes, keyLen*8, &aesKey); - if (retVal != 0) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "AES_set_encrypt_key returned %d", retVal); - return ANI_E_FAILED; - } - - AES_encrypt(in, out, &aesKey); -#else // Enable to use VOS function - retVal = vos_encrypt_AES(cryptHandle, /* Handle */ - in, /* input */ - out, /* output */ - keyBytes); /* key */ - if (retVal != 0) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "vos_encrypt_AES returned %d", retVal); - return ANI_E_FAILED; - } -#endif - return ANI_OK; -} - -static int -aes_1(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen, - tANI_U8 at[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], - tANI_U8 b[AES_BLOCK_SIZE]) { - - int retVal; - -// AES_KEY aesKey; - - tANI_U8 in[AES_BLOCK_SIZE]; - tANI_U8 *out; - - // Concatenate A and R[i] - vos_mem_copy(in, at, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - vos_mem_copy(in + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, - ri, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); - out = b; - -#if 0 - retVal = AES_set_decrypt_key(keyBytes, keyLen*8, &aesKey); - if (retVal != 0) { - ANI_SSM_LOG_E("AES_set_encrypt_key returned %d", retVal); - assert(0 && "AES_set_encrypt_key failed!"); - return ANI_E_FAILED; - } - - AES_decrypt(in, out, &aesKey); -#else - retVal = vos_decrypt_AES(cryptHandle, /* Handle */ - in, /* input */ - out, /* output */ - keyBytes); /* key */ - if (retVal != 0) { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "vos_decrypt_AES returned %d", retVal); - } -#endif - return ANI_OK; -} - -// From File : aniAsfHdr.h - - - -/* - * Put a long in host order into a char array in network order. - * - */ -static inline char *aniAsfWr32(char *cp, tANI_U32 x) -{ - tAniU32ValAry r; - int i; - - r.val = vos_cpu_to_be32(x); - i = sizeof(tANI_U32) - 1; - cp[3] = r.ary[i--]; - cp[2] = r.ary[i--]; - cp[1] = r.ary[i--]; - cp[0] = r.ary[i]; - - return (cp + sizeof(tANI_U32)); -} - -// From file : aniAsfMisc.c - -/* - * Put a long in host order into a char array in network order. - * - */ -char *aniAsfPut32(char *cp, tANI_U32 x) -{ - return(aniAsfWr32(cp, x)); -} - - -static int -xor(tANI_U8 a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U32 t) -{ - tANI_U8 tmp[4]; - aniAsfPut32((char *)tmp, t); - a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-1] ^= tmp[3]; - a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-2] ^= tmp[2]; - a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-3] ^= tmp[1]; - a[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE-4] ^= tmp[0]; - return ANI_OK; -} diff --git a/CORE/BAP/src/bapRsnSsmAesKeyWrap.h b/CORE/BAP/src/bapRsnSsmAesKeyWrap.h deleted file mode 100644 index b3a3e95b615d..000000000000 --- a/CORE/BAP/src/bapRsnSsmAesKeyWrap.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * Ref File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/include/aniSsmAesKeyWrap.h $ - * - */ -/* - * Contains SSM-private declarations related to the AES key WRAP - * algorithm described in RFC 3394. - * - * Author: Arul V Raj - * Date: 27-February-2009 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ - -#ifndef _ANI_SSM_AES_KEY_WRAP_H_ -#define _ANI_SSM_AES_KEY_WRAP_H_ - -#define ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE 8 // Bytes -#define AES_BLOCK_SIZE 16 // Bytes - -typedef union uAniU32ValAry{ - tANI_U32 val; - char ary[sizeof(tANI_U32)]; -} tAniU32ValAry; - -/** - * Implements the AES Key Wrap algorithm described in RFC 3394. - * If n is the number of blocks in plainText, of size - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1) - * blocks. The first block is the IV from section 2.2.3 o the - * RFC. Note: It is the caller's responsibility to free the returned - * value. - * - * @param plainText the plaintext data to wrap - * @param len the length of the plaintext, which must be a multiple of - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE. - * @param keyEncKey the encryption key - * @param keyEncKeyLen the length of keyEncKey - * @param cipherTextPtr is set to a newly allocated array containing - * the result if the operation succeeds. It is the caller's - * responsibility to free this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmAesKeyWrap(v_U32_t cryptHandle, tANI_U8 *plainText, tANI_U32 len, - tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen, - tANI_U8 **cipherTextPtr); - -/** - * Implements the AES Key Unwrap algorithm described in RFC 3394. - * If (n+1) is the number of blocks in cipherText, of size - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, then the output value is (n+1) - * blocks. The actual plaintext consists of n blocks that start at the - * second block. Note: It is the caller's responsibility to free the - * returned value. - * - * @param cipherText the cipertext data to unwrap - * @param len the length of the ciphertext, which must be a multiple of - * ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE. - * @param keyEncKey the encryption key - * @param keyEncKeyLen the length of keyEncKey - * @param plainTextPtr is set to a newly allocated array containing - * the result if the operation succeeds. It is the caller's - * responsibility to free this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmAesKeyUnwrap(v_U32_t cryptHandle, tANI_U8 *cipherText, tANI_U32 len, - tANI_U8 *keyEncKey, tANI_U32 keyEncKeyLen, - tANI_U8 **plainTextPtr); - - -#endif //_ANI_SSM_AES_KEY_WRAP_H_ diff --git a/CORE/BAP/src/bapRsnSsmEapol.c b/CORE/BAP/src/bapRsnSsmEapol.c deleted file mode 100644 index bf42b8b3593e..000000000000 --- a/CORE/BAP/src/bapRsnSsmEapol.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmEapol.c#2 $ - * - */ -/* - * Contains definitions of various utilities for EAPoL frame - * parsing and creation. - * - * Author: Mayank D. Upadhyay - * Date: 19-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#include "vos_utils.h" -#include <bapRsnAsfPacket.h> -#include <bapRsnErrors.h> -#include <bapRsnSsmEapol.h> -#include "bapRsn8021xFsm.h" -#include "vos_memory.h" - -//#include "aniSsmUtils.h" - - -//TODO: Put these in an array after EAPOL_TYPE is made an enum -#define ANI_EAPOL_TYPE_PACKET_STR "EAP" -#define ANI_EAPOL_TYPE_START_STR "START" -#define ANI_EAPOL_TYPE_LOGOFF_STR "LOGOFF" -#define ANI_EAPOL_TYPE_KEY_STR "KEY" -#define ANI_EAPOL_TYPE_ASF_ALERT_STR "ALERT" -#define ANI_EAPOL_TYPE_UNKNOWN_STR "UNKNOWN" - -/** - * The EAPOL packet is structured as follows: - */ -#define DST_MAC_POS 0 -#define SRC_MAC_POS 6 -#define ETHER_PROTO_POS 12 -#define EAPOL_VERSION_POS 14 -#define ANI_EAPOL_TYPE_POS 15 -#define EAPOL_BODY_LEN_POS 16 -#define EAPOL_BODY_POS EAPOL_RX_HEADER_SIZE - -#define EAPOL_BODY_LEN_SIZE 2 - -#define ANI_SSM_LEGACY_RC4_KEY_SIGN_OFFSET (EAPOL_BODY_POS + 28) - -/** - * Bitmasks for the RSN Key Information field - */ -#define ANI_SSM_RSN_KEY_DESC_VERS_MASK 0x0007 -#define ANI_SSM_RSN_UNICAST_MASK 0x0008 -#define ANI_SSM_RSN_KEY_INDEX_MASK 0x0030 -#define ANI_SSM_RSN_INSTALL_MASK 0x0040 -#define ANI_SSM_RSN_ACK_MASK 0x0080 -#define ANI_SSM_RSN_MIC_MASK 0x0100 -#define ANI_SSM_RSN_SECURE_MASK 0x0200 -#define ANI_SSM_RSN_ERROR_MASK 0x0400 -#define ANI_SSM_RSN_REQUEST_MASK 0x0800 -#define ANI_SSM_RSN_ENC_KEY_DATA_MASK 0x1000 - -#define ANI_SSM_RSN_KEY_DESC_VERS_OFFSET 0 -#define ANI_SSM_RSN_KEY_INDEX_OFFSET 4 - -#define ANI_SSM_RSN_KEY_MIC_OFFSET (EAPOL_BODY_POS + 77) - -/** - * Other hard coded values for convenience: - */ -static const v_U8_t -ANI_ETH_P_EAPOL_BYTES[2] = {0x00, 0x03};//BT-AMP security type{0x88, 0x8e}; -static const v_U8_t -EAPOL_VERSION_BYTES[1] = {EAPOL_VERSION_1}; -static const v_U8_t -ANI_EAPOL_TYPE_PACKET_BYTES[1] = {ANI_EAPOL_TYPE_PACKET}; -static const v_U8_t -ANI_EAPOL_TYPE_START_BYTES[1] = {ANI_EAPOL_TYPE_START}; -static const v_U8_t -ANI_EAPOL_TYPE_LOGOFF_BYTES[1] = {ANI_EAPOL_TYPE_LOGOFF}; -static const v_U8_t -ANI_EAPOL_TYPE_KEY_BYTES[1] = {ANI_EAPOL_TYPE_KEY}; -static const v_U8_t -ANI_EAPOL_TYPE_ASF_ALERT_BYTES[1] = {ANI_EAPOL_TYPE_ASF_ALERT}; -static const v_U8_t -ZERO_BYTES[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static v_U8_t BAP_RSN_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 }; - - - -static int -parseRsnKeyDesc(tAniPacket *packet, - tAniEapolRsnKeyDesc **rsnDescPtr); - -static int -parseRsnKeyInfo(tAniPacket *packet, - tAniRsnKeyInfo *info); - -static int -writeRsnKeyDesc(tAniPacket *packet, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t keyDescType); - -static int -writeRsnKeyInfo(tAniPacket *packet, tAniRsnKeyInfo *info); - -static int -writeRsnKeyMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t *micKey, - v_U32_t micKeyLen); - -static int -checkRsnKeyMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t *micKey, - v_U32_t micKeyLen); - -extern void authEapolHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - v_U8_t *type); -extern void suppEapolHandler( tSuppRsnFsm *fsm, tAniPacket *eapolFrame, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - v_U8_t *type); - -/** - * addEapolHeaders - * - * FUNCTION: - * Prepends the EAPOL header to a packet. - * - * ASSUMPTIONS: - * The packet has enough space available for prepending the EAPOL - * header. - * - * @param packet the packet to prepend to - * @param dstMac the MAC address of the destination (authenticator) - * @param srcMac the MAC address of the source (supplicant) - * @param eapolType the EAPOL-Type field - * - * @return ANI_OK if the operation succeeds - */ -static int -addEapolHeaders(tAniPacket *packet, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - v_U8_t eapolType) -{ - int retVal; - v_U16_t len; - - do - { - retVal = aniAsfPacketGetLen(packet); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - len = retVal; - retVal = aniAsfPacketPrepend16(packet, len); - - retVal = aniAsfPacketPrepend8(packet, eapolType); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketPrependBuffer(packet, EAPOL_VERSION_BYTES, 1); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketPrependBuffer(packet, ANI_ETH_P_EAPOL_BYTES, 2); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - //Since TL expects SNAP header in all packets we send, put it in - retVal = aniAsfPacketPrependBuffer(packet, BAP_RSN_LLC_HEADER, sizeof(BAP_RSN_LLC_HEADER)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - //packet length - len += 6/*length + eapolType+version + eth_type*/ + sizeof(BAP_RSN_LLC_HEADER); - retVal = aniAsfPacketPrepend16(packet, len); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketPrependBuffer(packet, srcMac, sizeof(tAniMacAddr)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketPrependBuffer(packet, dstMac, sizeof(tAniMacAddr)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - }while( 0 ); - - return retVal; -} - -/** - * aniEapolWriteStart - * - * FUNCTION: - * Writes an EAPOL-Start frame to the packet. It is only used by the - * supplicant. - * - * LOGIC: - * Prepend the appropriate EAPOL header to the packet. There is no - * EAPOL payload for this kind of frame. - * - * ASSUMPTIONS: - * The packet has enough space available for prepending the header. - * - * @param packet the packet to which the frame should be written - * @param dstMac the MAC address of the destination (authenticator) - * @param srcMac the MAC address of the source (supplicant) - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolWriteStart(tAniPacket *packet, - tAniMacAddr dstMac, - tAniMacAddr srcMac) -{ - return ( addEapolHeaders(packet, dstMac, srcMac, ANI_EAPOL_TYPE_START) ); -} - -/** - * aniEapolWriteEapPacket - * - * FUNCTION: - * Writes the EAPOL/EAP-Packet frame headers. It is used - * by both the authenticator and the supplicant. This creates an EAPOL - * frame that is carrying an EAP message as its payload. - * - * LOGIC: - * Prepend the appropriate EAPOL header to the packet. - * - * ASSUMPTIONS: - * The EAP message (ie., the payload) is already available in the - * packet and that the packet has enough space available for - * prepending the EAPOL header. - * - * @param packet the packet containing the EAP message - * @param dstMac the MAC address of the destination (authenticator) - * @param srcMac the MAC address of the source (supplicant) - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolWriteEapPacket(tAniPacket *eapPacket, - tAniMacAddr dstMac, - tAniMacAddr srcMac) -{ - return( addEapolHeaders(eapPacket, dstMac, srcMac, ANI_EAPOL_TYPE_PACKET) ); -} - -/** - * aniEapolParse - * - * FUNCTION: - * Parses an EAPoL frame to the first level of headers (no EAP - * headers are parsed). - * - * NOTE: This is a non-destructive read, that is the - * headers are not stripped off the packet. However, any additional - * data at the end of the packet, beyond what the EAPoL headers encode - * will be stripped off. - * - * @param packet the packet containing the EAPoL frame to parse - * @param dstMac a pointer to set to the location of the destination - * MAC address - * @param srcMac a pointer to set to the location of the source - * MAC address - * @param type a pointer to set to the location of the EAPOL type - * field. - * - * @return the non-negative length of the EAPOL payload if the operation - * succeeds - */ -int -aniEapolParse(tAniPacket *packet, - v_U8_t **dstMac, - v_U8_t **srcMac, - v_U8_t **type) -{ - v_U16_t frameType; - v_U8_t *ptr; - int retVal; - int tmp; - - if (aniAsfPacketGetLen(packet) < EAPOL_BODY_POS) - return ANI_E_ILLEGAL_ARG; - - retVal = aniAsfPacketGetBytes(packet, &ptr); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Supp parsing EAPOL packet of len %d: \n", - retVal); - - frameType = (ptr[ETHER_PROTO_POS] << 8) + ptr[ETHER_PROTO_POS+1]; - - /* - * Validate the EAPOL-FRAME - */ - - if (frameType != ANI_ETH_P_EAPOL) - return ANI_E_ILLEGAL_ARG; - - *dstMac = ptr + DST_MAC_POS; - *srcMac = ptr + SRC_MAC_POS; - - // if (ptr[EAPOL_VERSION_POS] != EAPOL_VERSION_1) - // return ANI_E_ILLEGAL_ARG; - - *type = ptr + ANI_EAPOL_TYPE_POS; - retVal = (ptr[EAPOL_BODY_LEN_POS] << 8) + ptr[EAPOL_BODY_LEN_POS + 1]; - - /* - * Validate the length of the body. Allow for longer - * packets than encoded, but encoding should not be larger than - * packet. - * Note: EAPOL body len does not include headers - */ - tmp = aniAsfPacketGetLen(packet) - EAPOL_RX_HEADER_SIZE; - if (retVal > tmp) - { - retVal = ANI_E_ILLEGAL_ARG; - } - else { - if (retVal < tmp) - { - retVal = aniAsfPacketTruncateFromRear(packet, tmp - retVal); - } - } - - return retVal; -} - -/** - * aniEapolWriteKey - * - * Writes out a complete EAPOL-Key frame. The key descriptor is - * appended to the packet and the EAPOL header is prepended to it. If - * a micKey is passed in, then a MIC is calculated and inserted into - * the frame. - * - * @param packet the packet to write to - * @param dstMac the destination MAC address - * @param srcMac the source MAC address - * @param descType the key descriptor type - * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or - * ANI_EAPOL_KEY_DESC_TYPE_RSN). - * @param keyDescData the key descriptor data corresponding to the - * above descType. The signature field is ignored and will be - * generated in the packet. The key bytes are expected to be encrypted - * if they need to be encrypted. - * @param micKey the MIC key - * @param micKeyLen the number of bytes in the MIC key - * - * @return ANI_OK if the operation succeeds - * - */ -int -aniEapolWriteKey(v_U32_t cryptHandle, - tAniPacket *packet, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - int descType, - void *keyDescData, - v_U8_t *micKey, - v_U32_t micKeyLen) -{ - int retVal; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - do - { - if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) - { - - retVal = writeRsnKeyDesc(packet, - (tAniEapolRsnKeyDesc *) keyDescData, - // Indicate - // ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW - // or ANI_EAPOL_KEY_DESC_TYPE_RSN - descType); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - break; - } - - retVal = addEapolHeaders(packet, dstMac, srcMac, ANI_EAPOL_TYPE_KEY); - if( !ANI_IS_STATUS_SUCCESS(retVal) ) break; - - retVal = writeRsnKeyMic(cryptHandle, - packet, - (tAniEapolRsnKeyDesc *) keyDescData, - micKey, micKeyLen); - if( !ANI_IS_STATUS_SUCCESS(retVal) ) break; - - } - else { - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - } - }while( 0 ); - - return retVal; -} - - -/** - * aniEapolParseKey - * - * Parses and verifies a complete EAPOL-Key frame. The key descriptor - * type is returned and so is a newly allocated key descriptor structure - * that is appropriate for the type. - * - * NOTE: This is a non-destructive read. That is, the packet headers - * will be unchanged at the end of this read operation. This is so - * that a followup MIC check may be done on the complete packet. If - * the packet parsing fails, the packet headers are not guaranteed to - * be unchanged. - * - * @param packet the packet to read from. Note that the frame is not - * expected to contain any additional padding at the end other than - * the exact number of key bytes. (The aniEapolParse function will - * ensure this.) - * @param descType is set to the key descriptor type - * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or - * ANI_EAPOL_KEY_DESC_TYPE_RSN). - * @param keyDescData is set to a newly allocated key descriptor - * corresponding to the above descType. The signature field is - * verified. The key bytes will be returned encrypted. It is the - * responsibility of the caller to free this structure and the data - * contained therein. - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolParseKey(tAniPacket *packet, - int *descType, - void **keyDescData) -{ - int retVal; - v_U8_t *bytes; - v_U32_t eapolFrameLen; - - if (packet == NULL) - return ANI_E_NULL_VALUE; - - do - { - eapolFrameLen = aniAsfPacketGetLen(packet); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "Supp parsing EAPOL-Key frame of len %d\n", - eapolFrameLen); - - retVal = aniAsfPacketTruncateFromFront(packet, EAPOL_RX_HEADER_SIZE); - if( !ANI_IS_STATUS_SUCCESS(retVal) ) break; - - retVal = aniAsfPacketGetBytes(packet, &bytes); - if( !ANI_IS_STATUS_SUCCESS(retVal) ) break; - - if (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN || - *bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - { - tAniEapolRsnKeyDesc *rsnDesc = NULL; - - //*descType = ANI_EAPOL_KEY_DESC_TYPE_RSN; - *descType = (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW ? - ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW : ANI_EAPOL_KEY_DESC_TYPE_RSN) ; - retVal = parseRsnKeyDesc(packet, &rsnDesc); - if( !ANI_IS_STATUS_SUCCESS(retVal) ) break; - *keyDescData = rsnDesc; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp received unknown EAPOL-Key descriptor: %d\n", - *bytes); - retVal = ANI_E_ILLEGAL_ARG; - break; - } - - aniAsfPacketMoveLeft(packet, eapolFrameLen); - }while( 0 ); - - return retVal; -} - - - -static int -parseRsnKeyDesc(tAniPacket *packet, - tAniEapolRsnKeyDesc **rsnDescPtr) -{ - int retVal = ANI_OK; - int len; - v_U8_t *bytes; - tAniEapolRsnKeyDesc *rsnDesc = NULL; - - do - { - aniAsfPacketTruncateFromFront(packet, 1); // Desc-Type - - rsnDesc = (tAniEapolRsnKeyDesc *) - vos_mem_malloc( sizeof(tAniEapolRsnKeyDesc) ); - - if (rsnDesc == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp could not malloc EAPOL-Key Descriptor for RSN\n"); - retVal = ANI_E_MALLOC_FAILED; - break; - } - - retVal = parseRsnKeyInfo(packet, &rsnDesc->info); - if (retVal != ANI_OK) break; - - retVal = aniAsfPacketGet16(packet, &rsnDesc->keyLen); - if (retVal != ANI_OK) - { - break; - } - - len = sizeof(rsnDesc->replayCounter); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->replayCounter, bytes, len); - - len = sizeof(rsnDesc->keyNonce); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->keyNonce, bytes, len); - - len = sizeof(rsnDesc->keyIv); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->keyIv, bytes, len); - - len = sizeof(rsnDesc->keyRecvSeqCounter); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->keyRecvSeqCounter, bytes, len); - - len = sizeof(rsnDesc->keyId); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->keyId, bytes, len); - - len = sizeof(rsnDesc->keyMic); - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - vos_mem_copy(rsnDesc->keyMic, bytes, len); - - retVal = aniAsfPacketGet16(packet, &rsnDesc->keyDataLen); - if (retVal != ANI_OK) - { - break; - } - - len = rsnDesc->keyDataLen; - if (len > 0) { - // We have a key - retVal = aniAsfPacketGetN(packet, len, &bytes); - if (retVal != ANI_OK) - { - break; - } - rsnDesc->keyData = (v_U8_t*)vos_mem_malloc(len); - if (rsnDesc->keyData == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Could not allocate RSN key bytes!\n"); - VOS_ASSERT( 0 ); - retVal = ANI_E_MALLOC_FAILED; - break; - } - vos_mem_copy(rsnDesc->keyData, bytes, len); - } - else { - rsnDesc->keyData = NULL; - } - - *rsnDescPtr = rsnDesc; - - }while( 0 ); - - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - vos_mem_free(rsnDesc); - } - - return retVal; -} - -static int -parseRsnKeyInfo(tAniPacket *packet, - tAniRsnKeyInfo *info) -{ - v_U16_t tmp; - int retVal; - - retVal = aniAsfPacketGet16(packet, &tmp); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - return retVal; - } - - info->keyDescVers = (tmp & ANI_SSM_RSN_KEY_DESC_VERS_MASK) - >> ANI_SSM_RSN_KEY_DESC_VERS_OFFSET; - if (info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_RC4 && - info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_AES) - return ANI_E_ILLEGAL_ARG; - - info->unicastFlag = (tmp & ANI_SSM_RSN_UNICAST_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->keyId = (tmp & ANI_SSM_RSN_KEY_INDEX_MASK) - >> ANI_SSM_RSN_KEY_INDEX_OFFSET; - info->installFlag = (tmp & ANI_SSM_RSN_INSTALL_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->ackFlag = (tmp & ANI_SSM_RSN_ACK_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->micFlag = (tmp & ANI_SSM_RSN_MIC_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->secureFlag = (tmp & ANI_SSM_RSN_SECURE_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->errorFlag = (tmp & ANI_SSM_RSN_ERROR_MASK) ? - eANI_BOOLEAN_TRUE: eANI_BOOLEAN_FALSE; - info->requestFlag = (tmp & ANI_SSM_RSN_REQUEST_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - info->encKeyDataFlag = (tmp & ANI_SSM_RSN_ENC_KEY_DATA_MASK) ? - eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE; - - return ANI_OK; -} - - -static int -writeRsnKeyDesc(tAniPacket *packet, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t keyDescType) -{ - int retVal; - - do - { - // This can be either ANI_EAPOL_KEY_DESC_TYPE_RSN - // or ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW - retVal = aniAsfPacketAppend8(packet, keyDescType); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = writeRsnKeyInfo(packet, &rsnDesc->info); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppend16(packet, rsnDesc->keyLen); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->replayCounter, - sizeof(rsnDesc->replayCounter)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->keyNonce, - sizeof(rsnDesc->keyNonce)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->keyIv, - sizeof(rsnDesc->keyIv)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->keyRecvSeqCounter, - sizeof(rsnDesc->keyRecvSeqCounter)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->keyId, - sizeof(rsnDesc->keyId)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - // Zero out the key MIC - retVal = aniAsfPacketAppendBuffer(packet, - ZERO_BYTES, - sizeof(rsnDesc->keyMic)); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - retVal = aniAsfPacketAppend16(packet, rsnDesc->keyDataLen); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - - if (rsnDesc->keyDataLen != 0) - { - retVal = aniAsfPacketAppendBuffer(packet, - rsnDesc->keyData, - rsnDesc->keyDataLen); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - } - }while( 0 ); - - return retVal; -} - -static int -writeRsnKeyInfo(tAniPacket *packet, tAniRsnKeyInfo *info) -{ - int retVal; - v_U16_t tmp; - v_U16_t infoValue; - - infoValue = 0; - - tmp = (v_U16_t)info->keyDescVers; - tmp = tmp << ANI_SSM_RSN_KEY_DESC_VERS_OFFSET; - infoValue |= (tmp & ANI_SSM_RSN_KEY_DESC_VERS_MASK); - - if (info->unicastFlag) - infoValue |= ANI_SSM_RSN_UNICAST_MASK; - - tmp = info->keyId; - tmp = tmp << ANI_SSM_RSN_KEY_INDEX_OFFSET; - infoValue |= (tmp & ANI_SSM_RSN_KEY_INDEX_MASK); - - if (info->installFlag) - infoValue |= ANI_SSM_RSN_INSTALL_MASK; - - if (info->ackFlag) - infoValue |= ANI_SSM_RSN_ACK_MASK; - - if (info->micFlag) - infoValue |= ANI_SSM_RSN_MIC_MASK; - - if (info->secureFlag) - infoValue |= ANI_SSM_RSN_SECURE_MASK; - - if (info->errorFlag) - infoValue |= ANI_SSM_RSN_ERROR_MASK; - - if (info->requestFlag) - infoValue |= ANI_SSM_RSN_REQUEST_MASK; - - if (info->encKeyDataFlag) - infoValue |= ANI_SSM_RSN_ENC_KEY_DATA_MASK; - - retVal = aniAsfPacketAppend16(packet, infoValue); - - return retVal; -} - - -static int -writeRsnKeyMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t *micKey, - v_U32_t micKeyLen) -{ - int retVal = ANI_OK; - int len; - - v_U8_t *ptr = NULL; - v_U8_t *micPos = NULL; - v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two - - // Sanity check the arguments and return if no MIC generation is - // needed - if (micKey != NULL) - { - if (micKeyLen == 0 || !rsnDesc->info.micFlag) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp MIC key provided but micKeyLen or micFlag is not set!\n"); - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - } - } - else { - if (rsnDesc->info.micFlag) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp micFlag is set but MIC key not provided!\n"); - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - } - // Normal condition where MIC is not desired by the caller - return ANI_OK; - } - - len = aniAsfPacketGetBytes(eapolFrame, &ptr); - if( !ANI_IS_STATUS_SUCCESS( len ) ) - { - return len; - } - - micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET + SNAP_HEADER_SIZE; - - // Clear the MIC field in the packet before the MIC computation - vos_mem_zero( micPos, VOS_DIGEST_MD5_SIZE); - - // Skip to the EAPOL version field for MIC computation - ptr += EAPOL_VERSION_POS + SNAP_HEADER_SIZE; - len -= (EAPOL_VERSION_POS + SNAP_HEADER_SIZE); - - if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) - { - if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) ) - { - retVal = ANI_OK; - } - else - { - retVal = ANI_ERROR; - } - } - else { - VOS_ASSERT( 0 ); - retVal = ANI_E_ILLEGAL_ARG; - } - - if (retVal == ANI_OK) - { - // Copy only 16B which is the smaller of the two and the same as - // ANI_EAPOL_KEY_RSN_MIC_SIZE - vos_mem_copy(micPos, result, VOS_DIGEST_MD5_SIZE); - } - - return retVal; -} - -/** - * aniEapolKeyCheckMic - * - * @param eapolFrame the complete EAPOL-Key packet - * @param descType the key descriptor type - * @param keyDescData the key descriptor - * @param micKey the MIC key - * @param micKeyLen the number of bytes in the MIC key - * - * @return ANI_OK if the operation succeeds; ANI_E_MIC_FAILED if the - * MIC check fails. - */ -int -aniEapolKeyCheckMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - int descType, - void *keyDescData, - v_U8_t *micKey, - v_U32_t micKeyLen) -{ - if (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - { - return checkRsnKeyMic(cryptHandle, eapolFrame, keyDescData, micKey, micKeyLen); - } - else { - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - } -} - - -static int -checkRsnKeyMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - tAniEapolRsnKeyDesc *rsnDesc, - v_U8_t *micKey, - v_U32_t micKeyLen) -{ - int retVal = ANI_ERROR; - int len; - - v_U8_t *ptr = NULL; - v_U8_t *micPos = NULL; - - v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two - v_U8_t incomingMic[ANI_EAPOL_KEY_RSN_MIC_SIZE]; - - if (!rsnDesc->info.micFlag) - { - VOS_ASSERT( 0 ); - return ANI_E_ILLEGAL_ARG; - } - - len = aniAsfPacketGetBytes(eapolFrame, &ptr); - if( ANI_IS_STATUS_SUCCESS( len ) ) - { - micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET; - - // Skip to the EAPOL version field for MIC computation - ptr += EAPOL_VERSION_POS; - len -= EAPOL_VERSION_POS; - - // Copy existing MIC to temporary location and zero it out - vos_mem_copy( incomingMic, micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE ); - vos_mem_zero( micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE ); - - if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) - { - if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) ) - { - retVal = ANI_OK; - } - } - else { - VOS_ASSERT( 0 ); - retVal = ANI_E_ILLEGAL_ARG; - } - - if (retVal == ANI_OK) - { - if ( !vos_mem_compare(incomingMic, result, ANI_EAPOL_KEY_RSN_MIC_SIZE)) - { - retVal = ANI_E_MIC_FAILED; - } - } - } - - return retVal; -} - -/** - * aniEapolKeyFreeDesc - * - * Frees the EAPOL key descriptor and the key bytes contained within it. - * - * @param descType the key descriptor type - * @param keyDescData the key descriptor - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolKeyFreeDesc(int descType, void *keyDescData) -{ - tAniEapolRsnKeyDesc *rsnDesc; - - if( keyDescData ) - { - if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW) - || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN)) - { - - rsnDesc = (tAniEapolRsnKeyDesc *) keyDescData; - if (rsnDesc->keyData != NULL) - vos_mem_free(rsnDesc->keyData); - - } - else { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Supp asked to free illegal type: %d\n", descType); - - } - - vos_mem_free(keyDescData); - } - - return ANI_OK; -} - -v_U8_t * -aniEapolType2Str(v_U8_t type) -{ - switch (type) - { - case ANI_EAPOL_TYPE_PACKET: - return (v_U8_t *)ANI_EAPOL_TYPE_PACKET_STR; - break; - case ANI_EAPOL_TYPE_START: - return (v_U8_t *)ANI_EAPOL_TYPE_START_STR; - break; - case ANI_EAPOL_TYPE_LOGOFF: - return (v_U8_t *)ANI_EAPOL_TYPE_LOGOFF_STR; - break; - case ANI_EAPOL_TYPE_KEY: - return (v_U8_t *)ANI_EAPOL_TYPE_KEY_STR; - break; - case ANI_EAPOL_TYPE_ASF_ALERT: - return (v_U8_t *)ANI_EAPOL_TYPE_ASF_ALERT_STR; - break; - default: - return (v_U8_t *)ANI_EAPOL_TYPE_UNKNOWN_STR; - break; - } -} - - -void bapRsnEapolHandler( v_PVOID_t pvFsm, tAniPacket *packet, v_BOOL_t fIsAuth ) -{ - int retVal; - v_U8_t *dstMac = NULL; - v_U8_t *srcMac = NULL; - v_U8_t *type = NULL; - - retVal = aniEapolParse(packet, &dstMac, &srcMac, &type); - if ( retVal >= 0 ) - { - retVal = ANI_OK; - - // Sanity check that a PAE role has been assigned to it, - // and then dispatch to the appropriate handler - - if( fIsAuth ) - { - tAuthRsnFsm *fsm = (tAuthRsnFsm *)pvFsm; - authEapolHandler( fsm, packet, dstMac, srcMac, type ); - } - else - { - tSuppRsnFsm *fsm = (tSuppRsnFsm *)pvFsm; - suppEapolHandler(fsm, packet, dstMac, srcMac, type); - } // switch statement - } // Successfully parsed EAPOL - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "eapolHandler Received bad EAPOL message of len %d (status=%d)\n", - aniAsfPacketGetLen(packet), retVal ); - } - aniAsfPacketFree( packet ); -} - - -int bapRsnFormPktFromVosPkt( tAniPacket **ppPacket, vos_pkt_t *pVosPacket ) -{ - int retVal = ANI_ERROR; - VOS_STATUS status; - v_U16_t uPktLen; -#define BAP_RSN_SNAP_TYPE_OFFSET 20 -#define BAP_RSN_ETHERNET_3_HEADER_LEN 22 - v_U8_t *pFrame = NULL; - tAniPacket *pAniPacket = NULL; - - do - { - status = vos_pkt_get_packet_length( pVosPacket, &uPktLen ); - if( !VOS_IS_STATUS_SUCCESS(status) ) break; - if( (uPktLen < BAP_RSN_ETHERNET_3_HEADER_LEN) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " authRsnRxFrameHandler receive eapol packet size (%d) too small (%d)\n", - uPktLen, BAP_RSN_ETHERNET_3_HEADER_LEN ); - break; - } - status = vos_pkt_peek_data( pVosPacket, 0, (v_VOID_t *)&pFrame, uPktLen ); - if( !VOS_IS_STATUS_SUCCESS(status) || (NULL == pFrame) ) break; - retVal = aniAsfPacketAllocateExplicit(&pAniPacket, uPktLen, 0 ); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " authRsnRxFrameHandler failed to get buffer size (%d) \n", - uPktLen ); - break; - } - aniAsfPacketEmptyExplicit( pAniPacket, 0 ); - pFrame[ETHER_PROTO_POS] = pFrame[BAP_RSN_SNAP_TYPE_OFFSET]; - pFrame[ETHER_PROTO_POS + 1] = pFrame[BAP_RSN_SNAP_TYPE_OFFSET + 1]; - //push ethernet II header in - retVal = aniAsfPacketAppendBuffer( pAniPacket, pFrame, ETHER_PROTO_POS + 2 ); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; - //Get the rest of the data in - uPktLen -= BAP_RSN_ETHERNET_3_HEADER_LEN; - if (uPktLen <= 0){ - VOS_ASSERT(0); - retVal = ANI_ERROR; - break; - } - - retVal = aniAsfPacketAppendBuffer( pAniPacket, pFrame + BAP_RSN_ETHERNET_3_HEADER_LEN, - uPktLen ); - if( !ANI_IS_STATUS_SUCCESS( retVal ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - " authRsnRxFrameHandler cannot retrieve eapol payload size (%d)\n", - uPktLen ); - break; - } - }while( 0 ); - - if( ANI_IS_STATUS_SUCCESS( retVal ) ) - { - *ppPacket = pAniPacket; - } - else if( pAniPacket ) - { - aniAsfPacketFree( pAniPacket ); - } - - return retVal; -} diff --git a/CORE/BAP/src/bapRsnSsmEapol.h b/CORE/BAP/src/bapRsnSsmEapol.h deleted file mode 100644 index 8cbff4364373..000000000000 --- a/CORE/BAP/src/bapRsnSsmEapol.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmEapol.h#1 $ - * Contains declarations of various utilities for EAPoL frame - * parsing and creation. - * range. - * Author: Mayank D. Upadhyay - * Date: 19-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef _ANI_SSM_EAPOL_H_ -#define _ANI_SSM_EAPOL_H_ - -#include "vos_types.h" -#include "vos_trace.h" -#include "vos_packet.h" -#include <bapRsnAsfPacket.h> - -#define ANI_ETH_P_EAPOL 0x0003 -#define ANI_ETH_P_IP 0x0800 - -/** - * The EAPOL type field is one of the following: - */ -#define ANI_EAPOL_TYPE_PACKET 0 -#define ANI_EAPOL_TYPE_START 1 -#define ANI_EAPOL_TYPE_LOGOFF 2 -#define ANI_EAPOL_TYPE_KEY 3 -#define ANI_EAPOL_TYPE_ASF_ALERT 4 - -#define EAPOL_VERSION_1 0x01 - -#define EAPOL_RX_HEADER_SIZE 18 -#define EAPOL_TX_HEADER_SIZE 26 //include LLC_SNAP -#define SNAP_HEADER_SIZE 8 - -#define ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 1 -// JEZ20041012 This needs to be fixed. This needs to support BOTH -// the older WPA Key Descriptor type of 254 AS WELL AS the newer -// Key Descriptor type of 2 -#define ANI_EAPOL_KEY_DESC_TYPE_RSN 254 -//#define ANI_EAPOL_KEY_DESC_TYPE_RSN 2 -#define ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW 2 - -#define ANI_EAPOL_KEY_RSN_REPLAY_CTR_SIZE 8 -#define ANI_EAPOL_KEY_RSN_NONCE_SIZE 32 -#define ANI_EAPOL_KEY_RSN_IV_SIZE 16 -#define ANI_EAPOL_KEY_RSN_RSC_SIZE 8 -#define ANI_EAPOL_KEY_RSN_ID_SIZE 8 -#define ANI_EAPOL_KEY_RSN_MIC_SIZE 16 -#define ANI_EAPOL_KEY_RSN_ENC_KEY_SIZE 16 - -#define ANI_EAPOL_KEY_DESC_VERS_RC4 1 -#define ANI_EAPOL_KEY_DESC_VERS_AES 2 - -#define ANI_EAPOL_KEY_RC4_REPLAY_CTR_SIZE 8 -#define ANI_EAPOL_KEY_RC4_IV_SIZE 16 -#define ANI_EAPOL_KET_RC4_SIGN_SIZE 16 - -#define ANI_SSM_IE_RSN_KEY_DATA_ENCAPS_ID 0xDD -#define ANI_SSM_IE_RSN_GROUP_KEY_DATA_ENCAPS_ID 1 -#define ANI_SSM_GROUP_KEY_KDE_TX_BIT 0x04 - -typedef struct sAniEapolLegacyRc4KeyDesc { - v_U16_t keyLen; - v_U8_t replayCounter[ANI_EAPOL_KEY_RC4_REPLAY_CTR_SIZE]; - v_U8_t keyIv[ANI_EAPOL_KEY_RC4_IV_SIZE]; - tANI_BOOLEAN unicastFlag; // The high order 1 bit of key-index - v_U8_t keyId; // The lower order 7 bits of key-index (but 0..3 based) - v_U8_t signature[ANI_EAPOL_KET_RC4_SIGN_SIZE]; - v_U8_t *key; -} tAniEapolLegacyRc4KeyDesc; - -typedef struct sAniRsnKeyInfo { - v_U32_t keyDescVers; - tANI_BOOLEAN unicastFlag; // Pair-wise key - v_U16_t keyId; - tANI_BOOLEAN installFlag; - tANI_BOOLEAN ackFlag; - tANI_BOOLEAN micFlag; - tANI_BOOLEAN secureFlag; - tANI_BOOLEAN errorFlag; - tANI_BOOLEAN requestFlag; - tANI_BOOLEAN encKeyDataFlag; // RSN only (Is 0 in WPA) -} tAniRsnKeyInfo; - -typedef struct sAniEapolRsnKeyDesc { - tAniRsnKeyInfo info; - v_U16_t keyLen; - v_U8_t replayCounter[ANI_EAPOL_KEY_RSN_REPLAY_CTR_SIZE]; - v_U8_t keyNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]; - v_U8_t keyIv[ANI_EAPOL_KEY_RSN_IV_SIZE]; - v_U8_t keyRecvSeqCounter[ANI_EAPOL_KEY_RSN_RSC_SIZE]; - v_U8_t keyId[ANI_EAPOL_KEY_RSN_ID_SIZE]; - v_U8_t keyMic[ANI_EAPOL_KEY_RSN_MIC_SIZE]; - v_U16_t keyDataLen; - v_U8_t *keyData; -} tAniEapolRsnKeyDesc; - -/** - * aniEapolWriteStart - * - * FUNCTION: - * Writes an EAPOL-Start frame to the packet. It is only used by the - * supplicant. - * - * LOGIC: - * Prepend the appropriate EAPOL header to the packet. There is no - * EAPOL payload for this kind of frame. - * - * ASSUMPTIONS: - * The packet has enough space available for prepending the header. - * - * @param packet the packet to which the frame should be written - * @param dstMac the MAC address of the destination (authenticator) - * @param srcMac the MAC address of the source (supplicant) - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolWriteStart(tAniPacket *packet, - tAniMacAddr dstMac, - tAniMacAddr srcMac); - -/** - * aniEapolWriteEapPacket - * - * FUNCTION: - * Writes the EAPOL/EAP-Packet frame headers. It is used - * by both the authenticator and the supplicant. This creates an EAPOL - * frame that is carrying an EAP message as its payload. - * - * LOGIC: - * Prepend the appropriate EAPOL header to the packet. - * - * ASSUMPTIONS: - * The EAP message (ie., the payload) is already available in the - * packet and that the packet has enough space available for - * prepending the EAPOL header. - * - * @param packet the packet containing the EAP message - * @param dstMac the MAC address of the destination (authenticator) - * @param srcMac the MAC address of the source (supplicant) - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolWriteEapPacket(tAniPacket *eapPacket, - tAniMacAddr dstMac, - tAniMacAddr srcMac); - -/** - * aniEapolParse - * - * FUNCTION: - * Parses an EAPoL frame to the first level of headers (no EAP - * headers are parsed). - * - * NOTE: This is a non-destructive read, that is the - * headers are not stripped off the packet. However, any additional - * data at the end of the packet, beyond what the EAPoL headers encode - * will be stripped off. - * - * @param packet the packet containing the EAPoL frame to parse - * @param dstMac a pointer to set to the location of the destination - * MAC address - * @param srcMac a pointer to set to the location of the source - * MAC address - * @param type a pointer to set to the location of the EAPOL type - * field. - * - * @return the non-negative length of the EAPOL payload if the operation - * succeeds - */ -int -aniEapolParse(tAniPacket *packet, - v_U8_t **dstMac, - v_U8_t **srcMac, - v_U8_t **type); - -/** - * aniEapolWriteKey - * - * Writes out a complete EAPOL-Key frame. The key descriptor is - * appended to the packet and the EAPOL header is prepended to it. If - * a micKey is passed in, then a MIC is calculated and inserted into - * the frame. - * - * @param packet the packet to write to - * @param dstMac the destination MAC address - * @param srcMac the source MAC address - * @param descType the key descriptor type - * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or - * ANI_EAPOL_KEY_DESC_TYPE_RSN). - * @param keyDescData the key descriptor data corresponding to the - * above descType. The signature field is ignored and will be - * generated in the packet. The key bytes are expected to be enctypted - * is they need to be encrypted. - * @param micKey the MIC key - * @param micKeyLen the number of bytes in the MIC key - * - * @return ANI_OK if the operation succeeds - * - */ -int -aniEapolWriteKey(v_U32_t cryptHandle, - tAniPacket *packet, - tAniMacAddr dstMac, - tAniMacAddr srcMac, - int descType, - void *keyDescData, - v_U8_t *micKey, - v_U32_t micKeyLen); - -/** - * aniEapolParseKey - * - * Parses and verifies a complete EAPOL-Key frame. The key descriptor - * type is returned and so is a newly allocated key descriptor structure - * that is appropriate for the type. - * - * NOTE: This is a non-destructive read. That is, the packet headers - * will be unchanged at the end of this read operation. This is so - * that a followup MIC check may be done on the complete packet. If - * the packet parsing fails, the packet headers are not guaranteed to - * be unchanged. - * - * @param packet the packet to read from. Note that the frame is not - * expected to contain any additional padding at the end other than - * the exact number of key bytes. (The aniEapolParse function will - * ensure this.) - * @param descType is set to the key descriptor type - * (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or - * ANI_EAPOL_KEY_DESC_TYPE_RSN). - * @param keyDescData is set to a newly allocated key descriptor - * corresponding to the above descType. The signature field is - * verified. The key bytes will be returned encrypted. It is the - * responsibility of the caller to free this structure and the data - * contained therein. - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolParseKey(tAniPacket *packet, - int *descType, - void **keyDescData); - -/** - * aniEapolKeyCheckMic - * - * @param eapolFrame the complete EAPOL-Key packet - * @param descType the key descriptor type - * @param keyDescData the key descriptor - * @param micKey the MIC key - * @param micKeyLen the number of bytes in the MIC key - * - * @return ANI_OK if the operation succeeds; ANI_E_MIC_FAILED if the - * MIC check fails. - */ -int -aniEapolKeyCheckMic(v_U32_t cryptHandle, - tAniPacket *eapolFrame, - int descType, - void *keyDescData, - v_U8_t *micKey, - v_U32_t micKeyLen); - -/** - * aniEapolKeyFreeDesc - * - * Frees the EAPOL key descriptor and the key bytes contained within it. - * - * @param descType the key descriptor type - * @param keyDescData the key descriptor - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolKeyFreeDesc(int descType, void *keyDescData); - -v_U8_t * -aniEapolType2Str(v_U8_t type); - -v_U8_t * -aniEapolHdr2Str(v_U8_t *hdr); - -/** - * aniEapolKeyLogDesc - * - * Logs information about the given EAPOL key desctiptor. - * - * @param descType the key descriptor type - * @param keyDescData the key descriptor - * - * @return ANI_OK if the operation succeeds - */ -int -aniEapolKeyLogDesc(int descType, void *keyDescData); - -void bapRsnEapolHandler( v_PVOID_t pvFsm, tAniPacket *packet, v_BOOL_t fIsAuth ); -//Transfer from pVosPacket to tAniPacket. -int bapRsnFormPktFromVosPkt( tAniPacket **ppPacket, vos_pkt_t *pVosPacket ); - -#endif //_ANI_SSM_EAPOL_H_ diff --git a/CORE/BAP/src/bapRsnSsmReplayCtr.c b/CORE/BAP/src/bapRsnSsmReplayCtr.c deleted file mode 100644 index c59de6862636..000000000000 --- a/CORE/BAP/src/bapRsnSsmReplayCtr.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * File: $Header: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/lib/aniSsmReplayCtr.c#2 $ - * - */ -/* - * Contains definitions of various utilities for EAPoL frame - * parsing and creation. - * - * Author: Mayank D. Upadhyay - * Date: 19-June-2002 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#include "vos_types.h" -#include "vos_trace.h" -#include <bapRsnErrors.h> - -#include <bapRsnSsmReplayCtr.h> -#include "vos_status.h" -#include "vos_memory.h" -#include "vos_utils.h" -#include "vos_packet.h" - -//#include "aniSsmUtils.h" - -/* - * Opaque replay counter type. Does TX and RX side replay counter - * tracking. On the TX side, it returns monotonically increasing values - * of the counter and checks that the peer returned a value matching - * the one we sent. On the RX side, it makes sure that the peer sent a - * replay counter greater than the last one seen (excepting for the - * first time a check is made which the application has to special case.) - */ -struct sAniSsmReplayCtr { - v_U8_t size; - v_U8_t *buf; - v_U32_t currentValue; - v_U8_t init; -}; - -static int -updateCtrBuf(tAniSsmReplayCtr *ctr); - -/** - * aniSsmReplayCtrCreate - * - * Creates a replay counter and initializes it for first time - * use. The initialization can be done randomly or with a passed in - * value like 0. In case this is going to be used on the RX side, it - * doesn't matter what the initialization is and can be optimized to - * a fixed value so as to avoid the overhead of obtaining a random - * value. - * - * @param ctrPtr a pointer that will be set to the newly allocated - * counter if the operation succeeds - * @param size the number of bytes that are desired in the counter - * @param initValue if this is negative and size is greater than 4, - * the initialization is done randomly. Otherwise, these bytes are - * copied into the least significant four or less octets of the - * counter, depending on the size of the counter. i.e., if the counter - * is only 2B, then the least significant 2B of initValue will be - * copied over. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrCreate(v_U32_t cryptHandle, tAniSsmReplayCtr **ctrPtr, - v_U8_t size, - int initValue) -{ - tAniSsmReplayCtr *ctr; - - ctr = vos_mem_malloc( sizeof(tAniSsmReplayCtr) ); - if( NULL == ctr ) - { - return ANI_E_MALLOC_FAILED; - } - - ctr->buf = vos_mem_malloc( size ); - if (ctr->buf == NULL) - { - VOS_ASSERT( 0 ); - vos_mem_free(ctr); - return ANI_E_MALLOC_FAILED; - } - - ctr->size = size; - - // We cannot randomly generate the most significant bytes if the - // total number of bytes is not greater than 4 (sizeof ANI_U32). - if (initValue < 0 && ctr->size <= 4) - initValue = 0; - - // If initValue is negative, initialize the ctr randomly, else - // initialize it to what the user specified. - if (initValue < 0) - { - if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes(cryptHandle, ctr->buf, ctr->size) ) ) - { - return ANI_ERROR; - } - } - else { - ctr->currentValue = initValue - 1; - } - - *ctrPtr = ctr; - - return ANI_OK; -} - -static int -updateCtrBuf(tAniSsmReplayCtr *ctr) -{ - - v_U32_t numBytes; - v_U32_t offset; - v_U32_t tmp; - - tmp = vos_cpu_to_be32( ctr->currentValue ); - - numBytes = (4 <= ctr->size) ? 4 : ctr->size; - offset = 4 - numBytes; - vos_mem_copy(ctr->buf + ctr->size - numBytes, - ((v_U8_t *) &tmp) + offset, numBytes); - - return ANI_OK; -} - -/** - * aniSsmReplayCtrCmp - * - * Used to check if the passed in value is greater - * than, less than, or the same as the previous value. - * - * Can be used on the TX side to determine if the response to a - * request contains the same counter as the one in the request. - * - * Can be used on the RX side to determine if the request has a - * counter greater than the previous request, or if this is a - * retransmission of the previous request. The application should - * special-case the first time this is called on the RX side. - * - * @param ctr the current replay counter - * @param value the value to check against - * - * @return a negative value if current ctr is less than the - * given value, zero if they are the same, and a positive value if the - * current counter is greater than that of the given value. - */ -int -aniSsmReplayCtrCmp(tAniSsmReplayCtr *ctr, v_U8_t *value) -{ - return vos_mem_compare2(ctr->buf, value, ctr->size); -} - -/** - * aniSsmReplayCtrUpdate - * - * Used on the RX side to update the value of the current replay - * counter to that received in the next request. Typically this is - * called after it is determined that this is not a retransmission, - * and some sort of integrity checking is done on it. - * - * @param ctr the current replay counter - * @param value the value that it should be set to - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrUpdate(tAniSsmReplayCtr *ctr, - v_U8_t *value) -{ - vos_mem_copy(ctr->buf, value, ctr->size); - - return ANI_OK; -} - -/** - * aniSsmReplayCtrNext - * - * Used on the RX side to obtain the next value that should be sent - * with a request. After this call, the current value is incremented - * by one. - * - * @param ctr the current replay counter - * @param value where the next counter value should be copied - * into. The caller must allocated enough storage for this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrNext(tAniSsmReplayCtr *ctr, - v_U8_t *value) -{ - ctr->currentValue++; - updateCtrBuf(ctr); - vos_mem_copy(value, ctr->buf, ctr->size); - - return ANI_OK; -} - -/** - * aniSsmReplayCtrFree - * - * Frees the replay counter context. - * - * @param ctr the replay counter to free. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrFree(tAniSsmReplayCtr *ctr) -{ - - if (ctr->buf != NULL) - vos_mem_free(ctr->buf); - - vos_mem_free(ctr); - - return ANI_OK; -} diff --git a/CORE/BAP/src/bapRsnSsmReplayCtr.h b/CORE/BAP/src/bapRsnSsmReplayCtr.h deleted file mode 100644 index 59c842929617..000000000000 --- a/CORE/BAP/src/bapRsnSsmReplayCtr.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmReplayCtr.h $ - * - */ -/* - * Contains declarations of various utilities for SSM replay counter - * module. - * - * Author: Mayank D. Upadhyay - * Date: 15-June-2003 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ -#ifndef _ANI_SSM_REPLAY_CTR_H_ -#define _ANI_SSM_REPLAY_CTR_H_ - -#include "vos_types.h" -#include <bapRsnAsfPacket.h> - -/* - * Opaque replay counter type. Does TX and RX side replay counter - * tracking. On the TX side, it returns monotonicall increasing values - * of the counter and checks that the peer returned a value matching - * the one we sent. On the RX side, it makes sure that the peer sent a - * replay counter greater than the last one seen (excepting for the - * first time a check is made which the application has to special case.) - */ -typedef struct sAniSsmReplayCtr tAniSsmReplayCtr; - -/** - * aniSsmReplayCtrCreate - * - * Creates a replay counter and initializes it for first time - * use. The initialization can be done randomly or with a passed in - * value like 0. In case this is going to be used on the RX side, it - * doesn't matter what the initiaalization is and can be optimized to - * a fixed value so as to avoid the overhead of obtaining a random - * value. - * - * @param ctrPtr a pointer that will be set to the newly allocated - * counter if the operation succeeds - * @param size the number of bytes that are desired in the counter - * @param initValue if this is negative and size is greater than 4, - * the initialization is done randomly. Otherwise, these bytes are - * copied into the least significant four or less octets of the - * counter, depending on the size of the counter. i.e., if the counter - * is only 2B, then the least significant 2B of initValue will be - * copied over. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrCreate(v_U32_t cryptHandle, tAniSsmReplayCtr **ctrPtr, - v_U8_t size, - int initValue); - -/** - * aniSsmReplayCtrCmp - * - * Used to check if the passed in value is greater - * than, less than, or the same as the previous value. - * - * Can be used on the TX side to determine if the response to a - * request contains the same counter as the one in the request. - * - * Can be used on the RX side to determine if the request has a - * counter greater than the previous request, or if this is a - * retransmission of the previous request. The application should - * special-case the first time this is called on the RX side. - * - * @param ctr the current replay counter - * @param value the value to check against - * - * @return A negative error code if value is less than the - * current value of the counter, zero if they are the same, and a - * positive value if the current value is greater than that of the - * counter. - */ -int -aniSsmReplayCtrCmp(tAniSsmReplayCtr *ctr, - v_U8_t *value); - -/** - * aniSsmReplayCtrUpdate - * - * Used on the RX side to update the value of the current replay - * counter to that received in the next request. Typically this is - * called after it is determined that this is not a retransmission, - * and some sort of integrity checking is done on it. - * - * @param ctr the current replay counter - * @param value the value that it should be set to - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrUpdate(tAniSsmReplayCtr *ctr, - v_U8_t *value); - -/** - * aniSsmReplayCtrNext - * - * Used on the RX side to obtain the next value that should be sent - * with a request. After this call, the current value is incremented - * by one. - * - * @param ctr the current replay counter - * @param value where the next counter value should be copied - * into. The caller must allocated enough storage for this. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrNext(tAniSsmReplayCtr *ctr, - v_U8_t *value); - -/** - * aniSsmReplayCtrFree - * - * Frees the replay counter context. - * - * @param ctr the replay counter to free. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmReplayCtrFree(tAniSsmReplayCtr *ctr); - -#endif //_ANI_SSM_REPLAY_CTR_H_ diff --git a/CORE/BAP/src/bapRsnSsmServices.h b/CORE/BAP/src/bapRsnSsmServices.h deleted file mode 100644 index 41ad73926461..000000000000 --- a/CORE/BAP/src/bapRsnSsmServices.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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. - */ - -/* - * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/include/aniSsmServices.h $ - * - * Contains definitions of common types that the SSM exports to other - * modules. - * - * Author: Mayank D. Upadhyay - * Date: 23-January-2003 - * History:- - * Date Modified by Modification Information - * ------------------------------------------------------ - * - */ - -#ifndef _ANI_SSM_SERVICES_H_ -#define _ANI_SSM_SERVICES_H_ - -#include "vos_types.h" -#include "sirApi.h" - -#define ANI_SSM_MAX_KEYS_INFO_SIZE 512 -#define ANI_SSM_MAX_GROUP_SIZE 32 -#define ANI_SSM_MAX_USERID_SIZE 64 - -#define ANI_SSM_RSN_PMK_LEN 32 -#define ANI_SSM_RSN_PSK_LEN ANI_SSM_RSN_PMK_LEN -#define ANI_SSM_RSN_PSK_LEN_HEX (ANI_SSM_RSN_PSK_LEN + ANI_SSM_RSN_PSK_LEN) -#define ANI_SSM_MAX_PASSPHRASE_LEN 128 -#define ANI_SSM_MAX_AUTHZONE_LEN 32 -#define ANI_SSM_MAX_LANDPG_URL_LEN 128 -#define ANI_SSM_MAX_GUEST_PORTAL_PWD_LEN 32 - -#define ANI_SSM_IE_RSN_OUI {0x00, 0x0F, 0xAC} -#define ANI_SSM_IE_WPA_OUI {0x00, 0x50, 0xF2} - -#define ANI_SSM_IE_RSN_ELEM_ID 48 -#define ANI_SSM_IE_WPA_ELEM_ID 221 - -/* - * The total length of an RSN IE may be no longer than these many - * octets, including the two bytes for type and len. - */ -#define ANI_RSN_IE_MAX_LEN 257 - -/* - * PMKSA ID data type - * (PMKID is an HMAC-SHA1-128 value) - */ -#define ANI_AAG_PMKID_SIZE 16 - -#define ANI_SSM_AUTH_BITMASK 0x00010000 -#define ANI_SSM_IEMODE_BITMASK 0xC0000000 -#define ANI_SSM_ENCR_BITMASK 0x00000001 -#define ANI_SSM_IEMODE_SHIFT (30) - - -// Upper level authentication types used by AA -typedef enum eAniSsmAuthType { - eANI_SSM_AT_UNDERFLOW = -1, - - // The numbers are fixed so that they can be re-used in the XCLI - // config file and 1x.conf. - eANI_SSM_AT_NONE = 0, - eANI_SSM_AT_SHARED_KEY = 1, - eANI_SSM_AT_LEGACY_EAP = 2, - eANI_SSM_AT_RSN_PSK = 3, - eANI_SSM_AT_RSN_EAP = 4, - - eANI_SSM_AT_OVERFLOW -} tAniSsmAuthType; - -// Upper level encryption types used by AA -typedef enum eAniSsmCipherType { - eANI_SSM_CT_UNDERFLOW = -1, - - // The numbers are fixed so that they can be re-used in the XCLI - // config file and 1x.conf. - eANI_SSM_CT_NONE = 0, - eANI_SSM_CT_WEP40 = 1, - eANI_SSM_CT_WEP104 = 2, - eANI_SSM_CT_WPA_WEP40 = 3, - eANI_SSM_CT_WPA_WEP104 = 4, - eANI_SSM_CT_TKIP = 5, - eANI_SSM_CT_CCMP = 6, - - eANI_SSM_CT_OVERFLOW -} tAniSsmCipherType; - - -// WPA modes -typedef enum eAniSsmWpaModes { - eANI_SSM_WPA_UNDERFLOW = -1, - - eANI_SSM_WPA_DISABLE = 0, - eANI_SSM_WPA_1 = 1, - eANI_SSM_WPA_2 = 2, - - eANI_SSM_WPA_OVERFLOW = ((eANI_SSM_WPA_2 | eANI_SSM_WPA_1) + 1) -} tAniSsmWpaModes; - -typedef struct sAniSsmGroup { - v_U16_t len; // Valid range: 0..ANI_SSM_MAX_GROUP_SIZE - v_U8_t group[1]; -} tAniSsmGroup; - -typedef struct sAniSsmUserId { - v_U16_t len; // Valid range: 0..ANI_SSM_MAX_USERID_SIZE - v_U8_t userId[1]; -} tAniSsmUserId; - -/* - * PMKSA ID data type - * (PMKID is an HMAC-SHA1-128 value) - */ -typedef v_U8_t tAniSsmPmkId[ANI_AAG_PMKID_SIZE]; - -/** - * aniSsmInitStaticConf - * - * (Re-)Initializes the SSM internal static configuration. This may be - * from a static configuration file and will include items such as - * local MAC-ACL lists. - * - * @param configFileName - an optional filename to read from. If this is - * NULL, the default AAG static conf file is read. - * - * @return ANI_OK if the operation succeeds - */ -int -aniSsmInitStaticConf(char *configFileName); - -/** - * aniSsmIsStaMacAllowed - * - * Determines if a given STA passes the local MAC-ACL check. If - * MAC-ACL lookup is enabled, it may be either positive (whitelist) or - * negative (blacklist). If positive MAC-ACLs are on, then only those - * STAs that are in the whitelist are allowed in. If negative MAC-ACLs - * are on, then those STAs that are in the blacklist are not allowed in. - * - * Note that local MAC-ACLs may be maintained per SSID. - * - * @param staMac - the MAC address of the STA - * @param ssid - the SSID that the STA is associating on - * - * @return ANI_OK if the operation succeeds - */ -v_BOOL_t -aniSsmIsStaMacAllowed(const tAniMacAddr staMac, const tAniSSID *ssid); - -/** - * aniSsmIsSecModeAllowed - * - * Determines if the security suites requested by an RSN station or - * non-RSN station are allowed under the security mode in force at the - * moment. - * - * An RSN IE needs to be passed in if RSN is being used. Otherwise the - * ieLen field should be set to 0 or ieData set to NULL to indicate - * that no IE is present. If the RSN IE is present it is used to check - * both the authentication type and the cipher type for the group and - * pairwise keys. Special rules might apply in the case of a - * BP. Therefore, a separate flag indicates if the STA is a BP. - * - * If the station is not using RSN, the authentication type is - * tightly bound to the cipher type. For instance, when using - * shared-key MAC authentication, the cipher type will be assumed to - * be WEP. (Both WEP-40 and WEP-104 fall under the same security - * level.) When using open-system MAC authentication, the cipher type - * will be assumed to be WEP if the security level requires WEP, - * otherwise the cipher will be determined later. (When performing - * open-auth in the lowest security level, the STA is required to - * initiate EAPOL in order to establish WEP keys, or WEP cannot be not - * used.) - * - * @param secMode the security mode that is in force - * @param macAuthType the MAC-level authentication type to check - * @param ieLen is set 0 if no RSN IE is present, or to the number of - * octets in the RSN IE. - * @param ieData the optional IE data bytes, or NULL if no IE is - * present. - * @param bpIndicator eANI_BOOLEAN_TRUE if the STA is a BP, - * eANI_BOOLEAN_FALSE otherwise. - * - * @return eANI_BOOLEAN_TRUE if the authentication type is allowed, - * eANI_BOOLEAN_FALSE if not. - * - * @see aniSsmIsRsnSuiteAllowed - */ -v_BOOL_t -aniSsmIsSecModeAllowed(v_U32_t secMode, - tAniAuthType macAuthType, - v_U8_t ieLen, - v_U8_t *ieData, - v_BOOL_t bpIndicator, - v_BOOL_t wpsEnabled); - -/** - * aniSsmGenRsnSuiteList - * - * Generates a RSN information element containing a list of RSN suites - * that conform to the specified security level. This is generally - * used on the AP to generate the RSN information element it - * advertizes. - * - * @param secMode the security mode in force - * @param ieData the buffer in which to store the generated IE - * - * @return the non-negative number of bytes written into the buffer if - * the operation succeeds, or a negative error code. - */ -int -aniSsmGenRsnSuiteList(v_U32_t secMode, - v_U8_t ieData[ANI_RSN_IE_MAX_LEN]); - -/** - * aniSsmGenRsnSuiteForBp - * - * Generates a RSN information element containing exactly one RSN - * suite selector for authentication and exactly one for the - * cipher. This is generally used on the BP side while associating - * with an upstream AP. - * - * If RSN is turned off on the BP, then the IE is of length 0. - * - * NOTE: As per 802.11/D3.0, the BP has to send back the exact group - * key cipher that the AP indicated in its IE. - * - * @param apIeData contains the IE sent by the AP and is used to read - * the group key cipher that the AP wants us to use. - * @param apIeLen the length of the AP's IE - * @param bpRsnFlag should be 0 for no RSN, 1 for AES, 2 for TKIP - * @param bpPskFlag should be eANI_BOOLEAN_TRUE if RSN with PSK is - * desired. This is only relevant if bpRsnFlag is not zero. - * @param ieData the buffer in which to store the generated IE - * - * @return the non-negative number of bytes written into the buffer if - * the operation succeeds, or a negative error code. - */ -int -aniSsmGenRsnSuiteForBp(const v_U8_t *apIeData, - v_U8_t apIeLen, - v_U32_t bpRsnFlag, - v_BOOL_t bpPskFlag, - v_U8_t ieData[ANI_RSN_IE_MAX_LEN]); - -/** - * aniSsmSecMode2Str - * - * Returns a descriptive string that can be used for logging the - * security mode. - * - * @param secMode the secMode to be printed - * - * @return a printable ASCII string representing the secMode - */ -v_U8_t * -aniSsmSecMode2Str(v_U32_t secMode); - -/** - * aniSsmIe2Str - * - * Parses and returns a printable form of the IE (WPA/RSN). - * - * @param ieData the IE bytes - * @param ieLen the length of the IE - * - * @return ANI_OK if the operation succeeds - */ -v_U8_t * -aniSsmIe2Str(const v_U8_t *ieData, v_U8_t ieLen); - -#endif /* _ANI_SSM_SERVICES_H_ */ diff --git a/CORE/BAP/src/bapRsnTxRx.c b/CORE/BAP/src/bapRsnTxRx.c deleted file mode 100644 index 654e8eefbeed..000000000000 --- a/CORE/BAP/src/bapRsnTxRx.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/**============================================================================= - - bapRsnTxRx.c - - \brief - - Description... - - ============================================================================== */ -/* $HEADER$ */ -#include "bapRsnTxRx.h" -#include "bapRsn8021xFsm.h" -#include "bapInternal.h" -#include "vos_trace.h" -#include "wlan_qct_tl.h" -#include "vos_memory.h" - - -static pnfTxCompleteHandler bapRsnFsmTxCmpHandler; -static pnfRxFrameHandler bapRsnFsmRxFrameHandler; - -extern int gReadToSetKey; - - -VOS_STATUS bapRsnRegisterTxRxCallbacks( pnfTxCompleteHandler pfnTxCom, pnfRxFrameHandler pnfRxFrame ) -{ - if( bapRsnFsmTxCmpHandler || bapRsnFsmRxFrameHandler ) - { - return VOS_STATUS_E_ALREADY; - } - - bapRsnFsmTxCmpHandler = pfnTxCom; - bapRsnFsmRxFrameHandler = pnfRxFrame; - - return ( VOS_STATUS_SUCCESS ); -} - -void bapRsnClearTxRxCallbacks(void) -{ - bapRsnFsmTxCmpHandler = NULL; - bapRsnFsmRxFrameHandler = NULL; -} - - -//To reserve a vos_packet for Tx eapol frame -//If success, pPacket is the packet and pData points to the head. -static VOS_STATUS bapRsnAcquirePacket( vos_pkt_t **ppPacket, v_U8_t **ppData, v_U16_t size ) -{ - VOS_STATUS status; - vos_pkt_t *pPacket = NULL; - - status = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, size, 1, - VOS_TRUE, NULL, NULL ); - if( VOS_IS_STATUS_SUCCESS( status ) ) - { - status = vos_pkt_reserve_head( pPacket, (v_VOID_t **)ppData, size ); - if( !VOS_IS_STATUS_SUCCESS( status ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "bapRsnAcquirePacket failed to reserve size = %d\n", size ); - vos_pkt_return_packet( pPacket ); - } - else - { - *ppPacket = pPacket; - } - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "bapRsnAcquirePacket failed to get vos_pkt\n" ); - } - - return ( status ); -} - - -static VOS_STATUS bapRsnTxCompleteCallback( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ) -{ - int retVal; - ptBtampContext btampContext; // use btampContext value - tCsrRoamSetKey setKeyInfo; - tSuppRsnFsm *fsm; - - if (NULL == pvosGCtx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "pvosGCtx is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - btampContext = VOS_GET_BAP_CB(pvosGCtx); - if (NULL == btampContext) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "btampContext is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - fsm = &btampContext->uFsm.suppFsm; - if (NULL == fsm) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "fsm is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - //If we get a disconect from upper layer before getting the pkt from TL the - //bapRsnFsmTxCmpHandler could be NULL - //VOS_ASSERT( bapRsnFsmTxCmpHandler ); - - if( bapRsnFsmTxCmpHandler ) - { - //Change the state - //Call auth or supp FSM's handler - bapRsnFsmTxCmpHandler( pvosGCtx, pPacket, retStatus ); - } - else - { - vos_pkt_return_packet( pPacket ); - return (VOS_STATUS_SUCCESS ); - } - - //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one. - /* - We will move the Set key to EAPOL Completion handler. We found a race condition betweem - sending EAPOL frame and setting Key */ - if (BAP_SET_RSN_KEY == gReadToSetKey) { - vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); - setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; - setKeyInfo.keyDirection = eSIR_TX_RX; - vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) ); - setKeyInfo.paeRole = 0; //this is a supplicant - setKeyInfo.keyId = 0; //always - setKeyInfo.keyLength = CSR_AES_KEY_LEN; - vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); - - if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" ); - retVal = ANI_ERROR; - } - gReadToSetKey = BAP_RESET_RSN_KEY; - } - - return (VOS_STATUS_SUCCESS ); -} - - -static VOS_STATUS bapRsnTxFrame( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ) -{ - VOS_STATUS status; - WLANTL_MetaInfoType metaInfo; - - vos_mem_zero( &metaInfo, sizeof( WLANTL_MetaInfoType ) ); - metaInfo.ucIsEapol = 1; //only send eapol frame - status = WLANTL_TxBAPFrm( pvosGCtx, pPacket, &metaInfo, bapRsnTxCompleteCallback ); - if( !VOS_IS_STATUS_SUCCESS( status ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "bapRsnTxFrame failed to send vos_pkt status = %d\n", status ); - } - - return ( status ); -} - - -/* - \brief bapRsnSendEapolFrame - To push an eapol frame to TL. - - \param pAniPkt - a ready eapol frame that is prepared in tAniPacket format -*/ -VOS_STATUS bapRsnSendEapolFrame( v_PVOID_t pvosGCtx, tAniPacket *pAniPkt ) -{ - VOS_STATUS status; - vos_pkt_t *pPacket = NULL; - v_U8_t *pData = NULL, *pSrc = NULL; - int pktLen = aniAsfPacketGetBytes( pAniPkt, &pSrc ); - - if( pktLen <= 0 ) - { - return VOS_STATUS_E_EMPTY; - } - status = bapRsnAcquirePacket( &pPacket, &pData, pktLen ); - if( VOS_IS_STATUS_SUCCESS( status ) && ( NULL != pPacket )) - { - vos_mem_copy( pData, pSrc, pktLen ); - //Send the packet, need to check whether we have an outstanding packet first. - status = bapRsnTxFrame( pvosGCtx, pPacket ); - if( !VOS_IS_STATUS_SUCCESS( status ) ) - { - vos_pkt_return_packet( pPacket ); - } - } - - return ( status ); -} - - -//TL call this function on Rx frames, should only be EAPOL frames -VOS_STATUS bapRsnRxCallback( v_PVOID_t pv, vos_pkt_t *pPacket ) -{ - //Callback to auth or supp FSM's handler - VOS_ASSERT( bapRsnFsmRxFrameHandler ); - if( bapRsnFsmRxFrameHandler ) - { - bapRsnFsmRxFrameHandler( pv, pPacket ); - } - else - { - //done - vos_pkt_return_packet( pPacket ); - } - - return ( VOS_STATUS_SUCCESS ); -} - - - -VOS_STATUS bapRsnRegisterRxCallback( v_PVOID_t pvosGCtx ) -{ - VOS_STATUS status; - - status = WLANTL_RegisterBAPClient( pvosGCtx, WLANBAP_RxCallback, WLANBAP_TLFlushCompCallback ); - if( !VOS_IS_STATUS_SUCCESS( status ) ) - { - if( VOS_STATUS_E_EXISTS != status ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "bapRsnRegisterRxCallback failed with status = %d\n", status ); - } - else - { - //We consider it ok to register it multiple times because only BAP's RSN should call this - status = VOS_STATUS_SUCCESS; - } - } - - return ( status ); -} diff --git a/CORE/BAP/src/bapRsnTxRx.h b/CORE/BAP/src/bapRsnTxRx.h deleted file mode 100644 index 61ce6f0bff71..000000000000 --- a/CORE/BAP/src/bapRsnTxRx.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#if !defined( __BAPRSN_TXRX_H ) -#define __BAPRSN_TXRX_H - -/**============================================================================= - - bapRsnTxRx.h - - \brief - - Description... - - ==============================================================================*/ - -#include "vos_types.h" -#include "vos_status.h" -#include "vos_packet.h" -#include "bapRsnAsfPacket.h" - - -typedef int (*pnfTxCompleteHandler)( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ); -typedef int (*pnfRxFrameHandler)( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket ); - -/* - \brief bapRsnSendEapolFrame - To push an eapol frame to TL. - - \param pAniPkt - a ready eapol frame that is prepared in tAniPacket format -*/ -VOS_STATUS bapRsnSendEapolFrame( v_PVOID_t pvosGCtx, tAniPacket *pAniPkt ); - - -/* - \brief bapRsnRegisterTxRxCallbacks - To register two callbacks for txcomplete and rxFrames . - - \param pfnTxCom - pointer to a function to handle the tx completion. - \param pnfRxFrame - point to a function to handle rx frames -*/ -VOS_STATUS bapRsnRegisterTxRxCallbacks( pnfTxCompleteHandler pfnTxCom, pnfRxFrameHandler pnfRxFrame ); - -//To set the callbaks to NULL so it can be change later -void bapRsnClearTxRxCallbacks(void); - -/* - \brief bapRsnRegisterRxCallback - To register the RX frame callbacks to TL to receive EAPOL frames . - - \param pvosGCtx - pointer to global VOSS context. -*/ -VOS_STATUS bapRsnRegisterRxCallback( v_PVOID_t pvosGCtx ); - -VOS_STATUS bapRsnRxCallback(v_PVOID_t pv, vos_pkt_t *pPacket); - -#endif //__BAPRSN_TXRX_H diff --git a/CORE/BAP/src/btampFsm.c b/CORE/BAP/src/btampFsm.c deleted file mode 100644 index 449a1117fd4a..000000000000 --- a/CORE/BAP/src/btampFsm.c +++ /dev/null @@ -1,2703 +0,0 @@ -/* - * Copyright (c) 2012-2014 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 t a m p F s m . C - - OVERVIEW: - - This software unit holds the implementation of the Finite State Machine that - controls the operation of each individual AMP Physical link. - (Currently, this is limited to ONE link.) - - The btampFsm() routine provided by this module is called by the rest of - the BT-AMP PAL module whenever a control plane operation occurs that requires a - major state transition. - - DEPENDENCIES: - - Are listed for each API below. -===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /prj/qct/asw/engbuilds/scl/users02/jzmuda/gb-bluez/vendor/qcom/proprietary/wlan/libra/CORE/BAP/src/btampFsm.c,v 1.11 2011/03/30 21:52:10 jzmuda Exp jzmuda $ - - - when who what, where, why ----------- --- -------------------------------------------------------- -2008-10-16 jez Created module - -===========================================================================*/ - -/* This file is generated from btampFsm.cdd - do not edit manually*/ -/* Generated on: Thu Oct 16 15:40:39 PDT 2008 / version 1.2 Beta 1 */ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ - - -#include "fsmDefs.h" -//#include "btampFsm.h" -#include "bapInternal.h" -#include "btampFsm_ext.h" - -// Pick up the BTAMP Timer API definitions -#include "bapApiTimer.h" - -// Pick up the BTAMP RSN definitions -#include "bapRsn8021xFsm.h" - -#include "bapRsn8021xAuthFsm.h" -// Pick up the SME API definitions -#include "sme_Api.h" - -// Pick up the PMC API definitions -#include "pmcApi.h" - -// Pick up the BTAMP API defintions for interfacing to External subsystems -#include "bapApiExt.h" - -#include "wlan_nlink_common.h" -#include "wlan_btc_svc.h" - -// Pick up the DOT11 Frames compiler -// I just need these one "opaque" type definition in order to use the "frames" code -typedef struct sAniSirGlobal *tpAniSirGlobal; -#include "dot11f.h" - -#if 0 -/* - * Event-related Defines. - * - Ultimately, these events will be values - * - from an enumeration. That are set by some - * - of the following events. - */ -#define eWLAN_BAP_MAC_START_BSS_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */ -#define eWLAN_BAP_MAC_START_FAILS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ -#define eWLAN_BAP_MAC_SCAN_COMPLETE /* bapScanCompleteCallback */ -#define eWLAN_BAP_CHANNEL_NOT_SELECTED /* No existing Infra assoc - e.g., use HAL to access the STA LIST and find nothing */ -#define eWLAN_BAP_MAC_CONNECT_COMPLETED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */ -#define eWLAN_BAP_MAC_CONNECT_FAILED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */ -#define eWLAN_BAP_MAC_CONNECT_INDICATION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */ -#define eWLAN_BAP_RSN_SUCCESS /* setKey IOCTL from the Auth/Supp App */ -#define eWLAN_BAP_RSN_FAILURE /* deAuth IOCTL from the Auth/Supp App */ -#define eWLAN_BAP_MAC_KEY_SET_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */ -#define eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOC_IND */ -#define eWLAN_BAP_MAC_READY_FOR_CONNECTIONS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */ -#define eWLAN_BAP_CHANNEL_SELECTION_FAILED /* ??? */ - -#endif /* 0 */ - -/*Min and max channel values in 2.4GHz band for operational channel validation - on connect*/ -#define WLAN_BAP_MIN_24G_CH 1 -#define WLAN_BAP_MAX_24G_CH 14 - - -/* The HCI Disconnect Logical Link Complete Event signalling routine*/ -VOS_STATUS -signalHCIDiscLogLinkCompEvent -( - ptBtampContext btampContext, /* btampContext value */ - v_U8_t status, /* the BT-AMP status */ - v_U16_t log_link_handle, /* The Logical Link that disconnected*/ - v_U8_t reason /* the BT-AMP reason code */ -); - - -/* Stubs - TODO : Remove once the functions are available */ -int -bapSuppDisconnect(tBtampContext *ctx) -{ - // Disconnect function is called internally - // TODO : Need to find, if it disconnect will be issued from bap for supplicant - return ANI_OK; -} - -int -bapAuthDisconnect(tBtampContext *ctx) -{ - // Disconnect function is called internally - // TODO : Need to find, if it disconnect will be issued from bap for supplicant - return ANI_OK; -} - -VOS_STATUS -bapSetKey( v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo ) -{ - tWLAN_BAPEvent bapEvent; /* State machine event */ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampContext btampContext; /* use btampContext value */ - v_U8_t status; /* return the BT-AMP status here */ - eHalStatus halStatus; - v_U32_t roamId = 0xFF; - tHalHandle hHal = NULL; - v_U8_t groupMac[ANI_MAC_ADDR_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - - /* Validate params */ - if ((pvosGCtx == NULL) || (pSetKeyInfo == NULL)) - { - return VOS_STATUS_E_FAULT; - } - - btampContext = VOS_GET_BAP_CB(pvosGCtx); - /* Validate params */ - if ( btampContext == NULL) - { - return VOS_STATUS_E_FAULT; - } - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %p", __func__, btampContext); - - /* Fill in the event structure */ - bapEvent.event = eWLAN_BAP_RSN_SUCCESS; - bapEvent.params = NULL; - - /* Signal the successful RSN auth and key exchange event */ - /* (You have to signal BEFORE calling sme_RoamSetKey) */ - vosStatus = btampFsm(btampContext, &bapEvent, &status); - - /* Set the Pairwise Key */ - halStatus = sme_RoamSetKey( - hHal, - btampContext->sessionId, - pSetKeyInfo, - &roamId ); - if ( halStatus != eHAL_STATUS_SUCCESS ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus ); - return VOS_STATUS_E_FAULT; - } - - /* Set the Group Key */ - vos_mem_copy( pSetKeyInfo->peerMac, groupMac, sizeof( tAniMacAddr ) ); - halStatus = sme_RoamSetKey( - hHal, - btampContext->sessionId, - pSetKeyInfo, - &roamId ); - if ( halStatus != eHAL_STATUS_SUCCESS ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus ); - return VOS_STATUS_E_FAULT; - } - - return vosStatus; -} - -/* - * Debug-related Defines. - * - Ultimately, these events will be values - * - from an enumeration. That are set by some - * - of the following events. - */ -#define DUMPLOG_ON -#if defined DUMPLOG_ON -#define DUMPLOG(n, name1, name2, aStr, size) do { \ - int i; \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%d. %s: %s = \n", n, name1, name2); \ - for (i = 0; i < size; i++) \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "\n"); \ - } while (0) -#else -#define DUMPLOG(n, name1, name2, aStr, size) -#endif - -/* - * State transition procedures - */ - -VOS_STATUS -gotoS1 -( - ptBtampContext btampContext, /* btampContext value */ - ptWLAN_BAPEvent bapEvent, /* State machine event */ - tWLAN_BAPRole BAPDeviceRole, - v_U8_t *status /* return the BT-AMP status here */ -) -{ - tBtampTLVHCI_Create_Physical_Link_Cmd *pBapHCIPhysLinkCreate - = (tBtampTLVHCI_Create_Physical_Link_Cmd *) bapEvent->params; - tBtampTLVHCI_Accept_Physical_Link_Cmd *pBapHCIPhysLinkAccept - = (tBtampTLVHCI_Accept_Physical_Link_Cmd *) bapEvent->params; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_U32_t conAcceptTOInterval; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /* Remember role */ - btampContext->BAPDeviceRole = BAPDeviceRole; - - switch(BAPDeviceRole) - { - case BT_INITIATOR: - /* Copy down the phy_link_handle value */ - btampContext->phy_link_handle = pBapHCIPhysLinkCreate->phy_link_handle; - /* Copy out the key material from the HCI command */ - btampContext->key_type = pBapHCIPhysLinkCreate->key_type; - btampContext->key_length = pBapHCIPhysLinkCreate->key_length; - vos_mem_copy( - btampContext->key_material, - pBapHCIPhysLinkCreate->key_material, - 32); /* Need a key size define */ - break; - case BT_RESPONDER: - /* Copy down the phy_link_handle value */ - btampContext->phy_link_handle = pBapHCIPhysLinkAccept->phy_link_handle; - /* Copy out the key material from the HCI command */ - btampContext->key_type = pBapHCIPhysLinkAccept->key_type; - btampContext->key_length = pBapHCIPhysLinkAccept->key_length; - vos_mem_copy( - btampContext->key_material, - pBapHCIPhysLinkAccept->key_material, - 32); /* Need a key size define */ - break; - default: - *status = WLANBAP_ERROR_HOST_REJ_RESOURCES; /* return the BT-AMP status here */ - return VOS_STATUS_E_RESOURCES; - } - - conAcceptTOInterval = (btampContext->bapConnectionAcceptTimerInterval * 5)/ 8; - /* Start the Connection Accept Timer */ - vosStatus = WLANBAP_StartConnectionAcceptTimer ( - btampContext, - conAcceptTOInterval); - - *status = WLANBAP_STATUS_SUCCESS; /* return the BT-AMP status here */ - - return VOS_STATUS_SUCCESS; -} //gotoS1 - -VOS_STATUS -gotoScanning -( - ptBtampContext btampContext, /* btampContext value */ - tWLAN_BAPRole BAPDeviceRole, - v_U8_t *status /* return the BT-AMP status here */ -) -{ - /* Initiate a SCAN request */ - //csrScanRequest(); - *status = WLANBAP_STATUS_SUCCESS; /* return the BT-AMP status here */ - - return VOS_STATUS_SUCCESS; -} - - -#if 0 -/*========================================================================== - - FUNCTION: convertRoleToBssType - - DESCRIPTION: Return one of the following values: - - eCSR_BSS_TYPE_INFRASTRUCTURE, - eCSR_BSS_TYPE_IBSS, // an IBSS network we will NOT start - eCSR_BSS_TYPE_START_IBSS, // an IBSS network we will start if no partners detected. - eCSR_BSS_TYPE_WDS_AP, // BT-AMP AP - eCSR_BSS_TYPE_WDS_STA, // BT-AMP station - eCSR_BSS_TYPE_ANY, -============================================================================*/ -#endif -eCsrRoamBssType -convertRoleToBssType -( - tWLAN_BAPRole bapRole /* BT-AMP role */ -) -{ - switch (bapRole) - { - case BT_RESPONDER: - // an WDS network we will join - return eCSR_BSS_TYPE_WDS_STA; - //return eCSR_BSS_TYPE_INFRASTRUCTURE; - //return eCSR_BSS_TYPE_IBSS; // Initial testing with IBSS on both ends makes more sense - case BT_INITIATOR: - // an WDS network we will start if no partners detected. - return eCSR_BSS_TYPE_WDS_AP; - //return eCSR_BSS_TYPE_START_IBSS; // I really should try IBSS on both ends - default: - return eCSR_BSS_TYPE_INFRASTRUCTURE; - } -} // convertRoleToBssType - - -char hexValue[] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' - }; - -#define BAP_MIN(x, y) ((x) < (y) ? (x) : (y)) -#define MAX_BYTES 8 -// Each byte will be converted to hex digits followed by a -// punctuation (which is specified in the "delimiter" param.) Thus -// allocate three times the storage. -v_U8_t * -bapBin2Hex(const v_U8_t *bytes, v_U32_t len, char delimiter) -{ - static v_U8_t buf[MAX_BYTES*(2+1)]; - v_U32_t i; - v_U8_t *ptr; - - len = BAP_MIN(len, MAX_BYTES); - for (i = 0, ptr = buf; i < len; i++) - { - *ptr++ = hexValue[ (bytes[i] >> 4) & 0x0f]; - *ptr++ = hexValue[ bytes[i] & 0x0f]; - *ptr++ = delimiter; - //sprintf(ptr, "%.2x%c", bytes[i], delimiter); - //ptr += 3; - } - - // Delete the extra punctuation and null terminate the string - if (len > 0) - ptr--; - *ptr = '\0'; - - return buf; -}// bapBin2Hex - -char bapSsidPrefixValue[] = {'A', 'M', 'P', '-'}; - -v_U8_t * -convertBSSIDToSSID -( - v_U8_t *bssid /* BSSID value */ -) -{ - static v_U8_t ssId[32]; - - vos_mem_copy( - ssId, - bapSsidPrefixValue, - 4); - - vos_mem_copy( - &ssId[4], - bapBin2Hex(bssid, 6, '-'), - 17); - - return ssId; -} // convertBSSIDToSSID - -VOS_STATUS -convertToCsrProfile -( - ptBtampContext btampContext, /* btampContext value */ - eCsrRoamBssType bssType, - tCsrRoamProfile *pProfile /* return the profile info here */ -) -{ - static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, - 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 - }; - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_S7_t sessionid = -1; - tHalHandle hHal = NULL; - v_U32_t triplet; - v_U8_t regulatoryClass; - v_U8_t firstChannel; - v_U8_t numChannels; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - if (NULL == btampContext) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "btampContext is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - //Zero out entire roamProfile structure to avoid problems in uninitialized pointers as the structure expands */ - //vos_mem_zero(pProfile,sizeof(tCsrRoamProfile)); - - //Set the BSS Type - //pProfile->BSSType = convertRoleToBssType(btampContext->BAPDeviceRole ); - pProfile->BSSType = bssType; - //pProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; - - //Set the SSID - - if ( bssType == eCSR_BSS_TYPE_WDS_STA) - { - pProfile->SSIDs.numOfSSIDs = 2; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __func__, "eCSR_BSS_TYPE_WDS_STA", convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr)); - - vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, - sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId)); - vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId, - convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr), - 21); // Length of BTAMP SSID is 21 bytes - pProfile->SSIDs.SSIDList[0].SSID.length = 21; - - vos_mem_zero(pProfile->SSIDs.SSIDList[1].SSID.ssId, - sizeof(pProfile->SSIDs.SSIDList[1].SSID.ssId)); - vos_mem_copy(pProfile->SSIDs.SSIDList[1].SSID.ssId, - convertBSSIDToSSID(btampContext->self_mac_addr), - 21); // Length of BTAMP SSID is 21 bytes - pProfile->SSIDs.SSIDList[1].SSID.length = 21; - - //Set the BSSID to the Remote AP - pProfile->BSSIDs.numOfBSSIDs = 1; - vos_mem_copy(pProfile->BSSIDs.bssid, - btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, - sizeof( tCsrBssid ) ); - - } - else if ( bssType == eCSR_BSS_TYPE_WDS_AP) - { - pProfile->SSIDs.numOfSSIDs = 1; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __func__, "eCSR_BSS_TYPE_WDS_AP", convertBSSIDToSSID(btampContext->self_mac_addr)); - - vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, - sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId)); - vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId, - convertBSSIDToSSID(btampContext->self_mac_addr), - 21); // Length of BTAMP SSID is 21 bytes - pProfile->SSIDs.SSIDList[0].SSID.length = 21; - -#if 0 - //In case you are an AP, don't set the BSSID - pProfile->BSSIDs.numOfBSSIDs = 0; -#endif //0 - - //Set the BSSID to your "self MAC Addr" - pProfile->BSSIDs.numOfBSSIDs = 1; - vos_mem_copy(pProfile->BSSIDs.bssid, - btampContext->self_mac_addr, - sizeof( tCsrBssid ) ); - - } - else - // Handle everything else as bssType eCSR_BSS_TYPE_INFRASTRUCTURE - { - pProfile->SSIDs.numOfSSIDs = 1; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: bssType = %s, SSID specified = %s\n", __func__, "eCSR_BSS_TYPE_WDS_STA", convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr)); - - vos_mem_zero(pProfile->SSIDs.SSIDList[0].SSID.ssId, - sizeof(pProfile->SSIDs.SSIDList[0].SSID.ssId)); - vos_mem_copy(pProfile->SSIDs.SSIDList[0].SSID.ssId, - convertBSSIDToSSID(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr), - 21); // Length of BTAMP SSID is 21 bytes - pProfile->SSIDs.SSIDList[0].SSID.length = 21; - - //Set the BSSID to the Remote AP - pProfile->BSSIDs.numOfBSSIDs = 1; - vos_mem_copy(pProfile->BSSIDs.bssid, - btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, - sizeof( tCsrBssid ) ); - - } - - //Always set the Auth Type - //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_RSN_PSK; - //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_NONE; - //pProfile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; - pProfile->AuthType.numEntries = 1; - //pProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; - pProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; - - //Always set the Encryption Type - //pProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_AES; - //pProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_NONE; - pProfile->EncryptionType.numEntries = 1; - //pProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; - pProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; - - pProfile->mcEncryptionType.numEntries = 1; - //pProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; - pProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; - - //set the RSN IE - //This is weird, but it works - pProfile->pRSNReqIE = &btampRSNIE[0]; - pProfile->nRSNReqIELength = 0x16; //TODO - //pProfile->pRSNReqIE = NULL; - - /** We don't use the WPAIE.But NULL it to avoid being used **/ - pProfile->pWPAReqIE = NULL; - pProfile->nWPAReqIELength = 0; - - // Identify the operation channel - - /* Choose the operation channel from the preferred channel list */ - pProfile->operationChannel = 0; - regulatoryClass = 0; - for (triplet = 0; triplet < btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets; triplet++) - { - firstChannel = 0; - numChannels = 0; - - /* is this a regulatory class triplet? */ - if (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][0] == 201) - { - /* identify supported 2.4GHz regulatory classes */ - switch (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][1]) - { - case 254: - { - /* class 254 is special regulatory class defined by BT HS+3.0 spec that - is valid only for unknown/'mobile' country */ - if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'X') && - (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'X')) - { - regulatoryClass = 254; - firstChannel = 1; - numChannels = 11; - } - break; - } - case 12: - { - /* class 12 in the US regulatory domain is 2.4GHz channels 1-11 */ - if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'U') && - (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'S')) - { - regulatoryClass = 12; - firstChannel = 1; - numChannels = 11; - } - break; - } - case 4: - { - /* class 4 in the Europe regulatory domain is 2.4GHz channels 1-13 */ - if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'G') && - (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'B')) - { - regulatoryClass = 4; - firstChannel = 1; - numChannels = 13; - } - break; - } - case 30: - { - /* class 30 in the Japan regulatory domain is 2.4GHz channels 1-13 */ - if ((btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[0] == 'J') && - (btampContext->btamp_Remote_AMP_Assoc.HC_pref_country[1] == 'P')) - { - regulatoryClass = 30; - firstChannel = 1; - numChannels = 13; - } - break; - } - default: - { - break; - } - } - /* if the next triplet is not another regulatory class triplet then it must be a sub-band - triplet. Skip processing the default channels for this regulatory class triplet and let - the sub-band triplet restrict the available channels */ - if (((triplet+1) < btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets) && - (btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet+1][0] != 201)) - { - continue; - } - } - else - { - /* if the regulatory class is valid then this is a sub-band triplet */ - if (regulatoryClass) - { - firstChannel = btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][0]; - numChannels = btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[triplet][1]; - } - } - - if (firstChannel && numChannels) - { - if (!btampContext->btamp_AMP_Assoc.HC_pref_num_triplets) - { - pProfile->operationChannel = firstChannel; - break; - } - else if (((btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] + btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1]) <= firstChannel) || - ((firstChannel + numChannels ) <= btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0])) - { - continue; - } - else if ((btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] + btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1]) > firstChannel) - { - pProfile->operationChannel = firstChannel; - break; - } - else if ((firstChannel + numChannels) > btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0]) - { - pProfile->operationChannel = btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0]; - break; - } - } - } - - if (!pProfile->operationChannel) - { - return VOS_STATUS_E_INVAL; - } - - /*Set the selected channel */ - sessionid = sme_GetInfraSessionId(hHal); - /*if there is infra session up already, use that channel only for BT AMP - connection, else we can use the user preferred one*/ - if(-1 != sessionid) - { - pProfile->operationChannel = - sme_GetInfraOperationChannel(hHal, - sessionid); - } - - if(sme_IsChannelValid(hHal, pProfile->operationChannel)) - { - btampContext->channel = pProfile->operationChannel; - } - else - { - //no valid channel, not proceeding with connection - return VOS_STATUS_E_INVAL; - } - - if ( BT_INITIATOR == btampContext->BAPDeviceRole ) - { - pProfile->ChannelInfo.numOfChannels = 1; - pProfile->ChannelInfo.ChannelList = &pProfile->operationChannel; - } - else - { - pProfile->ChannelInfo.numOfChannels = 1; - pProfile->ChannelInfo.ChannelList = &pProfile->operationChannel; - } - - - // Turn off CB mode - pProfile->CBMode = eCSR_CB_OFF; - - //set the phyMode to accept anything - //Taurus means everything because it covers all the things we support - pProfile->phyMode = eCSR_DOT11_MODE_11n; //eCSR_DOT11_MODE_TAURUS; //eCSR_DOT11_MODE_AUTO; /*eCSR_DOT11_MODE_BEST;*/ - - //set the mode in CFG as well - sme_CfgSetInt(hHal, WNI_CFG_DOT11_MODE, WNI_CFG_DOT11_MODE_11N, NULL, eANI_BOOLEAN_FALSE); - - pProfile->bWPSAssociation = eANI_BOOLEAN_FALSE; - - //Make sure we DON'T request UAPSD - pProfile->uapsd_mask = 0; - - //return the vosStatus - return vosStatus; -} //convertToCsrProfile - -VOS_STATUS -gotoStarting -( - ptBtampContext btampContext, /* btampContext value */ - ptWLAN_BAPEvent bapEvent, /* State machine event */ - eCsrRoamBssType bssType, - v_U8_t *status /* return the BT-AMP status here */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - eHalStatus halStatus; - v_U32_t parseStatus, type, subType; - /* tHalHandle */ - tHalHandle hHal; - tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pBapHCIWriteRemoteAMPAssoc - = (tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *) bapEvent->params; - tBtampAMP_ASSOC btamp_ASSOC; - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - if (NULL == btampContext) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "btampContext is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - //If we are a BT-Responder, we are assuming we are a BT "slave" and we HAVE - //to "squelch" the slaves frequent (every 1.25ms) polls. - - if (eCSR_BSS_TYPE_WDS_STA == bssType) - { - /* Sleep for 300(200) milliseconds - to allow BT through */ - vos_sleep( 200 ); - /* Signal BT Coexistence code in firmware to prefer WLAN */ - WLANBAP_NeedBTCoexPriority ( btampContext, 1); - } - - - //Tell PMC to exit BMPS; - halStatus = pmcRequestFullPower( - hHal, - WLANBAP_pmcFullPwrReqCB, - btampContext, - eSME_REASON_OTHER); - // JEZ081210: This has to wait until we sync down from - // /main/latest as of 12/4. We are currently at 12/3. - //eSME_FULL_PWR_NEEDED_BY_BAP); - //Need to check the result...because Host may have been told by - //OS to go to standby (D2) device state. In that case, I have to - //fail the HCI Create Physical Link - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "In %s, amp_assoc_remaining_length = %d", __func__, - pBapHCIWriteRemoteAMPAssoc->amp_assoc_remaining_length); -#if 0 - DUMPLOG(1, __func__, "amp_assoc_fragment", - pBapHCIWriteRemoteAMPAssoc->amp_assoc_fragment, - 64); -#endif //0 - - //What about parsing the AMP Assoc structure? - parseStatus = btampUnpackAMP_ASSOC( - hHal, - pBapHCIWriteRemoteAMPAssoc->amp_assoc_fragment, - pBapHCIWriteRemoteAMPAssoc->amp_assoc_remaining_length, - &btamp_ASSOC); - - /* Unknown or Reserved TLVs are allowed in the write AMP assoc fragment */ - if ((BTAMP_PARSE_SUCCESS != parseStatus ) && (BTAMP_UNKNOWN_TLVS != parseStatus)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, parseStatus = %d", __func__, parseStatus); - *status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM; - return VOS_STATUS_E_BADMSG; - } - - //What about writing the peer MAC address, and other info to the BTAMP - //context for this physical link? - if (btamp_ASSOC.AMP_Assoc_MAC_Addr.present == 1) - { - /* Save the peer MAC address */ - vos_mem_copy( - btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr, - btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr, - sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_mac_addr)); - /* Save it in the peer MAC address field */ - vos_mem_copy( - btampContext->peer_mac_addr, - btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr, - sizeof(btampContext->peer_mac_addr)); - } - - if (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present == 1) - { - /* Save the peer Preferred Channel List */ - vos_mem_copy( - btampContext->btamp_Remote_AMP_Assoc.HC_pref_country, - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, - sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_pref_country)); - /* Save the peer Preferred Channel List */ - btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets = - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets; - if(WLANBAP_MAX_NUM_TRIPLETS < - btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets) - { - btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets = - WLANBAP_MAX_NUM_TRIPLETS; - } - vos_mem_copy( - btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets, - btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets, - sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_pref_triplets[0]) * - btampContext->btamp_Remote_AMP_Assoc.HC_pref_num_triplets - ); - } - - if (btamp_ASSOC.AMP_Assoc_Connected_Channel.present == 1) - { - /* Save the peer Connected Channel */ - vos_mem_copy( - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_country, - btamp_ASSOC.AMP_Assoc_Connected_Channel.country, - sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_cnct_country)); - /* Save the peer Connected Channel */ - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets = - btamp_ASSOC.AMP_Assoc_Connected_Channel.num_triplets; - if(WLANBAP_MAX_NUM_TRIPLETS < - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets) - { - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets = - WLANBAP_MAX_NUM_TRIPLETS; - } - vos_mem_copy( - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_triplets, - btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets, - sizeof(btampContext->btamp_Remote_AMP_Assoc.HC_cnct_triplets[0]) * - btampContext->btamp_Remote_AMP_Assoc.HC_cnct_num_triplets - ); - } - - if (btamp_ASSOC.AMP_Assoc_PAL_Capabilities.present == 1) - { - /* Save the peer PAL Capabilities */ - btampContext->btamp_Remote_AMP_Assoc.HC_pal_capabilities - = btamp_ASSOC.AMP_Assoc_PAL_Capabilities.pal_capabilities; - } - - if (btamp_ASSOC.AMP_Assoc_PAL_Version.present == 1) - { - /* Save the peer PAL Version */ - btampContext->btamp_Remote_AMP_Assoc.HC_pal_version - = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_version; - - btampContext->btamp_Remote_AMP_Assoc.HC_pal_CompanyID - = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_CompanyID; - - btampContext->btamp_Remote_AMP_Assoc.HC_pal_subversion - = btamp_ASSOC.AMP_Assoc_PAL_Version.pal_subversion; - } - - //Set Connection Accept Timeout; - /* Already done in gotoS1() */ - //Set gNeedPhysLinkCompEvent; - //JEZ081114: This needs to happen earlier. In gotoS1. Right at HCI Create Physical Link - btampContext->gNeedPhysLinkCompEvent = VOS_TRUE; - //Clear gDiscRequested; - btampContext->gDiscRequested = VOS_FALSE; - //Set gPhysLinkStatus to 0 (no error); - btampContext->gPhysLinkStatus = WLANBAP_STATUS_SUCCESS; - //Set gDiscReason to 0 (no reason); - btampContext->gDiscReason = WLANBAP_STATUS_SUCCESS; - /* Initiate the link as either START or JOIN */ - //halStatus = csrRoamOpenSession(&newSession); - /*Added by Luiza:*/ - - if (btampContext->isBapSessionOpen == FALSE) - { - - vosStatus = vos_get_vdev_types(VOS_STA_SAP_MODE, &type, &subType); - if (VOS_STATUS_SUCCESS != vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "failed to get vdev type"); - return VOS_STATUS_E_FAILURE; - } - halStatus = sme_OpenSession(hHal, - WLANBAP_RoamCallback, - btampContext, - // <=== JEZ081210: FIXME - //(tANI_U8 *) btampContext->self_mac_addr, - btampContext->self_mac_addr, - &btampContext->sessionId, - type,subType); - if(eHAL_STATUS_SUCCESS == halStatus) - { - btampContext->isBapSessionOpen = TRUE; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "sme_OpenSession failed in %s", __func__); - *status = WLANBAP_ERROR_NO_CNCT; - return VOS_STATUS_E_FAILURE; - } - } - /* Update the SME Session info for this Phys Link (i.e., for this Phys State Machine instance) */ - //bapUpdateSMESessionForThisPhysLink(newSession, PhysLinkHandle); - // Taken care of, above - //halStatus = csrRoamConnect(newSession, bssType); - // Final - vosStatus = convertToCsrProfile ( - btampContext, /* btampContext value */ - bssType, - &btampContext->csrRoamProfile); /* return the profile info here */ - if(VOS_STATUS_E_INVAL == vosStatus) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Incorrect channel to create AMP link %s", __func__); - *status = WLANBAP_ERROR_NO_SUITABLE_CHANNEL; - return VOS_STATUS_E_INVAL; - } -#if 0 - halStatus = sme_RoamConnect(VOS_GET_HAL_CB(btampContext->pvosGCtx), - &btampContext->csrRoamProfile, - NULL, /* tScanResultHandle hBssListIn, */ - &btampContext->csrRoamId); -#endif //0 -//#if 0 - halStatus = sme_RoamConnect(hHal, - btampContext->sessionId, - &btampContext->csrRoamProfile, - &btampContext->csrRoamId); -//#endif //0 - - //Map the halStatus into a vosStatus - return vosStatus; -} //gotoStarting - -VOS_STATUS -gotoConnecting( - ptBtampContext btampContext /* btampContext value */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /* No longer needed. This call has been made in gotoStarting(). */ - /* Signal BT Coexistence code in firmware to prefer WLAN */ - WLANBAP_NeedBTCoexPriority ( btampContext, 1); - - return vosStatus; -} //gotoConnecting - -VOS_STATUS -gotoAuthenticating( - ptBtampContext btampContext /* btampContext value */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /* Signal BT Coexistence code in firmware to prefer WLAN */ - WLANBAP_NeedBTCoexPriority ( btampContext, 1); - - return vosStatus; -} //gotoAuthenticating - -#if 0 -VOID initRsnSupplicant() -{ -/* This is a NO-OP. The Supplicant waits for MSG 1 */ -} -#endif /* 0 */ -VOS_STATUS -initRsnSupplicant -( - ptBtampContext btampContext, /* btampContext value */ - tWLAN_BAPRole BAPDeviceRole -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - - /* This is a NO-OP. The Supplicant waits for MSG 1 */ - /* Init RSN FSM */ - if (!(suppRsnFsmCreate(btampContext))) - { - /* Send Start Event */ - /* RSN_FSM_AUTH_START */ - } - else - { - /* RSN Init Failed */ - vosStatus = VOS_STATUS_E_FAILURE; - } - /* This is a NO-OP. The Supplicant waits for MSG 1 */ - return vosStatus; -} - -#if 0 -VOID initRsnAuthenticator() -{ -/* Signal the Authenticator/Supplicant App that we are associated. */ -/* Use an IOCTL? That the app is hanging a read on? Or use a "special" data packet. Again, that the app is waiting on a receive for. */ -} -#endif /* 0 */ -VOS_STATUS -initRsnAuthenticator -( - ptBtampContext btampContext, /* btampContext value */ - tWLAN_BAPRole BAPDeviceRole -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /* Init RSN FSM */ - if (!(authRsnFsmCreate(btampContext))) - { - /* Send Start Event */ - } - else - { - /* RSN Init Failed */ - vosStatus = VOS_STATUS_E_FAILURE; - } - return vosStatus; -/* Signal the Authenticator/Supplicant App that we are associated. */ -/* Use an IOCTL? That the app is hanging a read on? Or use a "special" data packet. Again, that the app is waiting on a receive for. */ -} - -/* We have to register our STA with TL */ -VOS_STATUS -regStaWithTl -( - ptBtampContext btampContext, /* btampContext value */ - tWLAN_BAPRole BAPDeviceRole, - tCsrRoamInfo *pCsrRoamInfo -) -{ - VOS_STATUS vosStatus; - WLAN_STADescType staDesc; - tANI_S8 rssi = 0; - - vos_mem_zero(&staDesc, sizeof(WLAN_STADescType)); - /* Fill in everything I know about the STA */ - btampContext->ucSTAId = staDesc.ucSTAId = pCsrRoamInfo->staId; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BAP register TL ucSTAId=%d\n", - staDesc.ucSTAId ); - - /* Fill in the peer MAC address */ - vos_mem_copy( - staDesc.vSTAMACAddress.bytes, - btampContext->peer_mac_addr, - sizeof(btampContext->peer_mac_addr)); - - /* Fill in the self MAC address */ - vos_mem_copy( - staDesc.vSelfMACAddress.bytes, - btampContext->self_mac_addr, - sizeof(btampContext->peer_mac_addr)); - - /* Set the STA Type */ - staDesc.wSTAType = WLAN_STA_BT_AMP; - - // Set the QoS field appropriately, if the info available - if( pCsrRoamInfo->u.pConnectedProfile) - { - btampContext->bapQosCfg.bWmmIsEnabled = //1; - pCsrRoamInfo->u.pConnectedProfile->qosConnection; - } - else - { - btampContext->bapQosCfg.bWmmIsEnabled = 0; - } - - // set the QoS field appropriately - if( btampContext->bapQosCfg.bWmmIsEnabled ) - { - staDesc.ucQosEnabled = 1; - } - else - { - staDesc.ucQosEnabled = 0; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BAP register TL QoS_enabled=%d\n", - staDesc.ucQosEnabled ); - - // UMA is ready we inform TL not to do frame - // translation for WinMob 6.1 - //*** Not to enabled UMA. - /* Enable UMA for TX translation only when there is no concurrent session active */ - staDesc.ucSwFrameTXXlation = 1; - staDesc.ucSwFrameRXXlation = 1; - staDesc.ucAddRmvLLC = 0; - - if ( btampContext->ucSecEnabled ) - { - staDesc.ucProtectedFrame = 1; - } - else - { - staDesc.ucProtectedFrame = 0; - } - - staDesc.ucUcastSig = pCsrRoamInfo->ucastSig; - staDesc.ucBcastSig = pCsrRoamInfo->bcastSig; - staDesc.ucInitState = ( btampContext->ucSecEnabled)? - WLANTL_STA_CONNECTED:WLANTL_STA_AUTHENTICATED; - staDesc.ucIsReplayCheckValid = VOS_FALSE; - if(NULL != pCsrRoamInfo->pBssDesc) - { - rssi = pCsrRoamInfo->pBssDesc->rssi; - } - /* register our STA with TL */ - vosStatus = WLANTL_RegisterSTAClient - ( - btampContext->pvosGCtx, - WLANBAP_STARxCB, - WLANBAP_TxCompCB, - (WLANTL_STAFetchPktCBType)WLANBAP_STAFetchPktCB, - &staDesc , - rssi); - if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", - __func__, vosStatus, vosStatus ); - } - - if ( ! btampContext->ucSecEnabled ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED, - "open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time", btampContext->ucSTAId); - - // Connections that do not need Upper layer auth, transition TL directly - // to 'Authenticated' state. - vosStatus = WLANTL_ChangeSTAState(btampContext->pvosGCtx, - staDesc.ucSTAId, - WLANTL_STA_AUTHENTICATED, VOS_FALSE); - } - else - { - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED, - "ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", btampContext->ucSTAId ); - - vosStatus = WLANTL_ChangeSTAState(btampContext->pvosGCtx, - staDesc.ucSTAId, - WLANTL_STA_CONNECTED, VOS_FALSE); - } - - return VOS_STATUS_SUCCESS; -} /* regStaWithTl */ - -#if 0 -/*========================================================================== - - FUNCTION: determineChan - - DESCRIPTION: Return the current channel we are to operate on - -============================================================================*/ -#endif - -VOS_STATUS -determineChan -( - ptBtampContext btampContext, /* btampContext value */ - tWLAN_BAPRole BAPDeviceRole, - v_U32_t *channel, /* Current channel */ - v_U8_t *status /* return the BT-AMP status here */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - v_U32_t activeFlag; /* Channel active flag */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - switch(BAPDeviceRole) - { - case BT_INITIATOR: - /* if an Infra assoc already exists, return that channel. */ - /* or use the results from the Scan to determine the least busy channel. How? */ - /* For now, just do this. */ - vosStatus = WLANBAP_GetCurrentChannel (btampContext, channel, &activeFlag); - break; - case BT_RESPONDER: - /* return the value obtained from the Preferred Channels field of the AMP Assoc structure from the BT-AMP peer (device A) */ - /* No! I don't have that yet. */ - /* For now, just do this. */ - vosStatus = WLANBAP_GetCurrentChannel (btampContext, channel, &activeFlag); - break; - default: - *status = WLANBAP_ERROR_HOST_REJ_RESOURCES; /* return the BT-AMP status here */ - return VOS_STATUS_E_RESOURCES; - } - *status = WLANBAP_STATUS_SUCCESS; /* return the BT-AMP status here */ - - return vosStatus; -} // determineChan - -VOS_STATUS -gotoDisconnected -( - ptBtampContext btampContext /* btampContext value */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - //Is it legitimate to always make this call? - //What if pmcRequestFullPower wasn't called? - //Tell PMC to resume BMPS; /* Whatever the previous BMPS "state" was */ - //Comment this out until such time as we have PMC support - //halStatus = pmcResumePower ( hHal); - - /* Signal BT Coexistence code in firmware to no longer prefer WLAN */ - WLANBAP_NeedBTCoexPriority ( btampContext, 0); - - //Map the halStatus into a vosStatus - return vosStatus; -} // gotoDisconnected - -VOS_STATUS -gotoDisconnecting -( - ptBtampContext btampContext, /* btampContext value */ - v_U8_t needPhysLinkCompEvent, - v_U8_t physLinkStatus, /* BT-AMP disconnecting status */ -// v_U8_t statusPresent, /* BT-AMP disconnecting status present */ - v_U8_t discRequested, - v_U8_t discReason /* BT-AMP disconnecting reason */ -) -{ - - // gNeedPhysLinkCompEvent - btampContext->gNeedPhysLinkCompEvent = needPhysLinkCompEvent; - // gPhysLinkStatus - btampContext->gPhysLinkStatus = physLinkStatus; /* BT-AMP disconnecting status */ - // gDiscRequested - btampContext->gDiscRequested = discRequested; - // gDiscReason - btampContext->gDiscReason = discReason; /* BT-AMP disconnecting reason */ - - //WLANBAP_DeInitLinkSupervision( btampHandle); - //WLANBAP_StopLinkSupervisionTimer(btampContext); - - /* Inform user space that no AMP channel is in use, for AFH purposes */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, - "Calling send_btc_nlink_msg() with AMP channel = 0"); - send_btc_nlink_msg(WLAN_AMP_ASSOC_DONE_IND, 0); - - return VOS_STATUS_SUCCESS; -} //gotoDisconnecting - -VOS_STATUS -gotoConnected -( - ptBtampContext btampContext /* btampContext value */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampHandle btampHandle = ( ptBtampHandle)btampContext; -//#if 0 - /* Stop the Connection Accept Timer */ - vosStatus = WLANBAP_StopConnectionAcceptTimer (btampContext); -//#endif - ///*De-initialize the timer */ - //vosStatus = WLANBAP_DeinitConnectionAcceptTimer(btampContext); - - /* Signal BT Coex in firmware to now honor only priority BT requests */ - WLANBAP_NeedBTCoexPriority ( btampContext, 2); - - // If required after successful Upper layer auth, transition TL - // to 'Authenticated' state. - if ( btampContext->ucSecEnabled ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_MED, - "open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time", btampContext->ucSTAId); - - vosStatus = WLANTL_ChangeSTAState(btampContext->pvosGCtx, - btampContext->ucSTAId, - WLANTL_STA_AUTHENTICATED, VOS_FALSE); - } - - btampContext->dataPktPending = VOS_FALSE; - vosStatus = WLANBAP_InitLinkSupervision( btampHandle); - - /* Inform user space of the AMP channel selected, for AFH purposes */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, - "Calling send_btc_nlink_msg() with AMP channel %d", btampContext->channel); - send_btc_nlink_msg(WLAN_AMP_ASSOC_DONE_IND, btampContext->channel); - - return vosStatus; -} //gotoConnected - - -/* the HCI Event signalling routine*/ -VOS_STATUS -signalHCIPhysLinkCompEvent -( - ptBtampContext btampContext, /* btampContext value */ - v_U8_t status /* the BT-AMP status */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /* Format the Physical Link Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = status; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle - = btampContext->phy_link_handle; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number - = btampContext->channel; - - if(WLANBAP_STATUS_SUCCESS == status) - { - /* Start the Tx packet monitoring timer */ - WLANBAP_StartTxPacketMonitorTimer(btampContext); - } - else - { //reset the PL handle - btampContext->phy_link_handle = 0; - } - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* signalHCIPhysLinkCompEvent */ - -/* the HCI Disconnect Complete Event signalling routine*/ -VOS_STATUS -signalHCIPhysLinkDiscEvent -( - ptBtampContext btampContext, /* btampContext value */ - v_U8_t status, /* the BT-AMP status */ - v_U8_t reason /* the BT-AMP reason code */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - v_U8_t i; - tpBtampLogLinkCtx pLogLinkContext = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -#ifdef BAP_DEBUG - /* Trace the tBtampCtx being passed in. */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "WLAN BAP Context Monitor: btampContext value = %p in %s:%d", btampContext, __func__, __LINE__ ); -#endif //BAP_DEBUG - - /* Loop disconnecting all Logical Links on this Physical Link */ - for (i = 0 ; i < WLANBAP_MAX_LOG_LINKS; i++) - { - pLogLinkContext = &(btampContext->btampLogLinkCtx[i]); - - if (pLogLinkContext->present == VOS_TRUE) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "WLAN BAP: Deleting logical link entry %d in %s", i, - __func__); - - /* Mark this Logical Link index value as free */ - pLogLinkContext->present = VOS_FALSE; - - // signalHCIDiscLogLink(status = SUCCESS, reason = CONNECTION_TERM_BY_REMOTE_HOST); - signalHCIDiscLogLinkCompEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - i, // logical link - // I don't know how to signal CONNECTION_TERM_BY_REMOTE_HOST - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - } - - /*Reset current_log_link_index and total_log_link_index values*/ - btampContext->current_log_link_index = 0; - btampContext->total_log_link_index = 0; - - /* Format the Physical Link Disconnect Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.present = 1; - bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.status = status; - bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.reason = reason;//uncommented to debug - bapHCIEvent.u.btampDisconnectPhysicalLinkCompleteEvent.phy_link_handle - = btampContext->phy_link_handle; - - /* Stop the Tx packet monitoring timer */ - WLANBAP_StopTxPacketMonitorTimer(btampContext); - - /*Need to clean up the phy link handle as we are disconnected at this - point - ?? - do we need to do any more cleanup on this*/ - btampContext->phy_link_handle = 0; - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* signalHCIPhysLinkDiscEvent */ - -/* the HCI Channel Select Event signalling routine*/ -VOS_STATUS -signalHCIChanSelEvent -( - ptBtampContext btampContext /* btampContext value */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /* Format the Physical Link Disconnect Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT; - bapHCIEvent.u.btampChannelSelectedEvent.present = 1; - bapHCIEvent.u.btampChannelSelectedEvent.phy_link_handle - = btampContext->phy_link_handle; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* signalHCIChanSelEvent */ - - -/* the HCI Disconnect Logical Link Complete Event signalling routine*/ -VOS_STATUS -signalHCIDiscLogLinkCompEvent -( - ptBtampContext btampContext, /* btampContext value */ - v_U8_t status, /* the BT-AMP status */ - v_U16_t log_link_handle, /* The Logical Link that disconnected*/ - v_U8_t reason /* the BT-AMP reason code */ -) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - - /* Format the Logical Link Disconnect Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.present = 1; - bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.status = status; - bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.reason = reason; - bapHCIEvent.u.btampDisconnectLogicalLinkCompleteEvent.log_link_handle - = (log_link_handle << 8) + btampContext->phy_link_handle; - - vosStatus = (*btampContext->pBapHCIEventCB) - ( - btampContext->pHddHdl, /* this refers the BSL per application context */ - &bapHCIEvent, /* This now encodes ALL event types */ - VOS_TRUE /* Flag to indicate assoc-specific event */ - ); - - return vosStatus; -} /* signalHCIDiscLogLinkCompEvent */ - - -// These are needed to recognize RSN suite types -#define WLANBAP_RSN_OUI_SIZE 4 -tANI_U8 pRSNOui00[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher -tANI_U8 pRSNOui01[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN -tANI_U8 pRSNOui02[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK -tANI_U8 pRSNOui03[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved -tANI_U8 pRSNOui04[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP -tANI_U8 pRSNOui05[ WLANBAP_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104 - -/* Incoming Association indication validation predicate */ -v_U32_t -validAssocInd -( - ptBtampContext btampContext, /* btampContext value */ - tCsrRoamInfo *pRoamInfo -) -{ - /* tHalHandle */ - tHalHandle hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - v_U32_t ieLen; - - /* For now, always return true */ - return VOS_TRUE; - - /* Check for a valid peer MAC address */ - /* For an incoming Assoc Indication, the peer MAC address - * should match the value that the BlueTooth AMP - * configured us with. - */ - if ( !vos_mem_compare( btampContext->peer_mac_addr, - pRoamInfo->peerMac, - sizeof(btampContext->peer_mac_addr) )) - { - /* Return not valid */ - return VOS_FALSE; - } - - /* JEZ081115: For now, ignore the RSN IE */ - /* Otherwise, it is valid */ - return VOS_TRUE; - - /* Check for a trivial case: IEs missing */ - if( pRoamInfo->prsnIE == NULL ) - { - //btampContext->ieFields = NULL; - //btampContext->ieLen = 0; - /* Return not valid */ - return VOS_FALSE; - } - - //btampContext->ieLen = GET_IE_LEN_IN_BSS( pBssDesc->length ); - //ieLen = GET_IE_LEN_IN_BSS( pBssDesc->length ); - ieLen = pRoamInfo->rsnIELen; - - /* Check for a trivial case: IEs zero length */ - //if( btampContext->ieLen == 0 ) - if( ieLen == 0 ) - { - //btampContext->ieFields = NULL; - //btampContext->ieLen = 0; - /* Return not valid */ - return VOS_FALSE; - } - - { - // --- Start of block --- - tDot11fBeaconIEs dot11BeaconIEs; - tDot11fIESSID *pDot11SSID; - tDot11fIERSN *pDot11RSN; - - // JEZ081215: This really needs to be updated to just validate the RSN IE. - // Validating the SSID can be done directly from... - - // "Unpack" really wants tpAniSirGlobal (pMac) as its first param. - // But since it isn't used, I just pass in some arbitrary "context" pointer. - // So hHalHandle will make it happy. - dot11fUnpackBeaconIEs((tpAniSirGlobal) hHal, - (tANI_U8 *) pRoamInfo->prsnIE, - ieLen, - &dot11BeaconIEs); - - //DUMPLOG(9, __func__, "dot11BeaconIEs", &dot11BeaconIEs, 64); - - pDot11SSID = &dot11BeaconIEs.SSID; - - // Assume there wasn't an SSID in the Assoc Request - btampContext->assocSsidLen = 0; - - if (pDot11SSID->present ) - { - - //DUMPLOG(10, __func__, "pDot11SSID present", pDot11SSID, 64); - - btampContext->assocSsidLen = pDot11SSID->num_ssid; - vos_mem_copy(btampContext->assocSsid, - pDot11SSID->ssid, - btampContext->assocSsidLen ); - } - else - return VOS_FALSE; - - // Check the validity of the SSID against our SSID value - if ( !vos_mem_compare( btampContext->ownSsid, - pDot11SSID->ssid, - btampContext->ownSsidLen )) - { - /* Return not valid */ - return VOS_FALSE; - } - - pDot11RSN = &dot11BeaconIEs.RSN; - - // Assume there wasn't an RSN IE in the Assoc Request - //btampContext->assocRsnIeLen = 0; - - if (pDot11RSN->present ) - { - - //DUMPLOG(10, __func__, "pDot11RSN present", pDot11RSN, 64); - - //The 802.11 BT-AMP PAL only supports WPA2-PSK - if (!vos_mem_compare(pRSNOui02, // RSN-PSK - pDot11RSN->akm_suites[0], - WLANBAP_RSN_OUI_SIZE)) - return VOS_FALSE; - - //The 802.11 BT-AMP PAL only supports AES-CCMP Unicast - if (!vos_mem_compare(pRSNOui04, // AES-CCMP - pDot11RSN->pwise_cipher_suites[0], - WLANBAP_RSN_OUI_SIZE)) - return VOS_FALSE; - } - else - return VOS_FALSE; - - - } // --- End of block --- - - /* Otherwise, it is valid */ - return VOS_TRUE; -} /* validAssocInd */ - -/* the change state function*/ -void -btampfsmChangeToState -( - BTAMPFSM_INSTANCEDATA_T *instance, - BTAMPFSM_STATES_T state -) -{ - instance->stateVar = state; - //BTAMPFSM_ENTRY_FLAG_T disconnectedEntry; - -} - -/* Physical Link state machine function */ -//int -VOS_STATUS -btampFsm -( - //BTAMPFSM_INSTANCEDATA_T *instanceVar - ptBtampContext btampContext, /* btampContext value */ -// tBtampSessCtx *tpBtampSessCtx, /* btampContext value */ - ptWLAN_BAPEvent bapEvent, /* State machine event */ - v_U8_t *status /* return the BT-AMP status here */ -) -{ - /* Retrieve the phy link state machine structure - * from the btampContext value - */ - BTAMPFSM_INSTANCEDATA_T *instanceVar; - v_U32_t msg = bapEvent->event; /* State machine input event message */ - v_U32_t channel; /* Current channel */ - v_U32_t activeFlag; /* Channel active flag */ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - ptBtampHandle btampHandle = ( ptBtampHandle)btampContext; - v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ - v_PVOID_t pHddHdl; /* Handle to return BSL context in */ - tHalHandle hHal = NULL; - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - /* Validate params */ - if (btampHandle == NULL) - { - return VOS_STATUS_E_FAULT; - } - instanceVar = &(btampContext->bapPhysLinkMachine); - - hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx); - if (NULL == hHal) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "hHal is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - } - - - -#define CHANNEL_NOT_SELECTED (WLANBAP_GetCurrentChannel (btampContext, &channel, &activeFlag) != VOS_STATUS_SUCCESS) - - /*Initialize BTAMP PAL status code being returned to the btampFsm caller */ - *status = WLANBAP_STATUS_SUCCESS; - - switch(instanceVar->stateVar) - { - - case DISCONNECTED: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE)) - { - /*Transition from DISCONNECTED to S1 (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "DISCONNECTED", "S1"); - -#if 0 - /* This will have issues in multisession. Need not close the session */ - /* TODO : Need to have better handling */ - if(btampContext->isBapSessionOpen == TRUE)//We want to close only BT-AMP Session - { - sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId); - /*Added by Luiza:*/ - btampContext->isBapSessionOpen = FALSE; - } -#endif - - /* Set BAP device role */ - vosStatus = gotoS1( btampContext, bapEvent, BT_INITIATOR, status); - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, cmd status is %d", __func__, *status); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,S1); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT)) - { - /*Transition from DISCONNECTED to S1 (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "DISCONNECTED", "S1"); - -#if 0 - if(btampContext->isBapSessionOpen == TRUE) - { - sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId); - /*Added by Luiza:*/ - btampContext->isBapSessionOpen = FALSE; - } - /*Action code for transition */ -#endif - - /* Set BAP device role */ - vosStatus = gotoS1(btampContext, bapEvent, BT_RESPONDER, status); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,S1); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "DISCONNECTED", msg); - /* Intentionally left blank */ - } - break; - - case S1: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC - ) && (btampContext->BAPDeviceRole == BT_INITIATOR && !(CHANNEL_NOT_SELECTED))) - { - /*Transition from S1 to STARTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "S1", "STARTING"); - - /*Action code for transition */ - vosStatus = determineChan(btampContext, BT_INITIATOR, &channel, status); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,STARTING); - // This has to be commented out until I get the BT-AMP SME/CSR changes - vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_AP, status); - if (VOS_STATUS_SUCCESS != vosStatus) - { - btampfsmChangeToState(instanceVar, S1); - } - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from S1 to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "S1", "DISCONNECTED"); - - /*Action code for transition */ - /* Set everything back as dis-connected */ - gotoDisconnected( btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - /*Signal the disconnect */ - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_TIMEOUT); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from S1 to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "S1", "DISCONNECTED"); - - /*Action code for transition */ - gotoDisconnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - /*Signal the successful physical link disconnect */ - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Signal the unsuccessful physical link creation */ - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_NO_CNCT ); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC - ) && (btampContext->BAPDeviceRole == BT_RESPONDER)) - { - /*Transition from S1 to STARTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "S1", "STARTING"); - - /*Action code for transition */ - //determineChan(BT_RESPONDER); - vosStatus = determineChan(btampContext, BT_RESPONDER, &channel, status); - btampfsmChangeToState(instanceVar,STARTING);//Moved to here to debug - // This has to be commented out until I get the BT-AMP SME/CSR changes - /*Advance outer statevar */ - // btampfsmChangeToState(instanceVar,STARTING); - vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_STA, status); - if (VOS_STATUS_SUCCESS != vosStatus) - { - btampfsmChangeToState(instanceVar, S1); - } - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC - ) && (btampContext->BAPDeviceRole == BT_INITIATOR && CHANNEL_NOT_SELECTED)) - { - /*Transition from S1 to SCANNING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "S1", "SCANNING"); - - /*Action code for transition */ - gotoScanning(btampContext, BT_RESPONDER, status); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,SCANNING); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "S1", msg); - /* Intentionally left blank */ - } - break; - - case STARTING: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_BSS_SUCCESS - ) && (btampContext->BAPDeviceRole == BT_INITIATOR)) - { - /*Transition from STARTING to CONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "CONNECTING"); - - btampfsmChangeToState(instanceVar,CONNECTING);//Moved to debug - - /*Set the selected channel */ - /*should have been already set */ - btampContext->channel = ( 0 == btampContext->channel )?1:btampContext->channel; - - /*Action code for transition */ - signalHCIChanSelEvent(btampContext); - - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from STARTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - // Danlin, where are the richer reason codes? - // I want to be able to convey everything 802.11 supports... - eCSR_DISCONNECT_REASON_UNSPECIFIED); - - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_NO_CNCT, - //VOS_TRUE, // Should be VOS_FALSE !!! - VOS_FALSE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - // It is NOT clear that we need to send the Phy Link Disconnect - // Complete Event here. - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_CHANNEL_SELECTION_FAILED)) - { - /*Transition from STARTING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "DISCONNECTED"); - - gotoDisconnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - /*Action code for transition */ - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_REJ_RESOURCES ); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_BSS_SUCCESS - ) && (btampContext->BAPDeviceRole == BT_RESPONDER)) - { - /*Transition from STARTING to CONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "CONNECTING"); - - /* Set the selected channel */ - /*should have been already set */ - btampContext->channel = ( 0 == btampContext->channel )?1:btampContext->channel; - - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,CONNECTING); - /*Action code for transition */ - gotoConnecting(btampContext); - - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from STARTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_HOST_TIMEOUT, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_START_FAILS)) - { - /*Transition from STARTING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "STARTING", "DISCONNECTED"); - - /*Action code for transition */ - gotoDisconnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_MAX_NUM_CNCTS ); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "STARTING", msg); - /* Intentionally left blank */ - } - break; - - case CONNECTING: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_COMPLETED - ) && (btampContext->BAPDeviceRole == BT_RESPONDER)) - { - /*Transition from CONNECTING to AUTHENTICATING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "AUTHENTICATING"); - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "CONNECTED"); - - gotoAuthenticating(btampContext); - /*Action code for transition */ - initRsnSupplicant(btampContext, BT_RESPONDER); -#if 1 - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,AUTHENTICATING); -#else - /*Action code for transition */ - signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS); - gotoConnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,CONNECTED); -#endif - /* register our STA with TL */ - regStaWithTl ( - btampContext, /* btampContext value */ - BT_RESPONDER, - (tCsrRoamInfo *)bapEvent->params); - - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from CONNECTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_NO_CNCT, - //VOS_TRUE, // Should be VOS_FALSE !!! - VOS_FALSE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - // It is NOT clear that we need to send the Phy Link Disconnect - // Complete Event here. - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_INDICATION - //) && (bssDesc indicates an invalid peer MAC Addr or SecParam)){ - ) && !validAssocInd(btampContext, (tCsrRoamInfo *)bapEvent->params)) - { - /*Transition from CONNECTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "DISCONNECTING"); - /*Action code for transition */ - //csrRoamDisconnect(DEAUTH); - //JEZ081120: Danlin points out that I could just ignore this - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_DEAUTH); - //eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_AUTHENT_FAILURE, - VOS_FALSE, - 0); - - /*Set the status code being returned to the btampFsm caller */ - *status = WLANBAP_ERROR_AUTHENT_FAILURE; - - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_INDICATION - //) && (bssDesc indicates a valid MAC Addr and SecParam)){ - ) && validAssocInd(btampContext, (tCsrRoamInfo *)bapEvent->params)) - { - /*Transition from CONNECTING to VALIDATED (both without substates)*/ - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "VALIDATED"); - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "AUTHENTICATING"); - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "CONNECTED"); - - /*Action code for transition */ - // JEZ081027: This one is a pain. Since we are responding in the - // callback itself. This messes up my state machine. - //csrRoamAccept(); - - // No! This is fine. - /*Set the status code being returned to the btampFsm caller */ - *status = WLANBAP_STATUS_SUCCESS; - - /* JEZ081215: N.B.: Currently, I don't get the - * eCSR_ROAM_RESULT_WDS_ASSOCIATED as an AP. - * So, I have to register with TL, here. This - * seems weird. - */ - - /* register our STA with TL */ - regStaWithTl ( - btampContext, /* btampContext value */ - BT_INITIATOR, - (tCsrRoamInfo *)bapEvent->params ); - - gotoAuthenticating(btampContext); - /*Action code for transition */ - initRsnAuthenticator(btampContext, BT_INITIATOR); - -#if 1 - /*Advance outer statevar */ - //btampfsmChangeToState(instanceVar,VALIDATED); - btampfsmChangeToState(instanceVar,AUTHENTICATING); -#else - /*Action code for transition */ - signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS); - gotoConnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,CONNECTED); -#endif - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_FAILED)) - { - /*Transition from CONNECTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "DISCONNECTING"); - - /*Action code for transition */ - sme_RoamDisconnect(hHal, - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - /* Section 3.1.8 and section 3.1.9 have contradictory semantics for 0x16. - * 3.1.8 is "connection terminated by local host". 3.1.9 is "failed connection". - */ - //gotoDisconnecting(FAILED_CONNECTION); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST, //FAILED_CONNECTION - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from CONNECTING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_HOST_TIMEOUT, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "CONNECTING", msg); - /* Intentionally left blank */ - } - break; - - case AUTHENTICATING: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_SUCCESS - ) && (btampContext->BAPDeviceRole == BT_RESPONDER)) - { - /*Transition from AUTHENTICATING to KEYING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "AUTHENTICATING", "KEYING"); - - /*Action code for transition */ - //sme_RoamSetContext(); -#if 0 - sme_RoamSetKey( - VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId, - tSirMacAddr peerBssId, - eCsrEncryptionType encryptType, - tANI_U16 keyLength, - tANI_U8 *pKey, - VOS_TRUE, // TRUE - tANI_U8 paeRole); -#endif //0 - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,KEYING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_SUCCESS - ) && (btampContext->BAPDeviceRole == BT_INITIATOR)) - { - /*Transition from AUTHENTICATING to KEYING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "AUTHENTICATING", "KEYING"); - - /*Action code for transition */ - //sme_RoamSetContext(); -#if 0 - sme_RoamSetKey( - VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId, - tSirMacAddr peerBssId, - eCsrEncryptionType encryptType, - tANI_U16 keyLength, - tANI_U8 *pKey, - VOS_TRUE, // TRUE - tANI_U8 paeRole); -#endif //0 - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,KEYING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s ConnectAcceptTimeout", __func__, "AUTHENTICATING", "DISCONNECTING"); - - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_HOST_TIMEOUT, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - /*Action code for transition */ - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s Physicallink Disconnect", __func__, "AUTHENTICATING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_NO_CNCT, - //VOS_TRUE, // Should be VOS_FALSE !!! - VOS_FALSE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - // It is NOT clear that we need to send the Phy Link Disconnect - // Complete Event here. - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_RSN_FAILURE)) - { - /*Transition from AUTHENTICATING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s RSN Failure", __func__, "AUTHENTICATING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(DEAUTH); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_DEAUTH); - //eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_AUTHENT_FAILURE, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "AUTHENTICATING", msg); - /* Intentionally left blank */ - } - break; - - case CONNECTED: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from CONNECTED to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTED", "DISCONNECTING"); - - gotoDisconnecting( - btampContext, - VOS_FALSE, - 0, - VOS_TRUE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - - WLANBAP_DeInitLinkSupervision(( ptBtampHandle)btampContext); - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION)) - { - - /*Transition from CONNECTED to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "CONNECTED", "DISCONNECTING"); - WLANBAP_DeInitLinkSupervision(( ptBtampHandle)btampContext); - - gotoDisconnecting( - btampContext, - VOS_FALSE, - 0, - VOS_TRUE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Action code for transition */ - sme_RoamDisconnect(hHal, - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "CONNECTED", msg); - /* Intentionally left blank */ - } - break; - -/* JEZ081107: This will only work if I have already signalled the disconnect complete - * event in every case where a physical link complete event is required. And a - * disconnect was requested. - * - - - - * And only if I check for gNeedPhysLinkCompEvent BEFORE I check gDiscRequested. - * Naw! Not necessary. - */ - case DISCONNECTING: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Entered DISCONNECTING:", __func__);//Debug statement - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_READY_FOR_CONNECTIONS - ) && (btampContext->gDiscRequested == VOS_TRUE)) - { - /*Transition from DISCONNECTING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "DISCONNECTING", "DISCONNECTED"); - - //Clear gDiscRequested; - btampContext->gDiscRequested = VOS_FALSE; - - if(btampContext->BAPDeviceRole == BT_INITIATOR) - { - if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&btampContext->bapLock))) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Get LOCK Fail"); - } - authRsnFsmFree(btampContext); - if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&btampContext->bapLock))) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Release LOCK Fail"); - } - } - else if(btampContext->BAPDeviceRole == BT_RESPONDER) - { - suppRsnFsmFree(btampContext); - } - - /* Lookup the StaId using the phy_link_handle and the BAP context */ - vosStatus = WLANBAP_GetStaIdFromLinkCtx ( - btampHandle, /* btampHandle value in */ - btampContext->phy_link_handle, /* phy_link_handle value in */ - &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &pHddHdl); /* Handle to return BSL context */ - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __func__); - return VOS_STATUS_E_FAULT; - } - WLANTL_ClearSTAClient(btampContext->pvosGCtx, ucSTAId); - - // gotoDisconnected(btampContext); - - // VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:In DISCONNECTING-changing outer state var to DISCONNECTED", __func__); - /*Advance outer statevar */ - // btampfsmChangeToState(instanceVar,DISCONNECTED); - - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - btampContext->gDiscReason); - /*sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId);*/ - /*Action code for transition */ - gotoDisconnected(btampContext); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:In DISCONNECTING-changing outer state var to DISCONNECTED", __func__); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_READY_FOR_CONNECTIONS - ) && (btampContext->gNeedPhysLinkCompEvent == VOS_TRUE)) - { - /*Transition from DISCONNECTING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s gNeedPhysLinkComp TRUE", __func__, "DISCONNECTING", "DISCONNECTED"); - if(btampContext->BAPDeviceRole == BT_INITIATOR) - { - if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&btampContext->bapLock))) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Get LOCK Fail"); - } - authRsnFsmFree(btampContext); - if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&btampContext->bapLock))) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"btampFsm, Release LOCK Fail"); - } - - } - else if(btampContext->BAPDeviceRole == BT_RESPONDER) - { - suppRsnFsmFree(btampContext); - } - /* Lookup the StaId using the phy_link_handle and the BAP context */ - vosStatus = WLANBAP_GetStaIdFromLinkCtx ( - btampHandle, /* btampHandle value in */ - btampContext->phy_link_handle, /* phy_link_handle value in */ - &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ - &pHddHdl); /* Handle to return BSL context */ - if ( VOS_STATUS_SUCCESS != vosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __func__); - return VOS_STATUS_E_FAULT; - } - WLANTL_ClearSTAClient(btampContext->pvosGCtx, ucSTAId); - - - /*Action code for transition */ - // signalHCIPhysLinkCompEvent(btampContext, WLANBAP_ERROR_NO_CNCT/*btampContext->gPhysLinkStatus*/); - signalHCIPhysLinkCompEvent(btampContext, btampContext->gPhysLinkStatus); - gotoDisconnected(btampContext); - /*sme_CloseSession(VOS_GET_HAL_CB(btampContext->pvosGCtx), - btampContext->sessionId);*/ - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - // signalHCIPhysLinkCompEvent(btampContext, btampContext->gPhysLinkStatus); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "DISCONNECTING", msg); - /* Intentionally left blank */ - } - break; - - case KEYING: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from KEYING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "KEYING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_HOST_TIMEOUT, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from KEYING to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "KEYING", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_NO_CNCT, - //VOS_TRUE, // Should be VOS_FALSE !!! - VOS_FALSE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - - // It is NOT clear that we need to send the Phy Link Disconnect - // Complete Event here. - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_KEY_SET_SUCCESS)) - { - /*Transition from KEYING to CONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "KEYING", "CONNECTED"); - - /*Action code for transition */ - gotoConnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,CONNECTED); - signalHCIPhysLinkCompEvent(btampContext, WLANBAP_STATUS_SUCCESS); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "KEYING", msg); - /* Intentionally left blank */ - } - break; - - case SCANNING: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_SCAN_COMPLETE)) - { - /*Transition from SCANNING to STARTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "SCANNING", "STARTING"); - - /*Action code for transition */ - vosStatus = determineChan(btampContext, BT_INITIATOR, &channel, status); - // This has to be commented out until I get the BT-AMP SME/CSR changes - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,STARTING); - vosStatus = gotoStarting( btampContext, bapEvent, eCSR_BSS_TYPE_WDS_AP, status); - if (VOS_STATUS_SUCCESS != vosStatus) - { - btampfsmChangeToState(instanceVar, SCANNING); - } - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from SCANNING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "SCANNING", "DISCONNECTED"); - - /*Action code for transition */ - gotoDisconnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_HOST_TIMEOUT); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from SCANNING to DISCONNECTED (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "SCANNING", "DISCONNECTED"); - - /*Action code for transition */ - gotoDisconnected(btampContext); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTED); - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - signalHCIPhysLinkCompEvent( btampContext, WLANBAP_ERROR_NO_CNCT); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "SCANNING", msg); - /* Intentionally left blank */ - } - break; - - case VALIDATED: - if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_MAC_CONNECT_COMPLETED - ) && (btampContext->BAPDeviceRole == BT_INITIATOR)) - { - /*Transition from VALIDATED to AUTHENTICATING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "VALIDATED", "AUTHENTICATING"); - - gotoAuthenticating(btampContext); - /*Action code for transition */ - initRsnAuthenticator(btampContext, BT_INITIATOR); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,AUTHENTICATING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT)) - { - /*Transition from VALIDATED to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "VALIDATED", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_HOST_TIMEOUT, - VOS_FALSE, - 0); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - } - else if((msg==(BTAMPFSM_EVENT_T)eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT)) - { - /*Transition from VALIDATED to DISCONNECTING (both without substates)*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s", __func__, "VALIDATED", "DISCONNECTING"); - - /*Action code for transition */ - //csrRoamDisconnect(); - sme_RoamDisconnect(hHal, - //JEZ081115: Fixme - btampContext->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED); - - gotoDisconnecting( - btampContext, - VOS_TRUE, - WLANBAP_ERROR_NO_CNCT, - //VOS_TRUE, // Should be VOS_FALSE !!! - VOS_FALSE, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - /*Advance outer statevar */ - btampfsmChangeToState(instanceVar,DISCONNECTING); - - // It is NOT clear that we need to send the Phy Link Disconnect - // Complete Event here. - signalHCIPhysLinkDiscEvent - ( btampContext, - WLANBAP_STATUS_SUCCESS, - WLANBAP_ERROR_TERM_BY_LOCAL_HOST); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, in state %s, invalid event msg %d", __func__, "VALIDATED", msg); - /* Intentionally left blank */ - } - break; - - default: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, invalid state %d", __func__, instanceVar->stateVar); - /*Intentionally left blank*/ - break; - } - - return vosStatus; -} - -VOS_STATUS btampEstablishLogLink(ptBtampContext btampContext) -{ - VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; - vos_msg_t msg; - - tAniBtAmpLogLinkReq *pMsg; - - pMsg = vos_mem_malloc(sizeof(tAniBtAmpLogLinkReq)); - if ( NULL == pMsg ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, failed to allocate mem for req", __func__); - return VOS_STATUS_E_NOMEM; - } - - pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_BTAMP_LOG_LINK_IND); - pMsg->msgLen = (tANI_U16)sizeof(tAniBtAmpLogLinkReq); - pMsg->sessionId = btampContext->sessionId; - pMsg->btampHandle = btampContext; - - msg.type = eWNI_SME_BTAMP_LOG_LINK_IND; - msg.bodyptr = pMsg; - msg.reserved = 0; - - if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, failed to post msg to self", __func__); - vos_mem_free(pMsg); - vosStatus = VOS_STATUS_E_FAILURE; - } - return vosStatus; -} - -void btampEstablishLogLinkHdlr(void* pMsg) -{ - tAniBtAmpLogLinkReq *pBtAmpLogLinkReq = (tAniBtAmpLogLinkReq*)pMsg; - ptBtampContext btampContext; - - if(pBtAmpLogLinkReq) - { - btampContext = (ptBtampContext)pBtAmpLogLinkReq->btampHandle; - if(NULL != btampContext) - { - vos_sleep( 200 ); - WLAN_BAPEstablishLogicalLink(btampContext); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, btampContext is NULL", __func__); - return; - } - - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In %s, pBtAmpLogLinkReq is NULL", __func__); - } - return; -} diff --git a/CORE/BAP/src/btampFsm.h b/CORE/BAP/src/btampFsm.h deleted file mode 100644 index e9a92614d02a..000000000000 --- a/CORE/BAP/src/btampFsm.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - - - -/* This file is generated from btampFsm - do not edit manually*/ -/* Generated on: Thu Oct 16 15:40:39 PDT 2008 / version 1.2 Beta 1 */ - - -#ifndef __BTAMPFSM_H__ -#define __BTAMPFSM_H__ - -#include "bapRsn8021xFsm.h" - -/* State definitions */ -typedef enum -{ - AUTHENTICATING, - DISCONNECTED, - CONNECTING, - DISCONNECTING, - SCANNING, - CONNECTED, - S1, - KEYING, - VALIDATED, - STARTING, -} BTAMPFSM_STATES_T; - - -#if 0 -/* Instance data definition of state machine */ -typedef struct -{ - BTAMPFSM_ENTRY_FLAG_T disconnectedEntry; - BTAMPFSM_STATEVAR_T stateVar; - BTAMPFSM_INST_ID_T inst_id; -} BTAMPFSM_INSTANCEDATA_T; -#endif //0 - -/* Helper to initialize the machine's instance data */ -#define BTAMPFSM_INSTANCEDATA_INIT { 1, DISCONNECTED/* set init state */, 0 /* instance id */}; - -/*Prototype for the change state function*/ -void btampfsmChangeToState(BTAMPFSM_INSTANCEDATA_T *instance, BTAMPFSM_STATES_T state); - - - -/*Prototype of the state machine function */ -//int -VOS_STATUS -btampFsm -( - //BTAMPFSM_INSTANCEDATA_T *instanceVar - ptBtampContext btampContext, /* btampContext value */ -// tBtampSessCtx *tpBtampSessCtx, /* btampContext value */ - ptWLAN_BAPEvent bapEvent, /* State machine event */ - v_U8_t *status /* return the BT-AMP status here */ -); - -VOS_STATUS -bapSetKey( v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo ); - -int bapSuppDisconnect(tBtampContext *ctx); -int bapAuthDisconnect(tBtampContext *ctx); -VOS_STATUS btampEstablishLogLink(ptBtampContext btampContext); -#endif diff --git a/CORE/BAP/src/btampFsm_ext.h b/CORE/BAP/src/btampFsm_ext.h deleted file mode 100644 index d45f89311a48..000000000000 --- a/CORE/BAP/src/btampFsm_ext.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -/* This file is generated from btampFsm.cdd - do not edit manually*/ -/* Generated on: Thu Oct 16 15:40:39 PDT 2008 */ - - -#ifndef __BTAMPFSM_EXT_H__ -#define __BTAMPFSM_EXT_H__ - -/* Events that can be sent to the state-machine */ -typedef enum -{ - eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT=0U, - eWLAN_BAP_MAC_CONNECT_COMPLETED -, - eWLAN_BAP_CHANNEL_SELECTION_FAILED, - eWLAN_BAP_MAC_CONNECT_FAILED, - eWLAN_BAP_MAC_CONNECT_INDICATION -, - eWLAN_BAP_MAC_KEY_SET_SUCCESS, - eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT, - eWLAN_BAP_RSN_FAILURE, - eWLAN_BAP_MAC_SCAN_COMPLETE, - eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE, - eWLAN_BAP_MAC_READY_FOR_CONNECTIONS -, - eWLAN_BAP_MAC_START_BSS_SUCCESS -, - eWLAN_BAP_RSN_SUCCESS, - eWLAN_BAP_MAC_START_FAILS, - eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT, - eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION, - eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC -, - NO_MSG -}MESSAGE_T; - - -#endif diff --git a/CORE/BAP/src/btampHCI.c b/CORE/BAP/src/btampHCI.c deleted file mode 100644 index 05d3c14bd56d..000000000000 --- a/CORE/BAP/src/btampHCI.c +++ /dev/null @@ -1,9310 +0,0 @@ -/* - * Copyright (c) 2012-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. - */ - -/** - * \file btampHCI.c - * - * \brief Structures, functions & definitions for - * working with 802.11 Frames - * - * - * - * - * This file was automatically generated by 'framesc' - * Fri Feb 27 17:29:19 2009 from the following file(s): - * - * btampHCI.frms - * - * PLEASE DON'T EDIT THIS FILE BY HAND! - * - * - */ - -#include <memory.h> /* For memcpy */ -#include <stddef.h> /* For offsetof */ - -#define _vsnprintf vsnprintf - -#include "vos_api.h" -#include "btampHCI.h" - -#if defined ( _MSC_VER ) -# pragma warning (disable: 4244) -# pragma warning (disable: 4505) -# pragma warning (disable: 4702) -# pragma warning (disable: 4996) /* ... was declared deprecated */ -#endif /* Microsoft C/C++ */ - -/*Length of the value field expected in a TLV of type Connected Channel in an - AMP Assoc*/ -#define WLAN_BAP_PAL_AMP_ASSOC_CONN_CH_TLV_MIN_LEN 3 - -/*Length of the value field expected in a TLV of type Preferred Channel in an - AMP Assoc*/ -#define WLAN_BAP_PAL_AMP_ASSOC_PREF_CH_TLV_MIN_LEN 3 - -/*Length of the value field expected in a TLV of type MAC Address*/ -#define WLAN_BAP_PAL_MAC_ADDR_TLV_LEN 6 - -/*Length of the value field expected in a TLV of type Capabilities*/ -#define WLAN_BAP_PAL_CAPABILITIES_TLV_LEN 4 - -/*Length of the value field expected in a TLV of type Version*/ -#define WLAN_BAP_PAL_VERSION_TLV_LEN 5 - -/*Length of the value field expected in a TLV of type Accept Phy Link*/ -#define WLAN_BAP_PAL_ACC_PHY_LINK_TLV_MIN_LEN 3 - -/*Length of the value field expected in a TLV of type Accept Log Link*/ -#define WLAN_BAP_PAL_ACC_LOG_LINK_TLV_LEN 37 - -/*Length of the value field expected in a TLV of type Create Log Link*/ -#define WLAN_BAP_PAL_CREATE_LOG_LINK_TLV_LEN 37 - -/*Length of the value field expected in a TLV of type Create Phy Link*/ -#define WLAN_BAP_PAL_CREATE_PHY_LINK_TLV_MIN_LEN 3 - -/*Length of the value field expected in a TLV of type Disconnect Log Link*/ -#define WLAN_BAP_PAL_DISC_LOG_LINK_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Disconnect Phy Link*/ -#define WLAN_BAP_PAL_DISC_PHY_LINK_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Flow Spec Modify*/ -#define WLAN_BAP_PAL_FLOW_SPEC_MOD_TLV_LEN 34 - -/*Length of the value field expected in a TLV of type Flush*/ -#define WLAN_BAP_PAL_FLUSH_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type enhanced Flush*/ -#define WLAN_BAP_PAL_ENHANCED_FLUSH_TLV_LEN 3 - -/*Length of the value field expected in a TLV of type Cancel Log Link*/ -#define WLAN_BAP_PAL_CANCEL_LOG_LINK_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Read Best Effort Flush - Timeout*/ -#define WLAN_BAP_PAL_READ_BE_FLUSH_TIMEOUT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Read Failed Contact - Counter*/ -#define WLAN_BAP_PAL_READ_FAILED_CONTACT_CNT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Link Quality*/ -#define WLAN_BAP_PAL_READ_LINK_QUALITY_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Read Link Supervision - Timeout*/ -#define WLAN_BAP_PAL_READ_LINK_SVISISON_TIMEOUT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Read Local AMP Assoc*/ -#define WLAN_BAP_PAL_READ_LOCAL_AMP_ASSOC_TLV_LEN 5 - -/*Length of the value field expected in a TLV of type Read RSSI*/ -#define WLAN_BAP_PAL_READ_RSSI_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Reset Failed Contact - Counter*/ -#define WLAN_BAP_PAL_RESET_FAILED_CONTACT_CNT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Set Event Mask*/ -#define WLAN_BAP_PAL_SET_EVENT_MASK_TLV_LEN 8 - -/*Length of the value field expected in a TLV of type Set Event Mask2*/ -#define WLAN_BAP_PAL_SET_EVENT_MASK2_TLV_LEN 8 - -/*Length of the value field expected in a TLV of type Set SHort Range Mode*/ -#define WLAN_BAP_PAL_SET_SHORT_RANGE_MODE_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Write Best Effort Flush - Timeout*/ -#define WLAN_BAP_PAL_WRITE_BE_FLUSH_TIMEOUT_TLV_LEN 6 - -/*Length of the value field expected in a TLV of type Write Connection Accept - Timeout*/ -#define WLAN_BAP_PAL_WRITE_CON_ACC_TIMEOUT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Write Flow Control Mode*/ -#define WLAN_BAP_PAL_WRITE_FLOW_CTRL_MODE_TLV_LEN 1 - -/*Length of the value field expected in a TLV of type Write Link Supervision - Timeout*/ -#define WLAN_BAP_PAL_WRITE_LINK_SVISION_TIMEOUT_TLV_LEN 4 - -/*Length of the value field expected in a TLV of type Write Location Data*/ -#define WLAN_BAP_PAL_WRITE_LOCATION_DATA_CMD_TLV_LEN 5 - -/*Length of the value field expected in a TLV of type Write LL Acc Timeout*/ -#define WLAN_BAP_PAL_WRITE_LOG_LINK_ACC_TIMEOUT_TLV_LEN 2 - -/*Length of the value field expected in a TLV of type Write Loopback Mode*/ -#define WLAN_BAP_PAL_WRITE_LOOOPBACK_MODE_TLV_LEN 1 - -/*Length of the value field expected in a TLV of type Write Remote AMP Assoc*/ -#define WLAN_BAP_PAL_WRITE_REMOTE_AMP_ASSOC_MIN_TLV_LEN 5 - -/* As per AMP specification */ -/* Regulatory Extension Identifier for channel list */ -#define WLAN_BAP_PAL_REG_EXTN_ID_VAL 201 - -/* Regulatory Class for channel list */ -#define WLAN_BAP_PAL_REG_CLASS_VAL 254 - -/* Coverage ClASS for channel list */ -#define WLAN_BAP_PAL_COVERAGE_CLASS_VAL 0 - - -/* LOGGING and VALIDITY_CHECKING control */ -//#define WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING -//#define WLAN_BAPHCI_ENABLE_LOGGING - -typedef unsigned char tFRAMES_BOOL; -typedef void (*pfnGeneric_t)(void); - - -typedef struct sFFDefn { - v_U8_t size; - size_t offset; - v_U16_t sig; - pfnGeneric_t pfn; - const char *name; -} tFFDefn; - -typedef struct sIEDefn { - v_U8_t eid; - v_U16_t minSize; - v_U16_t maxSize; - size_t offset; - size_t presenceOffset; - size_t countOffset; - v_U16_t arraybound; - unsigned char oui[5]; - unsigned char noui; - v_U16_t sig; - pfnGeneric_t pfn; - const char *name; - tFRAMES_BOOL fMandatory; -} tIEDefn; - -#if !defined(countof) -#define countof(x) ( sizeof( (x) ) / sizeof( (x)[0] ) ) -#endif - -#if ! defined(BTAMP_MEMCPY) -# define BTAMP_MEMCPY(ctx, dst, src, len) \ - memcpy( (dst), (src), (len) ) \ - -#endif - -#if ! defined(BTAMP_MEMCMP) -# define BTAMP_MEMCMP(ctx, lhs, rhs, len) \ - memcmp( (lhs), (rhs), (len) ) \ - -#endif - -#ifndef BTAMP_HAVE_LOG_SEVERITIES -# define FRLOG_OFF ( 0 ) -# define FRLOGP ( 1 ) -# define FRLOGE ( 2 ) -# define FRLOGW ( 3 ) -# define FRLOG1 ( 4 ) -# define FRLOG2 ( 5 ) -# define FRLOG3 ( 6 ) -# define FRLOG4 ( 7 ) -#endif - -#define FRFL(x) x - -#ifdef BTAMP_ENABLE_LOGGING - -#ifndef BTAMP_HAVE_LOG_MACROS - -#include <stdio.h> -#include <stdarg.h> - -#ifndef BTAMP_LOG_GATE -# define BTAMP_LOG_GATE FRLOGW -#endif // BTAMP_LOG_GATE - -#ifdef WIN32 - -#if defined ( _CONSOLE ) || defined ( _WINDOWS ) || defined ( _DLL ) || defined ( _LIB ) -#include <windows.h> -#define DBGPRINT OutputDebugStringA -#else /* Not User mode */ -#define DBGPRINT DbgPrint -#endif /* User mode */ - - - -static void framesLog(void * pCtx, int nSev, - const char *lpszFormat, ...) -{ - va_list val; - char buffer[1024]; - (void)pCtx; - if ( nSev <= BTAMP_LOG_GATE ) - { - va_start(val, lpszFormat); - _vsnprintf(buffer, 1024, lpszFormat, val); - va_end(val); - DBGPRINT(buffer); - } -} -static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf) -{ - char buffer[35]; - int i, offset; - pCtx; - offset = 0; - if ( nSev > BTAMP_LOG_GATE ) return; - for (i = 0; i < nBuf/8; ++i) - { - _snprintf(buffer, 35, "%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7)); - pBuf += 8; offset += 8; - DBGPRINT(buffer); - } - _snprintf(buffer, 35, "%08x: ", offset); - DBGPRINT(buffer); - for (i = 0; i < nBuf % 8; ++i) - { - _snprintf(buffer, 35, "%02x ", *pBuf); - ++pBuf; - DBGPRINT(buffer); - } - DBGPRINT("\n"); -} - -#elif defined OS_X /* Not WIN32 */ -static void framesLog(void * pCtx, int nSev, - const char *lpszFormat, ...) -{// To fill in when needed using IOLog - -} - -static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf) -{ -} - -#elif defined LINUX - -static void framesLog(void * pCtx, int nSev, - const char *lpszFormat, ...) -{ - va_list marker; - (void)pCtx; - if ( nSev <= BTAMP_LOG_GATE ) - { - va_start( marker, lpszFormat ); - vprintf(lpszFormat, marker); - va_end( marker ); - } -} - -static void framesDump(void * pCtx, int nSev, v_U8_t *pBuf, int nBuf) -{ - char buffer[35]; - int i, offset; - (void)pCtx; - offset = 0; - if ( nSev > BTAMP_LOG_GATE ) return; - for (i = 0; i < nBuf/8; ++i) - { - printf("%08x: %02x %02x %02x %02x %02x %02x %02x %02x\n", offset, *pBuf, *(pBuf + 1), *(pBuf + 2), *(pBuf + 3), *(pBuf + 4), *(pBuf + 5), *(pBuf + 6), *(pBuf + 7)); - pBuf += 8; offset += 8; - } - printf("%08x: ", offset); - for (i = 0; i < nBuf % 8; ++i) - { - printf("%02x ", *pBuf); - ++pBuf; - } - printf("\n"); -} - -#endif /* WIN32 */ - -#define FRAMES_LOG0(ctx, sev, fmt) \ - framesLog((ctx), (sev), (fmt)); -#define FRAMES_LOG1(ctx, sev, fmt, p1) \ - framesLog((ctx), (sev), (fmt), (p1)); -#define FRAMES_LOG2(ctx, sev, fmt, p1, p2) \ - framesLog((ctx), (sev), (fmt), (p1), (p2)); -#define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3) \ - framesLog((ctx), (sev), (fmt), (p1), (p2), (p3)); -#define FRAMES_DUMP(ctx, sev, p, n) \ - framesDump((ctx), (sev), (p), (n)); -#ifndef FRAMES_SEV_FOR_FRAME -# define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3 -#endif - -#endif /* End BTAMP_HAVE_LOG_MACROS */ - -#else // ! BTAMP_ENABLE_LOGGING -# define FRAMES_LOG0(ctx, sev, fmt) -# define FRAMES_LOG1(ctx, sev, fmt, p1) -# define FRAMES_LOG2(ctx, sev, fmt, p1, p2) -# define FRAMES_LOG3(ctx, sev, fmt, p1, p2, p3) -# define FRAMES_DUMP(ctx, sev, p, n) -# ifndef FRAMES_SEV_FOR_FRAME -# define FRAMES_SEV_FOR_FRAME(ctx, sig) FRLOG3 -# endif -#endif // BTAMP_ENABLE_LOGGING - -#if defined( BTAMP_ENABLE_DBG_BREAK ) && defined ( WIN32 ) -# define FRAMES_DBG_BREAK() { _asm int 3 } -#else -# define FRAMES_DBG_BREAK() -#endif - -#if ! defined(BTAMP_PARAMETER_CHECK2) -# if defined (BTAMP_HAVE_WIN32_API) - -# define BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) do { \ - if (!pSrc || IsBadReadPtr(pSrc, 4)) return BTAMP_BAD_INPUT_BUFFER; \ - if (!pBuf || IsBadWritePtr(pBuf, nBuf)) return BTAMP_BAD_OUTPUT_BUFFER; \ - if (!nBuf) return BTAMP_BAD_OUTPUT_BUFFER; \ - if (IsBadWritePtr(pnConsumed, 4)) return BTAMP_BAD_OUTPUT_BUFFER; \ - } while (0) - -# else - -# define BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed) do { \ - if (!pSrc) return BTAMP_BAD_INPUT_BUFFER; \ - if (!pBuf) return BTAMP_BAD_OUTPUT_BUFFER; \ - if (!nBuf) return BTAMP_BAD_OUTPUT_BUFFER; \ - if (!pnConsumed) return BTAMP_BAD_OUTPUT_BUFFER; \ - } while (0) -# endif -#endif - -static void framesntohs(void * pCtx, - v_U16_t *pOut, - v_U8_t *pIn, - tFRAMES_BOOL fMsb) -{ - (void)pCtx; -# if defined ( BTAMP_LITTLE_ENDIAN_HOST ) - if ( !fMsb ) - { - BTAMP_MEMCPY(pCtx, ( v_U16_t* )pOut, pIn, 2); - } - else - { - *pOut = ( v_U16_t )( *pIn << 8 ) | *( pIn + 1 ); - } -# else - if ( !fMsb ) - { - *pOut = ( v_U16_t )( *pIn | ( *( pIn + 1 ) << 8 ) ); - } - else - { - BTAMP_MEMCPY(pCtx, ( v_U16_t* )pOut, pIn, 2); - } -# endif -} - -static void framesntohl(void * pCtx, - v_U32_t *pOut, - v_U8_t *pIn, - tFRAMES_BOOL fMsb) -{ - (void)pCtx; -# if defined ( BTAMP_LITTLE_ENDIAN_HOST ) - if ( !fMsb ) - { - *pOut = * ( v_U32_t* )pIn; - } - else - { - *pOut = ( v_U32_t )( *pIn << 24 ) | - ( *( pIn + 1 ) << 16 ) | - ( *( pIn + 2 ) << 8 ) | - ( *( pIn + 3 ) ); - } -# else - if ( !fMsb ) - { - *pOut = ( v_U32_t )( *( pIn + 3 ) << 24 ) | - ( *( pIn + 2 ) << 16 ) | - ( *( pIn + 1 ) << 8 ) | - ( *( pIn ) ); - } - else - { - *pOut = * ( v_U32_t* )pIn; - } -# endif -} - -static void frameshtons(void * pCtx -, v_U8_t *pOut, - v_U16_t pIn, - tFRAMES_BOOL fMsb) -{ - (void)pCtx; -# if defined ( BTAMP_LITTLE_ENDIAN_HOST ) - if ( !fMsb ) - { - BTAMP_MEMCPY(pCtx, pOut, &pIn, 2); - } - else - { - *pOut = ( pIn & 0xff00 ) >> 8; - *( pOut + 1 ) = pIn & 0xff; - } -# else - if ( !fMsb ) - { - *pOut = pIn & 0xff; - *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8; - } - else - { - BTAMP_MEMCPY(pCtx, pOut, &pIn, 2); - } -# endif -} - -static void frameshtonl(void * pCtx, - v_U8_t *pOut, - v_U32_t pIn, - tFRAMES_BOOL fMsb) -{ - (void)pCtx; -# if defined ( BTAMP_LITTLE_ENDIAN_HOST ) - if ( !fMsb ) - { - BTAMP_MEMCPY(pCtx, pOut, &pIn, 4); - } - else - { - *pOut = ( pIn & 0xff000000 ) >> 24; - *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16; - *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8; - *( pOut + 3 ) = ( pIn & 0x000000ff ); - } -# else - if ( !fMsb ) - { - *( pOut ) = ( pIn & 0x000000ff ); - *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8; - *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16; - *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24; - } - else - { - BTAMP_MEMCPY(pCtx, pOut, &pIn, 4); - } -# endif -} - -typedef struct sTLVDefn { - v_U32_t id; - v_U32_t pec; - v_U32_t minSize; - v_U32_t maxSize; - size_t offset; - size_t presenceOffset; - v_U16_t sig; - pfnGeneric_t pfn; - const char * name; - v_U8_t fMandatory; -} tTLVDefn; - -static tTLVDefn* FindTLVDefn( void * pCtx, - v_U8_t *pBuf, - v_U32_t nBuf, - tTLVDefn TLVs[ ] ) -{ - tTLVDefn *pTlv; - v_U32_t sType, sLen; - v_U32_t pec; - v_U16_t id; - - sType = 1; - sLen = 2; - - (void)pCtx; - - if (sType == 2) - framesntohs( pCtx, &id, pBuf, 2 ); - else { - id = *pBuf; - } - - pTlv = &( TLVs[ 0 ] ); - while ( 0xffff != pTlv->id ) - { - if ( id == pTlv->id ) - { - if ( 0 == pTlv->pec ) return pTlv; - - if( nBuf > 5 ) - { - pec = ( ( * ( pBuf + 4 ) ) << 16 ) | - ( ( * ( pBuf + 5 ) ) << 8 ) | - * ( pBuf + 6 ); - if ( pec == pTlv->pec ) - { - return pTlv; - } - } - } - - ++pTlv; - } - - return NULL; -} - -static v_U32_t UnpackTlvCore( void * pCtx, - v_U8_t *pBuf, - v_U32_t nBuf, - tTLVDefn TLVs[ ], - v_U8_t *pFrm, - size_t nFrm ); -static v_U32_t PackTlvCore(void * pCtx, - v_U8_t *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed, - tTLVDefn TLVs[], - v_U32_t *pidx); -static v_U32_t GetPackedSizeTlvCore(void * pCtx, - v_U8_t *pFrm, - v_U32_t *pnNeeded, - tTLVDefn TLVs[]); - -v_U32_t btampUnpackTlvAMP_Assoc_Connected_Channel(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_Connected_Channel *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_AMP_ASSOC_CONN_CH_TLV_MIN_LEN > tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - - - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->country, pBuf, 3); - pBuf += 3; - tlvlen -= (v_U8_t)3; - if ( ! tlvlen ) - { - pDst->num_triplets = 0U; - return 0U; - } - else - { - /* Maximum of 5 triplets allowed, based on size of triplets definition */ - if (tlvlen / 3 > 5) - { - tlvlen = 15; - } - pDst->num_triplets = (v_U8_t)( tlvlen / 3 ); - - BTAMP_MEMCPY(pCtx, pDst->triplets, pBuf, ( tlvlen ) ); - pBuf += ( tlvlen ); - tlvlen -= ( tlvlen ); - } - (void)pCtx; - return status; -} /* End btampUnpackTlvAMP_Assoc_Connected_Channel. */ - -typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_Connected_Channel_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_Connected_Channel*); - -#define SigUnpackTlvAMP_Assoc_Connected_Channel ( 0x0001 ) - - -v_U32_t btampUnpackTlvAMP_Assoc_MAC_Addr(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_MAC_Addr *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_MAC_ADDR_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->mac_addr, pBuf, 6); - pBuf += 6; - tlvlen -= (v_U8_t)6; - (void)pCtx; - return status; -} /* End btampUnpackTlvAMP_Assoc_MAC_Addr. */ - -typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_MAC_Addr_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_MAC_Addr*); - -#define SigUnpackTlvAMP_Assoc_MAC_Addr ( 0x0002 ) - - -v_U32_t btampUnpackTlvAMP_Assoc_PAL_Capabilities(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_PAL_Capabilities *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_CAPABILITIES_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohl(pCtx, &pDst->pal_capabilities, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - (void)pCtx; - return status; -} /* End btampUnpackTlvAMP_Assoc_PAL_Capabilities. */ - -typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_PAL_Capabilities_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_PAL_Capabilities*); - -#define SigUnpackTlvAMP_Assoc_PAL_Capabilities ( 0x0003 ) - - -v_U32_t btampUnpackTlvAMP_Assoc_PAL_Version(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_PAL_Version *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_VERSION_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->pal_version = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->pal_CompanyID, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->pal_subversion, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvAMP_Assoc_PAL_Version. */ - -typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_PAL_Version_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_PAL_Version*); - -#define SigUnpackTlvAMP_Assoc_PAL_Version ( 0x0004 ) - - -v_U32_t btampUnpackTlvAMP_Assoc_Preferred_Channel_List(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVAMP_Assoc_Preferred_Channel_List *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_AMP_ASSOC_PREF_CH_TLV_MIN_LEN > tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR,"Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - /* Contry String - 3 bytes */ - BTAMP_MEMCPY(pCtx, pDst->country, pBuf, 3); - pBuf += 3; - tlvlen -= (v_U8_t)3; - - if ( ! tlvlen ) - { - pDst->num_triplets = 0U; - return status; - } - else - { - /* Maximum of 5 triplets allowed, based on size of triplets definition */ - if (tlvlen / 3 > 5) - { - tlvlen = 15; - } - pDst->num_triplets = (v_U8_t)( tlvlen / 3 ); - - BTAMP_MEMCPY(pCtx, pDst->triplets, pBuf, ( tlvlen ) ); - pBuf += ( tlvlen ); - tlvlen -= ( tlvlen ); - } - return status; -} /* End btampUnpackTlvAMP_Assoc_Preferred_Channel_List. */ - -typedef v_U32_t (*pfnUnpackTlvAMP_Assoc_Preferred_Channel_List_t)(void *, v_U8_t*, v_U16_t, tBtampTLVAMP_Assoc_Preferred_Channel_List*); - -#define SigUnpackTlvAMP_Assoc_Preferred_Channel_List ( 0x0005 ) - - -v_U32_t btampUnpackTlvFlow_Spec(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVFlow_Spec *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->flow_spec_id = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->service_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->max_sdu, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohl(pCtx, &pDst->sdu_inter_arrival, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->access_latency, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->flush_timeout, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - (void)pCtx; - return status; -} /* End btampUnpackTlvFlow_Spec. */ - -typedef v_U32_t (*pfnUnpackTlvFlow_Spec_t)(void *, v_U8_t*, v_U16_t, tBtampTLVFlow_Spec*); - -#define SigUnpackTlvFlow_Spec ( 0x0006 ) - - -v_U32_t btampUnpackTlvHCI_Accept_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Accept_Logical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ -#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING - if ( WLAN_BAP_PAL_ACC_LOG_LINK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif -// return BTAMP_INVALID_TLV_LENGTH; - } -#endif - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Accept_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Accept_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Accept_Logical_Link_Cmd*); - -#define SigUnpackTlvHCI_Accept_Logical_Link_Cmd ( 0x0007 ) - - -v_U32_t btampUnpackTlvHCI_Accept_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Accept_Physical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_ACC_PHY_LINK_TLV_MIN_LEN > tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->key_length = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->key_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - if (pDst->key_length > 32){ - pDst->present = 0; - return BTAMP_SKIPPED_BAD_IE; - } - - BTAMP_MEMCPY(pCtx, pDst->key_material, pBuf, ( pDst->key_length ) ); - pBuf += ( pDst->key_length ); - tlvlen -= ( pDst->key_length ); - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Accept_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Accept_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Accept_Physical_Link_Cmd*); - -#define SigUnpackTlvHCI_Accept_Physical_Link_Cmd ( 0x0008 ) - - -v_U32_t btampUnpackTlvHCI_Channel_Selected_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Channel_Selected_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Channel_Selected_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Channel_Selected_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Channel_Selected_Event*); - -#define SigUnpackTlvHCI_Channel_Selected_Event ( 0x0009 ) - - -v_U32_t btampUnpackTlvHCI_Command_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Command_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - pDst->present = 1; - pDst->num_hci_command_packets = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->command_opcode, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - switch (pDst->command_opcode) - { - case 0x0c03: - pDst->cc_event.Reset.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c08: - pDst->cc_event.Flush.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Flush.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 0x043b: - pDst->cc_event.Logical_Link_Cancel.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Logical_Link_Cancel.phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Logical_Link_Cancel.tx_flow_spec_id = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c05: - pDst->cc_event.Set_Event_Mask.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c15: - pDst->cc_event.Read_Connection_Accept_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Connection_Accept_TO.connection_accept_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 0x0c16: - pDst->cc_event.Write_Connection_Accept_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c36: - pDst->cc_event.Read_Link_Supervision_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Link_Supervision_TO.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Link_Supervision_TO.link_supervision_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 0x0c37: - pDst->cc_event.Write_Link_Supervision_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Write_Link_Supervision_TO.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 0x0c61: - pDst->cc_event.Read_Logical_Link_Accept_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 0x0c62: - pDst->cc_event.Write_Logical_Link_Accept_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c63: - pDst->cc_event.Set_Event_Mask_Page_2.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 0x0c64: - pDst->cc_event.Read_Location_Data.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Location_Data.loc_domain_aware = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Location_Data.loc_domain, pBuf, 3); - pBuf += 3; - tlvlen -= (v_U8_t)3; - pDst->cc_event.Read_Location_Data.loc_options = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 3173: - pDst->cc_event.Write_Location_Data.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 3174: - pDst->cc_event.Read_Flow_Control_Mode.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Flow_Control_Mode.flow_control_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 3175: - pDst->cc_event.Write_Flow_Control_Mode.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 3177: - pDst->cc_event.Read_BE_Flush_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohl(pCtx, &pDst->cc_event.Read_BE_Flush_TO.best_effort_flush_timeout, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - break; - case 3178: - pDst->cc_event.Write_BE_Flush_TO.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 3179: - pDst->cc_event.Set_Short_Range_Mode.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 4097: - pDst->cc_event.Read_Local_Version_Info.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Local_Version_Info.HC_HCI_Version = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_HCI_Revision, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->cc_event.Read_Local_Version_Info.HC_PAL_Version = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_Manufac_Name, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 4098: - pDst->cc_event.Read_Local_Supported_Cmds.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds, pBuf, 64); - pBuf += 64; - tlvlen -= (v_U8_t)64; - break; - case 4101: - pDst->cc_event.Read_Buffer_Size.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->cc_event.Read_Buffer_Size.HC_SCO_Packet_Length = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 4106: - pDst->cc_event.Read_Data_Block_Size.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Data_Block_Length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 5121: - pDst->cc_event.Read_Failed_Contact_Counter.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Failed_Contact_Counter.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Failed_Contact_Counter.failed_contact_counter, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 5122: - pDst->cc_event.Reset_Failed_Contact_Counter.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Reset_Failed_Contact_Counter.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - break; - case 5123: - pDst->cc_event.Read_Link_Quality.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Link_Quality.log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->cc_event.Read_Link_Quality.link_quality = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 5125: - pDst->cc_event.Read_RSSI.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_RSSI.phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_RSSI.rssi = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 5129: - pDst->cc_event.Read_Local_AMP_Info.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Local_AMP_Info.HC_AMP_Status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Total_BW, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Min_Latency, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - pDst->cc_event.Read_Local_AMP_Info.HC_Controller_Type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - framesntohl(pCtx, &pDst->cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - break; - case 5130: - pDst->cc_event.Read_Read_Local_AMP_Assoc.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - if (pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length > 248){ - // pDst->cc_event.Read_Read_Local_AMP_Assoc.present = 0; - return BTAMP_SKIPPED_BAD_IE; - } - - BTAMP_MEMCPY(pCtx, pDst->cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment, pBuf, ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ) ); - pBuf += ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ); - tlvlen -= ( pDst->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ); - break; - case 5131: - pDst->cc_event.Write_Remote_AMP_Assoc.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Write_Remote_AMP_Assoc.phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 6145: - pDst->cc_event.Read_Loopback_Mode.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->cc_event.Read_Loopback_Mode.loopback_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - case 6146: - pDst->cc_event.Write_Loopback_Mode.status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - break; - } - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Command_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Command_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Command_Complete_Event*); - -#define SigUnpackTlvHCI_Command_Complete_Event ( 0x000a ) - - -v_U32_t btampUnpackTlvHCI_Command_Status_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Command_Status_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->num_hci_command_packets = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->command_opcode, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Command_Status_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Command_Status_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Command_Status_Event*); - -#define SigUnpackTlvHCI_Command_Status_Event ( 0x000b ) - - -v_U32_t btampUnpackTlvHCI_Create_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Create_Logical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ -#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING - if ( WLAN_BAP_PAL_CREATE_LOG_LINK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif -// return BTAMP_INVALID_TLV_LENGTH; - } -#endif - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Create_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Create_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Create_Logical_Link_Cmd*); - -#define SigUnpackTlvHCI_Create_Logical_Link_Cmd ( 0x000c ) - - -v_U32_t btampUnpackTlvHCI_Create_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Create_Physical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_CREATE_PHY_LINK_TLV_MIN_LEN > tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->key_length = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->key_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - if (pDst->key_length > 32){ - pDst->present = 0; - return BTAMP_SKIPPED_BAD_IE; - } - - BTAMP_MEMCPY(pCtx, pDst->key_material, pBuf, ( pDst->key_length ) ); - pBuf += ( pDst->key_length ); - tlvlen -= ( pDst->key_length ); - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Create_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Create_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Create_Physical_Link_Cmd*); - -#define SigUnpackTlvHCI_Create_Physical_Link_Cmd ( 0x000d ) - - -v_U32_t btampUnpackTlvHCI_Data_Buffer_Overflow_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Data_Buffer_Overflow_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->link_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Data_Buffer_Overflow_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Data_Buffer_Overflow_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Data_Buffer_Overflow_Event*); - -#define SigUnpackTlvHCI_Data_Buffer_Overflow_Event ( 0x000e ) - - -v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_DISC_LOG_LINK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*); - -#define SigUnpackTlvHCI_Disconnect_Logical_Link_Cmd ( 0x000f ) - - -v_U32_t btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->reason = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*); - -#define SigUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x0010 ) - - -v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ -#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING - if ( WLAN_BAP_PAL_DISC_PHY_LINK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif -// return BTAMP_INVALID_TLV_LENGTH; - } -#endif - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->reason = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*); - -#define SigUnpackTlvHCI_Disconnect_Physical_Link_Cmd ( 0x0011 ) - - -v_U32_t btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->reason = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*); - -#define SigUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x0012 ) - - -v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flow_Spec_Modify_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_FLOW_SPEC_MOD_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->be_aggr_counter = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->tx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - BTAMP_MEMCPY(pCtx, pDst->rx_flow_spec, pBuf, 18); - pBuf += 18; - tlvlen -= (v_U8_t)18; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Flow_Spec_Modify_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Cmd*); - -#define SigUnpackTlvHCI_Flow_Spec_Modify_Cmd ( 0x0013 ) - - -v_U32_t btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Flow_Spec_Modify_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*); - -#define SigUnpackTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x0014 ) - - -v_U32_t btampUnpackTlvHCI_Flush_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flush_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_FLUSH_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Flush_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Flush_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flush_Cmd*); - -#define SigUnpackTlvHCI_Flush_Cmd ( 0x0015 ) - - -v_U32_t btampUnpackTlvHCI_Flush_Occurred_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Flush_Occurred_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Flush_Occurred_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Flush_Occurred_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Flush_Occurred_Event*); - -#define SigUnpackTlvHCI_Flush_Occurred_Event ( 0x0016 ) - - -v_U32_t btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->bd_addr, pBuf, 6); - pBuf += 6; - tlvlen -= (v_U8_t)6; - BTAMP_MEMCPY(pCtx, pDst->generic_amp_link_key, pBuf, 32); - pBuf += 32; - tlvlen -= (v_U8_t)32; - pDst->key_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*); - -#define SigUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0017 ) - - -v_U32_t btampUnpackTlvHCI_Hardware_Error_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Hardware_Error_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->hardware_code = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Hardware_Error_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Hardware_Error_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Hardware_Error_Event*); - -#define SigUnpackTlvHCI_Hardware_Error_Event ( 0x0018 ) - - -v_U32_t btampUnpackTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Logical_Link_Cancel_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_CANCEL_LOG_LINK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->tx_flow_spec_id = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Logical_Link_Cancel_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Logical_Link_Cancel_Cmd*); - -#define SigUnpackTlvHCI_Logical_Link_Cancel_Cmd ( 0x0019 ) - - -v_U32_t btampUnpackTlvHCI_Logical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Logical_Link_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Logical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Logical_Link_Complete_Event*); - -#define SigUnpackTlvHCI_Logical_Link_Complete_Event ( 0x001a ) - - -v_U32_t btampUnpackTlvHCI_Loopback_Command_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Loopback_Command_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->hci_command_packet, pBuf, 64); - pBuf += 64; - tlvlen -= (v_U8_t)64; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Loopback_Command_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Loopback_Command_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Loopback_Command_Event*); - -#define SigUnpackTlvHCI_Loopback_Command_Event ( 0x001b ) - - -v_U32_t btampUnpackTlvHCI_Physical_Link_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Complete_Event*); - -#define SigUnpackTlvHCI_Physical_Link_Complete_Event ( 0x001c ) - - -v_U32_t btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->reason = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Physical_Link_Loss_Warning_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*); - -#define SigUnpackTlvHCI_Physical_Link_Loss_Warning_Event ( 0x001d ) - - -v_U32_t btampUnpackTlvHCI_Physical_Link_Recovery_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Physical_Link_Recovery_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Physical_Link_Recovery_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Physical_Link_Recovery_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Physical_Link_Recovery_Event*); - -#define SigUnpackTlvHCI_Physical_Link_Recovery_Event ( 0x001e ) - - -v_U32_t btampUnpackTlvHCI_Qos_Violation_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Qos_Violation_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Qos_Violation_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Qos_Violation_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Qos_Violation_Event*); - -#define SigUnpackTlvHCI_Qos_Violation_Event ( 0x001f ) - - -v_U32_t btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_READ_BE_FLUSH_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x0020 ) - - -v_U32_t btampUnpackTlvHCI_Read_Buffer_Size_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Buffer_Size_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Buffer_Size_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Buffer_Size_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Buffer_Size_Cmd*); - -#define SigUnpackTlvHCI_Read_Buffer_Size_Cmd ( 0x0021 ) - - -v_U32_t btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x0022 ) - - -v_U32_t btampUnpackTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Data_Block_Size_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Data_Block_Size_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Data_Block_Size_Cmd*); - -#define SigUnpackTlvHCI_Read_Data_Block_Size_Cmd ( 0x0023 ) - - -v_U32_t btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_READ_FAILED_CONTACT_CNT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*); - -#define SigUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x0024 ) - - -v_U32_t btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*); - -#define SigUnpackTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x0025 ) - - -v_U32_t btampUnpackTlvHCI_Read_Link_Quality_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Link_Quality_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_READ_LINK_QUALITY_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Link_Quality_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Link_Quality_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Link_Quality_Cmd*); - -#define SigUnpackTlvHCI_Read_Link_Quality_Cmd ( 0x0026 ) - - -v_U32_t btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_READ_LINK_SVISISON_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x0027 ) - - -v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s. tlvlen=%d.", __func__, tlvlen); - -#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING - if ( WLAN_BAP_PAL_READ_LOCAL_AMP_ASSOC_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif -// return BTAMP_INVALID_TLV_LENGTH; - } -#endif - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->length_so_far, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->max_remote_amp_assoc_length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*); - -#define SigUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x0028 ) - - -v_U32_t btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*); - -#define SigUnpackTlvHCI_Read_Local_AMP_Information_Cmd ( 0x0029 ) - - -v_U32_t btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*); - -#define SigUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x002a ) - - -v_U32_t btampUnpackTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Local_Version_Info_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Local_Version_Info_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Local_Version_Info_Cmd*); - -#define SigUnpackTlvHCI_Read_Local_Version_Info_Cmd ( 0x002b ) - - -v_U32_t btampUnpackTlvHCI_Read_Location_Data_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Location_Data_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Location_Data_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Location_Data_Cmd*); - -#define SigUnpackTlvHCI_Read_Location_Data_Cmd ( 0x002c ) - - -v_U32_t btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x002d ) - - -v_U32_t btampUnpackTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_Loopback_Mode_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_Loopback_Mode_Cmd*); - -#define SigUnpackTlvHCI_Read_Loopback_Mode_Cmd ( 0x002e ) - - -v_U32_t btampUnpackTlvHCI_Read_RSSI_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Read_RSSI_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_READ_RSSI_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Read_RSSI_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Read_RSSI_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Read_RSSI_Cmd*); - -#define SigUnpackTlvHCI_Read_RSSI_Cmd ( 0x002f ) - - -v_U32_t btampUnpackTlvHCI_Reset_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Reset_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Reset_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Reset_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Reset_Cmd*); - -#define SigUnpackTlvHCI_Reset_Cmd ( 0x0030 ) - - -v_U32_t btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_RESET_FAILED_CONTACT_CNT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*); - -#define SigUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x0031 ) - - -v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Event_Mask_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_SET_EVENT_MASK_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->event_mask, pBuf, 8); - pBuf += 8; - tlvlen -= (v_U8_t)8; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Set_Event_Mask_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Set_Event_Mask_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Event_Mask_Cmd*); - -#define SigUnpackTlvHCI_Set_Event_Mask_Cmd ( 0x0032 ) - - -v_U32_t btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s. tlvlen=%d.", __func__, tlvlen); -#ifdef WLAN_BAPHCI_ENABLE_VALIDITY_CHECKING - if ( WLAN_BAP_PAL_SET_EVENT_MASK2_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif -// return BTAMP_INVALID_TLV_LENGTH; - } -#endif - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - BTAMP_MEMCPY(pCtx, pDst->event_mask_page_2, pBuf, 8); - pBuf += 8; - tlvlen -= (v_U8_t)8; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*); - -#define SigUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x0033 ) - - -v_U32_t btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_SET_SHORT_RANGE_MODE_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->short_range_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*); - -#define SigUnpackTlvHCI_Set_Short_Range_Mode_Cmd ( 0x0034 ) - - -v_U32_t btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - pDst->status = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - pDst->short_range_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*); - -#define SigUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x0035 ) - - -v_U32_t btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_BE_FLUSH_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohl(pCtx, &pDst->best_effort_flush_timeout, pBuf, 0); - pBuf += 4; - tlvlen -= (v_U8_t)4; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x0036 ) - - -v_U32_t btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_CON_ACC_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->connection_accept_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x0037 ) - - -v_U32_t btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_FLOW_CTRL_MODE_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->flow_control_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*); - -#define SigUnpackTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x0038 ) - - -v_U32_t btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_LINK_SVISION_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->link_supervision_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x0039 ) - - -v_U32_t btampUnpackTlvHCI_Write_Location_Data_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Location_Data_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_LOCATION_DATA_CMD_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->loc_domain_aware = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - BTAMP_MEMCPY(pCtx, pDst->loc_domain, pBuf, 3); - pBuf += 3; - tlvlen -= (v_U8_t)3; - pDst->loc_options = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Location_Data_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Location_Data_Cmd*); - -#define SigUnpackTlvHCI_Write_Location_Data_Cmd ( 0x003a ) - - -v_U32_t btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_LOG_LINK_ACC_TIMEOUT_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->logical_link_accept_timeout, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*); - -#define SigUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x003b ) - - -v_U32_t btampUnpackTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Loopback_Mode_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_LOOOPBACK_MODE_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->loopback_mode = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Loopback_Mode_Cmd*); - -#define SigUnpackTlvHCI_Write_Loopback_Mode_Cmd ( 0x003c ) - - -v_U32_t btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_WRITE_REMOTE_AMP_ASSOC_MIN_TLV_LEN > tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - pDst->phy_link_handle = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - framesntohs(pCtx, &pDst->length_so_far, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - framesntohs(pCtx, &pDst->amp_assoc_remaining_length, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - if (pDst->amp_assoc_remaining_length > 248){ - pDst->present = 0; - return BTAMP_SKIPPED_BAD_IE; - } - - BTAMP_MEMCPY(pCtx, pDst->amp_assoc_fragment, pBuf, ( pDst->amp_assoc_remaining_length ) ); - pBuf += ( pDst->amp_assoc_remaining_length ); - tlvlen -= ( pDst->amp_assoc_remaining_length ); - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*); - -#define SigUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x003d ) - -v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Cmd(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Enhanced_Flush_Cmd *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - - /*----------------------------------------------------------------------- - TLV Sanity check - -------------------------------------------------------------------------*/ - if ( WLAN_BAP_PAL_ENHANCED_FLUSH_TLV_LEN != tlvlen ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - /*Log invalid len*/ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid TLV len on %s", __func__); -#endif - return BTAMP_INVALID_TLV_LENGTH; - } - - /*----------------------------------------------------------------------- - Parse TLV - -----------------------------------------------------------------------*/ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - pDst->packet_type = *pBuf; - pBuf += 1; - tlvlen -= (v_U8_t)1; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Enhanced_Flush_Cmd. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Enhanced_Flush_Cmd_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Enhanced_Flush_Cmd*); - -#define SigUnpackTlvHCI_Enhanced_Flush_Cmd ( 0x003e ) - - -v_U32_t btampUnpackTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx, v_U8_t *pBuf, v_U16_t tlvlen, tBtampTLVHCI_Enhanced_Flush_Complete_Event *pDst) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pBuf; (void)tlvlen; /* Shutup the compiler */ - pDst->present = 1; - framesntohs(pCtx, &pDst->log_link_handle, pBuf, 0); - pBuf += 2; - tlvlen -= (v_U8_t)2; - (void)pCtx; - return status; -} /* End btampUnpackTlvHCI_Enhanced_Flush_Completed_Event. */ - -typedef v_U32_t (*pfnUnpackTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, v_U8_t*, v_U16_t, tBtampTLVHCI_Enhanced_Flush_Complete_Event*); - -#define SigUnpackTlvHCI_Enhanced_Flush_Complete_Event ( 0x003f ) - - -v_U32_t btampUnpackAMP_ASSOC(void * pCtx, v_U8_t *pBuf, v_U32_t nBuf, tBtampAMP_ASSOC *pFrm) -{ - v_U32_t i; - static tTLVDefn TLVS[ ] = { - {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigUnpackTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, }, - {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 0xFF/*12*/, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigUnpackTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, }, - {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 0xFF/*12*/, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigUnpackTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7, 7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigUnpackTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigUnpackTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampUnpackTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, }, - { 0xffff, 0 }, - }; - - v_U32_t status = 0; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampUnpackAMP_ASSOC. nBuf - %d\n", nBuf); -#endif - - status |= UnpackTlvCore(pCtx,pBuf,nBuf,TLVS,(v_U8_t*)pFrm,sizeof(*pFrm)); - - (void)i; -# ifdef BTAMP_DUMP_FRAMES - if (!BTAMP_FAILED(status)) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Unpacked the AMP_ASSOC:\n")); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), pBuf, nBuf); - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("to:\n")); - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_MAC_Addr:\n")); - if (!pFrm->AMP_Assoc_MAC_Addr.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_MAC_Addr.mac_addr, 6); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Preferred_Channel_List:\n")); - if (!pFrm->AMP_Assoc_Preferred_Channel_List.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Preferred_Channel_List.country, 3); - FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Preferred_Channel_List.triplets, 3 * pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Connected_Channel:\n")); - if (!pFrm->AMP_Assoc_Connected_Channel.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Connected_Channel.country, 3); - FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Connected_Channel.num_triplets); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Connected_Channel.triplets, 3 * pFrm->AMP_Assoc_Connected_Channel.num_triplets); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Capabilities:\n")); - if (!pFrm->AMP_Assoc_PAL_Capabilities.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Capabilities.pal_capabilities, 4); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Version:\n")); - if (!pFrm->AMP_Assoc_PAL_Version.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_version, 1); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_CompanyID, 2); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_subversion, 2); - } - } -# endif // BTAMP_DUMP_FRAMES - return status; - -} /* End btampUnpackAMP_ASSOC. */ - -static v_U32_t UnpackTlvCore( void * pCtx, - v_U8_t *pBuf, - v_U32_t nBuf, - tTLVDefn TLVs[ ], - v_U8_t *pFrm, - size_t nFrm ) -{ - tTLVDefn *pTlv; - v_U32_t nBufRemaining, status, status2, npec; - v_U32_t sType, sLen; - v_U16_t id, len; - v_U8_t *pBufRemaining, *pfFound; - - (void)pCtx; // Shutup the compiler - (void)nFrm; - status = BTAMP_PARSE_SUCCESS; - status2 = BTAMP_PARSE_SUCCESS; - pBufRemaining = pBuf; - nBufRemaining = nBuf; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In UnpackTlvCore, nBufRemaining - %d\n", nBufRemaining); -#endif - - // While we have data... - while ( nBufRemaining ) - { - if ( 3 > nBufRemaining ) - { - FRAMES_LOG0( pCtx, FRLOGE, FRFL( "This frame reports " - "fewer three byte(s) remaining.\n" ) ); - status |= BTAMP_INCOMPLETE_TLV; - FRAMES_DBG_BREAK(); - goto MandatoryCheck; - } - - npec = 0U; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "Calling FindTLVDefn...\n", nBufRemaining); -#endif - - // Look for a matching TLV definition, - pTlv = FindTLVDefn( pCtx, pBufRemaining, nBufRemaining, TLVs ); - sType = 1; - sLen = 2; - // consume the type, - if (sType == 2) - framesntohs(pCtx, &id, pBufRemaining, 1); - else { - id = *pBufRemaining; - } - pBufRemaining += sType; - nBufRemaining -= sType; - // & length, - framesntohs(pCtx, &len, pBufRemaining, 1); - pBufRemaining += sLen; - nBufRemaining -= sLen; - - if ( pTlv && pTlv->pec ) - { - npec = 3U; - if ( 3 > nBufRemaining ) - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "3 > nBufRemaining\n"); -#endif - - FRAMES_LOG2(pCtx, FRLOGW, FRFL("TLV %d reports length" - "%d, but it has a Private Enterprise Code (3 byte" - "s.\n"), id, len); - FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf); - FRAMES_LOG2(pCtx, FRLOG1, FRFL("We've parsed %d bytes" - "of this buffer, and show %d left.\n"), - pBufRemaining - pBuf, nBufRemaining); - status |= BTAMP_INCOMPLETE_TLV; - FRAMES_DBG_BREAK(); - goto MandatoryCheck; - } - pBufRemaining += 3; - nBufRemaining -= 3; - len -= 3; - } -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "Len - %d nBufRemaining - %d\n", len, nBufRemaining); -#endif - - // Whether we found a hit or not, we can validate the reported - // length of this TLV: - if ( len > nBufRemaining ) - { - FRAMES_LOG3(pCtx, FRLOGW, FRFL("TLV %d reports length %" - "d, but there are only %d bytes remaining in this f" - "rame.\n"), id, len, nBufRemaining ); - FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf ); - FRAMES_LOG2( pCtx, FRLOG1, FRFL( "We've parsed %d bytes" - " of this buffer, and show %d left.\n"), - pBufRemaining - pBuf, nBufRemaining); - status |= BTAMP_INCOMPLETE_TLV; - FRAMES_DBG_BREAK(); - goto MandatoryCheck; - } - - // Now, *if* we found a hit... - if ( pTlv ) - { - if ( nBufRemaining < pTlv->minSize - npec - (sType + sLen)) - { - FRAMES_LOG3( pCtx, FRLOGW, FRFL("The IE %s must be " - "at least %d bytes in size, but there are only " - "%d bytes remaining in this frame.\n"), - pTlv->name, pTlv->minSize, nBufRemaining ); - FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf ); - status |= BTAMP_INCOMPLETE_TLV; - FRAMES_DBG_BREAK( ); - goto MandatoryCheck; - } - else if ( len > pTlv->maxSize - npec - (sType + sLen)) - { - FRAMES_LOG1( pCtx, FRLOGW, FRFL("The TLV %s reports " - "an illegally large size; this TLV is presumably" - "corrupt or otherwise invalid & will be skipped " - "ipped.\n"), pTlv->name ); - FRAMES_DUMP( pCtx, FRLOG1, pBuf, nBuf ); - FRAMES_LOG2( pCtx, FRLOG1, FRFL("We've parsed %d by" - "tes of this buffer, and show %d left.\n"), - pBufRemaining - pBuf, nBufRemaining); - FRAMES_DBG_BREAK(); - status |= BTAMP_SKIPPED_BAD_TLV; - } - else - { -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "pTlv->sig - %d\n", pTlv->sig); -#endif - - switch (pTlv->sig) - { - case SigUnpackTlvAMP_Assoc_Connected_Channel: - status2 = ( (pfnUnpackTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvAMP_Assoc_MAC_Addr: - status2 = ( (pfnUnpackTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvAMP_Assoc_PAL_Capabilities: - status2 = ( (pfnUnpackTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvAMP_Assoc_PAL_Version: - status2 = ( (pfnUnpackTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_PAL_Version* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvAMP_Assoc_Preferred_Channel_List: - status2 = ( (pfnUnpackTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvFlow_Spec: - status2 = ( (pfnUnpackTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVFlow_Spec* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Accept_Logical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Accept_Physical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Channel_Selected_Event: - status2 = ( (pfnUnpackTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Channel_Selected_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Command_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Command_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Command_Status_Event: - status2 = ( (pfnUnpackTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Command_Status_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Create_Logical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Create_Physical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Data_Buffer_Overflow_Event: - status2 = ( (pfnUnpackTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Disconnect_Logical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Disconnect_Physical_Link_Cmd: - status2 = ( (pfnUnpackTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Flow_Spec_Modify_Cmd: - status2 = ( (pfnUnpackTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Flow_Spec_Modify_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Flush_Cmd: - status2 = ( (pfnUnpackTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flush_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Flush_Occurred_Event: - status2 = ( (pfnUnpackTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Flush_Occurred_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event: - status2 = ( (pfnUnpackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Hardware_Error_Event: - status2 = ( (pfnUnpackTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Hardware_Error_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Logical_Link_Cancel_Cmd: - status2 = ( (pfnUnpackTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Logical_Link_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Loopback_Command_Event: - status2 = ( (pfnUnpackTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Loopback_Command_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Physical_Link_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Physical_Link_Loss_Warning_Event: - status2 = ( (pfnUnpackTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Physical_Link_Recovery_Event: - status2 = ( (pfnUnpackTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Qos_Violation_Event: - status2 = ( (pfnUnpackTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Qos_Violation_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Buffer_Size_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Data_Block_Size_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Flow_Control_Mode_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Link_Quality_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Local_AMP_Information_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Local_Version_Info_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Location_Data_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_Loopback_Mode_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Read_RSSI_Cmd: - status2 = ( (pfnUnpackTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Reset_Cmd: - status2 = ( (pfnUnpackTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Reset_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd: - status2 = ( (pfnUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Set_Event_Mask_Cmd: - status2 = ( (pfnUnpackTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd: - status2 = ( (pfnUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Set_Short_Range_Mode_Cmd: - status2 = ( (pfnUnpackTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event: - status2 = ( (pfnUnpackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Flow_Control_Mode_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Location_Data_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Loopback_Mode_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pFrm + pTlv->offset )); - break; - case SigUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd: - status2 = ( (pfnUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, pBufRemaining, len, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pFrm + pTlv->offset )); - break; - default: - FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR: I" - " don't know about the TLV signature %d-- thi" - "s is most likely a 'framesc' bug.\n"), - pTlv->sig); - FRAMES_DBG_BREAK(); - return BTAMP_INTERNAL_ERROR; - } // End switch on sig. - } // End if on length check. - - status |= status2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "status - %x\n", status); -#endif - } - else - { - FRAMES_LOG2(pCtx, FRLOG3, FRFL("Skipping unknown TLV %d (" - "length %d)\n"), id, len); - FRAMES_DUMP(pCtx, FRLOG3, pBufRemaining - (sType + sLen), len); - status |= BTAMP_UNKNOWN_TLVS; - } - - // Advance to the next TLV - pBufRemaining += len; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "len - %d nBufRemaining - %d\n", len, nBufRemaining); -#endif - - if (len > nBufRemaining) - { - FRAMES_LOG0(pCtx, FRLOGW, FRFL("This TLV extends past th" - "e buffer as it was defined to us. This could mean " - "a corrupt frame, or just an incorrect length parame" - "ter.\n")); - FRAMES_DBG_BREAK(); - status |= BTAMP_LAST_TLV_TOO_LONG; - goto MandatoryCheck; - } - - nBufRemaining -= len; - - } // End iteration over TLVs. - -MandatoryCheck: - pTlv = &TLVs[0]; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "pTlv->id - %x\n", pTlv->id); -#endif - - while (0xffff != pTlv->id) - { - if (pTlv->fMandatory) - { - pfFound = (v_U8_t*)(pFrm + pTlv->offset + - pTlv->presenceOffset); - if (!*pfFound) - { - FRAMES_LOG1(pCtx, FRLOGW, FRFL("ERROR: The mandatory " - "TLV %s wasn't seen.\n"), - pTlv->name); - FRAMES_DBG_BREAK(); - status |= BTAMP_MANDATORY_TLV_MISSING; - } - - } - ++pTlv; - } - - return status; -} /* End UnpacTlvkCore. */ -v_U32_t btampGetPackedTlvAMP_Assoc_Connected_Channel(void * pCtx, tBtampTLVAMP_Assoc_Connected_Channel *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedTlvAMP_Assoc_Connected_Channel\n"); -#endif - - while ( pTlv->present ) - { - *pnNeeded += 3; - if ( pTlv->num_triplets ) - { - *pnNeeded += ( pTlv->num_triplets * 3 ); - } - else break; - break; - } - return status; -} /* End btampGetPackedTLVAMP_Assoc_Connected_Channel. */ - -typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_Connected_Channel_t)(void *, tBtampTLVAMP_Assoc_Connected_Channel*, v_U32_t*); -#define SigPackSizeTlvAMP_Assoc_Connected_Channel ( 0x003e ) - -v_U32_t btampGetPackedTlvAMP_Assoc_MAC_Addr(void * pCtx, tBtampTLVAMP_Assoc_MAC_Addr *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedTlvAMP_Assoc_MAC_Addr\n"); -#endif - - while ( pTlv->present ) - { - *pnNeeded += 6; - break; - } - return status; -} /* End btampGetPackedTLVAMP_Assoc_MAC_Addr. */ - -typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_MAC_Addr_t)(void *, tBtampTLVAMP_Assoc_MAC_Addr*, v_U32_t*); -#define SigPackSizeTlvAMP_Assoc_MAC_Addr ( 0x003f ) - -v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Capabilities(void * pCtx, tBtampTLVAMP_Assoc_PAL_Capabilities *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedTlvAMP_Assoc_PAL_Capabilities\n"); -#endif - - while ( pTlv->present ) - { - *pnNeeded += 4; - break; - } - return status; -} /* End btampGetPackedTLVAMP_Assoc_PAL_Capabilities. */ - -typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_PAL_Capabilities_t)(void *, tBtampTLVAMP_Assoc_PAL_Capabilities*, v_U32_t*); -#define SigPackSizeTlvAMP_Assoc_PAL_Capabilities ( 0x0040 ) - -v_U32_t btampGetPackedTlvAMP_Assoc_PAL_Version(void * pCtx, tBtampTLVAMP_Assoc_PAL_Version *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVAMP_Assoc_PAL_Version. */ - -typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_PAL_Version_t)(void *, tBtampTLVAMP_Assoc_PAL_Version*, v_U32_t*); -#define SigPackSizeTlvAMP_Assoc_PAL_Version ( 0x0041 ) - -v_U32_t btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(void * pCtx, tBtampTLVAMP_Assoc_Preferred_Channel_List *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedTlvAMP_Assoc_Preferred_Channel_List\n"); -#endif - - while ( pTlv->present ) - { - *pnNeeded += 3; - if ( pTlv->num_triplets ) - { - *pnNeeded += ( pTlv->num_triplets * 3 ); - } - else break; - break; - } - return status; -} /* End btampGetPackedTLVAMP_Assoc_Preferred_Channel_List. */ - -typedef v_U32_t (*pfnPackSizeTlvAMP_Assoc_Preferred_Channel_List_t)(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List*, v_U32_t*); -#define SigPackSizeTlvAMP_Assoc_Preferred_Channel_List ( 0x0042 ) - -v_U32_t btampGetPackedTlvFlow_Spec(void * pCtx, tBtampTLVFlow_Spec *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 4; - *pnNeeded += 4; - *pnNeeded += 4; - break; - } - return status; -} /* End btampGetPackedTLVFlow_Spec. */ - -typedef v_U32_t (*pfnPackSizeTlvFlow_Spec_t)(void *, tBtampTLVFlow_Spec*, v_U32_t*); -#define SigPackSizeTlvFlow_Spec ( 0x0043 ) - -v_U32_t btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Accept_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 18; - *pnNeeded += 18; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Accept_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Accept_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Accept_Logical_Link_Cmd ( 0x0044 ) - -v_U32_t btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Accept_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += pTlv->key_length; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Accept_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Accept_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Accept_Physical_Link_Cmd ( 0x0045 ) - -v_U32_t btampGetPackedTlvHCI_Channel_Selected_Event(void * pCtx, tBtampTLVHCI_Channel_Selected_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Channel_Selected_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Channel_Selected_Event_t)(void *, tBtampTLVHCI_Channel_Selected_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Channel_Selected_Event ( 0x0046 ) - -v_U32_t btampGetPackedTlvHCI_Command_Complete_Event(void * pCtx, tBtampTLVHCI_Command_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - switch (pTlv->command_opcode) - { - case 3075: - *pnNeeded += 1; - break; - case 3080: - *pnNeeded += 1; - *pnNeeded += 2; - break; - case 1083: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - break; - case 3077: - *pnNeeded += 1; - break; - case 3093: - *pnNeeded += 1; - *pnNeeded += 2; - break; - case 3094: - *pnNeeded += 1; - break; - case 3126: - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - case 3127: - *pnNeeded += 1; - *pnNeeded += 2; - break; - case 3169: - *pnNeeded += 1; - *pnNeeded += 2; - break; - case 3170: - *pnNeeded += 1; - break; - case 3171: - *pnNeeded += 1; - break; - case 3172: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 3; - *pnNeeded += 1; - break; - case 3173: - *pnNeeded += 1; - break; - case 3174: - *pnNeeded += 1; - *pnNeeded += 1; - break; - case 3175: - *pnNeeded += 1; - break; - case 3177: - *pnNeeded += 1; - *pnNeeded += 4; - break; - case 3178: - *pnNeeded += 1; - break; - case 3179: - *pnNeeded += 1; - break; - case 4097: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - case 4098: - *pnNeeded += 1; - *pnNeeded += 64; - break; - case 4101: - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - case 4106: - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; - break; - case 5121: - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - case 5122: - *pnNeeded += 1; - *pnNeeded += 2; - break; - case 5123: - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 1; - break; - case 5125: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - break; - case 5129: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 4; - *pnNeeded += 4; - *pnNeeded += 4; - *pnNeeded += 4; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 4; - *pnNeeded += 4; - break; - case 5130: - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += pTlv->cc_event.Read_Read_Local_AMP_Assoc.remaining_length; - break; - case 5131: - *pnNeeded += 1; - *pnNeeded += 1; - break; - case 6145: - *pnNeeded += 1; - *pnNeeded += 1; - break; - case 6146: - *pnNeeded += 1; - break; - } - break; - } - return status; -} /* End btampGetPackedTLVHCI_Command_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Command_Complete_Event_t)(void *, tBtampTLVHCI_Command_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Command_Complete_Event ( 0x0047 ) - -v_U32_t btampGetPackedTlvHCI_Command_Status_Event(void * pCtx, tBtampTLVHCI_Command_Status_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Command_Status_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Command_Status_Event_t)(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Command_Status_Event ( 0x0048 ) - -v_U32_t btampGetPackedTlvHCI_Create_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Create_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 18; - *pnNeeded += 18; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Create_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Create_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Logical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Create_Logical_Link_Cmd ( 0x0049 ) - -v_U32_t btampGetPackedTlvHCI_Create_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Create_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += pTlv->key_length; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Create_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Create_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Physical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Create_Physical_Link_Cmd ( 0x004a ) - -v_U32_t btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(void * pCtx, tBtampTLVHCI_Data_Buffer_Overflow_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Data_Buffer_Overflow_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Data_Buffer_Overflow_Event_t)(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Data_Buffer_Overflow_Event ( 0x004b ) - -v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Disconnect_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Disconnect_Logical_Link_Cmd ( 0x004c ) - -v_U32_t btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Disconnect_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x004d ) - -v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Disconnect_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Disconnect_Physical_Link_Cmd ( 0x004e ) - -v_U32_t btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Disconnect_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x004f ) - -v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx, tBtampTLVHCI_Flow_Spec_Modify_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - *pnNeeded += 1; - *pnNeeded += 18; - *pnNeeded += 18; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Flow_Spec_Modify_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Flow_Spec_Modify_Cmd ( 0x0050 ) - -v_U32_t btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Flow_Spec_Modify_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x0051 ) - -v_U32_t btampGetPackedTlvHCI_Flush_Cmd(void * pCtx, tBtampTLVHCI_Flush_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Flush_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Flush_Cmd_t)(void *, tBtampTLVHCI_Flush_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Flush_Cmd ( 0x0052 ) - -v_U32_t btampGetPackedTlvHCI_Flush_Occurred_Event(void * pCtx, tBtampTLVHCI_Flush_Occurred_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Flush_Occurred_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Flush_Occurred_Event_t)(void *, tBtampTLVHCI_Flush_Occurred_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Flush_Occurred_Event ( 0x0053 ) - -v_U32_t btampGetPackedTlvHCI_Num_Completed_Pkts_Event(void * pCtx, tBtampTLVHCI_Num_Completed_Pkts_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -// while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; -#if 0 -// New - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; -// End of New -#endif -// break; - } - return status; -} /* End btampGetPackedTLVHCI_Num_Completed_Pkts_Event. */ - -v_U32_t btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(void * pCtx, tBtampTLVHCI_Num_Completed_Data_Blocks_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -// while ( pTlv->present ) - { - *pnNeeded += 2; - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += 2; -// break; - } - return status; -} /* End btampGetPackedTLVHCI_Num_Completed_Data_Blocks_Event. */ - -//typedef v_U32_t (*pfnPackSizeTlvHCI_Num_Completed_Pkts_Event_t)(void *, tBtampTLVHCI_Command_Status_Event*, v_U32_t*); -//#define SigPackSizeTlvHCI_Num_Completed_Pkts_Event ( 0x0048 ) - -v_U32_t btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 6; - *pnNeeded += 32; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Generic_AMP_Link_Key_Notification_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0054 ) - -v_U32_t btampGetPackedTlvHCI_Hardware_Error_Event(void * pCtx, tBtampTLVHCI_Hardware_Error_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Hardware_Error_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Hardware_Error_Event_t)(void *, tBtampTLVHCI_Hardware_Error_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Hardware_Error_Event ( 0x0055 ) - -v_U32_t btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx, tBtampTLVHCI_Logical_Link_Cancel_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Logical_Link_Cancel_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Logical_Link_Cancel_Cmd ( 0x0056 ) - -v_U32_t btampGetPackedTlvHCI_Logical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Logical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Logical_Link_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Logical_Link_Complete_Event ( 0x0057 ) - -v_U32_t btampGetPackedTlvHCI_Loopback_Command_Event(void * pCtx, tBtampTLVHCI_Loopback_Command_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 64; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Loopback_Command_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Loopback_Command_Event_t)(void *, tBtampTLVHCI_Loopback_Command_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Loopback_Command_Event ( 0x0058 ) - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Complete_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Physical_Link_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Physical_Link_Complete_Event ( 0x0059 ) - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Physical_Link_Loss_Warning_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Physical_Link_Loss_Warning_Event ( 0x005a ) - -v_U32_t btampGetPackedTlvHCI_Physical_Link_Recovery_Event(void * pCtx, tBtampTLVHCI_Physical_Link_Recovery_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Physical_Link_Recovery_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Physical_Link_Recovery_Event_t)(void *, tBtampTLVHCI_Physical_Link_Recovery_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Physical_Link_Recovery_Event ( 0x005b ) - -v_U32_t btampGetPackedTlvHCI_Qos_Violation_Event(void * pCtx, tBtampTLVHCI_Qos_Violation_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Qos_Violation_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Qos_Violation_Event_t)(void *, tBtampTLVHCI_Qos_Violation_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Qos_Violation_Event ( 0x005c ) - -v_U32_t btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x005d ) - -v_U32_t btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(void * pCtx, tBtampTLVHCI_Read_Buffer_Size_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Buffer_Size_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Buffer_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Buffer_Size_Cmd ( 0x005e ) - -v_U32_t btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x005f ) - -v_U32_t btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx, tBtampTLVHCI_Read_Data_Block_Size_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Data_Block_Size_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Data_Block_Size_Cmd ( 0x0060 ) - -v_U32_t btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x0061 ) - -v_U32_t btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x0062 ) - -v_U32_t btampGetPackedTlvHCI_Read_Link_Quality_Cmd(void * pCtx, tBtampTLVHCI_Read_Link_Quality_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Link_Quality_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Link_Quality_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Quality_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Link_Quality_Cmd ( 0x0063 ) - -v_U32_t btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x0064 ) - -v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Local_AMP_Assoc_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x0065 ) - -v_U32_t btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Local_AMP_Information_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Local_AMP_Information_Cmd ( 0x0066 ) - -v_U32_t btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Local_Supported_Cmds_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x0067 ) - -v_U32_t btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx, tBtampTLVHCI_Read_Local_Version_Info_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Local_Version_Info_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Local_Version_Info_Cmd ( 0x0068 ) - -v_U32_t btampGetPackedTlvHCI_Read_Location_Data_Cmd(void * pCtx, tBtampTLVHCI_Read_Location_Data_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Read_Location_Data_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Location_Data_Cmd ( 0x0069 ) - -v_U32_t btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x006a ) - -v_U32_t btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx, tBtampTLVHCI_Read_Loopback_Mode_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_Loopback_Mode_Cmd ( 0x006b ) - -v_U32_t btampGetPackedTlvHCI_Read_RSSI_Cmd(void * pCtx, tBtampTLVHCI_Read_RSSI_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Read_RSSI_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Read_RSSI_Cmd_t)(void *, tBtampTLVHCI_Read_RSSI_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Read_RSSI_Cmd ( 0x006c ) - -v_U32_t btampGetPackedTlvHCI_Reset_Cmd(void * pCtx, tBtampTLVHCI_Reset_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - break; - } - return status; -} /* End btampGetPackedTLVHCI_Reset_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Reset_Cmd_t)(void *, tBtampTLVHCI_Reset_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Reset_Cmd ( 0x006d ) - -v_U32_t btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Reset_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x006e ) - -v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Cmd(void * pCtx, tBtampTLVHCI_Set_Event_Mask_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 8; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Set_Event_Mask_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Event_Mask_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Set_Event_Mask_Cmd ( 0x006f ) - -v_U32_t btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 8; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Set_Event_Mask_Page_2_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x0070 ) - -v_U32_t btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Set_Short_Range_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Set_Short_Range_Mode_Cmd ( 0x0071 ) - -v_U32_t btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 1; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Short_Range_Mode_Change_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x0072 ) - -v_U32_t btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - *pnNeeded += 4; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x0073 ) - -v_U32_t btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x0074 ) - -v_U32_t btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x0075 ) - -v_U32_t btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x0076 ) - -v_U32_t btampGetPackedTlvHCI_Write_Location_Data_Cmd(void * pCtx, tBtampTLVHCI_Write_Location_Data_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 3; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Write_Location_Data_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Location_Data_Cmd ( 0x0077 ) - -v_U32_t btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x0078 ) - -v_U32_t btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx, tBtampTLVHCI_Write_Loopback_Mode_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Loopback_Mode_Cmd ( 0x0079 ) - -v_U32_t btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd\n"); -#endif - - while ( pTlv->present ) - { - *pnNeeded += 1; - *pnNeeded += 2; - *pnNeeded += 2; - *pnNeeded += pTlv->amp_assoc_remaining_length; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Write_Remote_AMP_ASSOC_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x007a ) - -v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Cmd(void * pCtx, tBtampTLVHCI_Enhanced_Flush_Cmd *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - *pnNeeded += 1; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Enhanced_Flush_Cmd. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Enhanced_Flush_Cmd_t)(void *, tBtampTLVHCI_Enhanced_Flush_Cmd*, v_U32_t*); -#define SigPackSizeTlvHCI_Enhanced_Flush_Cmd ( 0x007b ) - -v_U32_t btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx, tBtampTLVHCI_Enhanced_Flush_Complete_Event *pTlv, v_U32_t *pnNeeded) -{ - v_U32_t status = BTAMP_PARSE_SUCCESS; - (void)pCtx; (void)pTlv; (void)pnNeeded; - while ( pTlv->present ) - { - *pnNeeded += 2; - break; - } - return status; -} /* End btampGetPackedTLVHCI_Enhanced_Flush_Complete_Event. */ - -typedef v_U32_t (*pfnPackSizeTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event*, v_U32_t*); -#define SigPackSizeTlvHCI_Enhanced_Flush_Complete_Event ( 0x007c ) - -v_U32_t btampGetPackedAMP_ASSOCSize(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U32_t *pnNeeded) -{ - static tTLVDefn TLVS[ ] = { - {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigPackSizeTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, }, - {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigPackSizeTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, }, - {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigPackSizeTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7, 7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigPackSizeTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigPackSizeTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampGetPackedTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, }, - { 0xffff, 0 }, - }; - - v_U32_t status = 0; - *pnNeeded = 0; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampGetPackedAMP_ASSOCSize\n"); -#endif - - status |= GetPackedSizeTlvCore(pCtx,(v_U8_t*)pFrm,pnNeeded,TLVS); - return status; -} /* End btampGetPackedAMP_ASSOCSize. */ - -static v_U32_t GetPackedSizeTlvCore(void * pCtx, - v_U8_t *pFrm, - v_U32_t *pnNeeded, - tTLVDefn TLVs[]) -{ - tTLVDefn *pTlv; - v_U32_t status, status2; - tFRAMES_BOOL *pfFound; - - status = BTAMP_PARSE_SUCCESS; - status2 = BTAMP_PARSE_SUCCESS; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In GetPackedSizeTlvCore\n"); -#endif - - pTlv = &( TLVs[0] ); - while ( 0xffff != pTlv->id ) - { - pfFound = (tFRAMES_BOOL*)(pFrm + pTlv->offset + - pTlv->presenceOffset); - if ( *pfFound ) - { - *pnNeeded += 4U; - if ( pTlv->pec ) *pnNeeded += 3U; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In GetPackedSizeTlvCore, pTlv->sig - %d\n", pTlv->sig); -#endif - - switch (pTlv->sig) - { - case SigPackSizeTlvAMP_Assoc_Connected_Channel: - status2 = ( (pfnPackSizeTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvAMP_Assoc_MAC_Addr: - status2 = ( (pfnPackSizeTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvAMP_Assoc_PAL_Capabilities: - status2 = ( (pfnPackSizeTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvAMP_Assoc_PAL_Version: - status2 = ( (pfnPackSizeTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Version* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvAMP_Assoc_Preferred_Channel_List: - status2 = ( (pfnPackSizeTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvFlow_Spec: - status2 = ( (pfnPackSizeTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, ( tBtampTLVFlow_Spec* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Accept_Logical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Accept_Physical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Channel_Selected_Event: - status2 = ( (pfnPackSizeTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Channel_Selected_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Command_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Command_Status_Event: - status2 = ( (pfnPackSizeTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Status_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Create_Logical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Create_Physical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Data_Buffer_Overflow_Event: - status2 = ( (pfnPackSizeTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Disconnect_Logical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Disconnect_Physical_Link_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Flow_Spec_Modify_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Flush_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Flush_Occurred_Event: - status2 = ( (pfnPackSizeTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Occurred_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event: - status2 = ( (pfnPackSizeTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Hardware_Error_Event: - status2 = ( (pfnPackSizeTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Hardware_Error_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Logical_Link_Cancel_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Logical_Link_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Loopback_Command_Event: - status2 = ( (pfnPackSizeTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Loopback_Command_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Physical_Link_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Physical_Link_Loss_Warning_Event: - status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Physical_Link_Recovery_Event: - status2 = ( (pfnPackSizeTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Qos_Violation_Event: - status2 = ( (pfnPackSizeTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Qos_Violation_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Buffer_Size_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Data_Block_Size_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Link_Quality_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Local_AMP_Information_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Local_Version_Info_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Location_Data_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_Loopback_Mode_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Read_RSSI_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Reset_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Set_Event_Mask_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Set_Short_Range_Mode_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event: - status2 = ( (pfnPackSizeTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Location_Data_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Loopback_Mode_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - case SigPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd: - status2 = ( (pfnPackSizeTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pFrm + pTlv->offset), pnNeeded); - if (status2) status |= status2; - break; - default: - FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don" - "'t know about the TLV signature %d; this is most l" - "ikely a bug in 'framesc'.\n"), pTlv->sig); - return BTAMP_INTERNAL_ERROR; - } - } - ++pTlv; - } - return status; -} -v_U32_t btampPackTlvAMP_Assoc_Connected_Channel(void * pCtx, - tBtampTLVAMP_Assoc_Connected_Channel *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampPackTlvAMP_Assoc_Connected_Channel\n"); -#endif - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvAMP_Assoc_Connected_Channel(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3, 0); - else *pBuf = 3; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->country, 3); - *pnConsumed += 3; - pBuf += 3; - nBuf -= 3; - if ( pSrc->num_triplets ) { - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->triplets ), ( pSrc->num_triplets * 3 )); - *pnConsumed += ( pSrc->num_triplets * 3 ); - pBuf += ( ( pSrc->num_triplets * 3 ) ); - nBuf -= ( ( pSrc->num_triplets * 3 ) ); - } - else break; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } - else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvAMP_Assoc_Connected_Channel. */ - -typedef v_U32_t (*pfnPackTlvAMP_Assoc_Connected_Channel_t)(void *, tBtampTLVAMP_Assoc_Connected_Channel *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvAMP_Assoc_Connected_Channel ( 0x007b ) - -v_U32_t btampPackTlvAMP_Assoc_MAC_Addr(void * pCtx, - tBtampTLVAMP_Assoc_MAC_Addr *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampPackTlvAMP_Assoc_MAC_Addr\n"); -#endif - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvAMP_Assoc_MAC_Addr(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1, 0); - else *pBuf = 1; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->mac_addr, 6); - *pnConsumed += 6; - pBuf += 6; - nBuf -= 6; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvAMP_Assoc_MAC_Addr. */ - -typedef v_U32_t (*pfnPackTlvAMP_Assoc_MAC_Addr_t)(void *, tBtampTLVAMP_Assoc_MAC_Addr *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvAMP_Assoc_MAC_Addr ( 0x007c ) - -v_U32_t btampPackTlvAMP_Assoc_PAL_Capabilities(void * pCtx, - tBtampTLVAMP_Assoc_PAL_Capabilities *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampPackTlvAMP_Assoc_PAL_Capabilities\n"); -#endif - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvAMP_Assoc_PAL_Capabilities(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 4, 0); - else *pBuf = 4; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtonl(pCtx, pBuf, pSrc->pal_capabilities, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvAMP_Assoc_PAL_Capabilities. */ - -typedef v_U32_t (*pfnPackTlvAMP_Assoc_PAL_Capabilities_t)(void *, tBtampTLVAMP_Assoc_PAL_Capabilities *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvAMP_Assoc_PAL_Capabilities ( 0x007d ) - -v_U32_t btampPackTlvAMP_Assoc_PAL_Version(void * pCtx, - tBtampTLVAMP_Assoc_PAL_Version *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampPackTlvAMP_Assoc_PAL_Version\n"); -#endif - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvAMP_Assoc_PAL_Version(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5, 0); - else *pBuf = 5; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->pal_version; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->pal_CompanyID, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->pal_subversion, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvAMP_Assoc_PAL_Version. */ - -typedef v_U32_t (*pfnPackTlvAMP_Assoc_PAL_Version_t)(void *, tBtampTLVAMP_Assoc_PAL_Version *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvAMP_Assoc_PAL_Version ( 0x007e ) - -v_U32_t btampPackTlvAMP_Assoc_Preferred_Channel_List(void * pCtx, - tBtampTLVAMP_Assoc_Preferred_Channel_List *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 2; -#ifdef WLAN_BAPHCI_ENABLE_LOGGING - VOS_TRACE(VOS_MODULE_ID_BAP,VOS_TRACE_LEVEL_ERROR, - "In btampPackTlvAMP_Assoc_Preferred_Channel_List\n"); -#endif - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvAMP_Assoc_Preferred_Channel_List(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 2, 0); - else *pBuf = 2; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->country, 3); - *pnConsumed += 3; - pBuf += 3; - nBuf -= 3; - if ( pSrc->num_triplets ) { - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->triplets ), ( pSrc->num_triplets * 3 )); - *pnConsumed += ( pSrc->num_triplets * 3 ); - pBuf += ( ( pSrc->num_triplets * 3 ) ); - nBuf -= ( ( pSrc->num_triplets * 3 ) ); - } - else break; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvAMP_Assoc_Preferred_Channel_List. */ - -typedef v_U32_t (*pfnPackTlvAMP_Assoc_Preferred_Channel_List_t)(void *, tBtampTLVAMP_Assoc_Preferred_Channel_List *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvAMP_Assoc_Preferred_Channel_List ( 0x007f ) - -v_U32_t btampPackTlvFlow_Spec(void * pCtx, - tBtampTLVFlow_Spec *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvFlow_Spec(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 6, 0); - else *pBuf = 6; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->flow_spec_id; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->service_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->max_sdu, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtonl(pCtx, pBuf, pSrc->sdu_inter_arrival, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->access_latency, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->flush_timeout, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvFlow_Spec. */ - -typedef v_U32_t (*pfnPackTlvFlow_Spec_t)(void *, tBtampTLVFlow_Spec *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvFlow_Spec ( 0x0080 ) - -v_U32_t btampPackTlvHCI_Accept_Logical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Accept_Logical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Accept_Logical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1081, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Accept_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Accept_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Accept_Logical_Link_Cmd ( 0x0081 ) - -v_U32_t btampPackTlvHCI_Accept_Physical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Accept_Physical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Accept_Physical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1078, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->key_length; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->key_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->key_material ), pSrc->key_length); - *pnConsumed += pSrc->key_length; - pBuf += ( pSrc->key_length ); - nBuf -= ( pSrc->key_length ); - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Accept_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Accept_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Accept_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Accept_Physical_Link_Cmd ( 0x0082 ) - -v_U32_t btampPackTlvHCI_Channel_Selected_Event(void * pCtx, - tBtampTLVHCI_Channel_Selected_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Channel_Selected_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 65, 0); - else *pBuf = 65; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Channel_Selected_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Channel_Selected_Event_t)(void *, tBtampTLVHCI_Channel_Selected_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Channel_Selected_Event ( 0x0083 ) - -v_U32_t btampPackTlvHCI_Command_Complete_Event(void * pCtx, - tBtampTLVHCI_Command_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Command_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 14, 0); - else *pBuf = 14; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->num_hci_command_packets; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->command_opcode, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - switch (pSrc->command_opcode) - { - case 3075: - *pBuf = pSrc->cc_event.Reset.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3080: - *pBuf = pSrc->cc_event.Flush.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Flush.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 1083: - *pBuf = pSrc->cc_event.Logical_Link_Cancel.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Logical_Link_Cancel.phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Logical_Link_Cancel.tx_flow_spec_id; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3077: - *pBuf = pSrc->cc_event.Set_Event_Mask.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3093: - *pBuf = pSrc->cc_event.Read_Connection_Accept_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Connection_Accept_TO.connection_accept_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 3094: - *pBuf = pSrc->cc_event.Write_Connection_Accept_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3126: - *pBuf = pSrc->cc_event.Read_Link_Supervision_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Supervision_TO.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Supervision_TO.link_supervision_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 3127: - *pBuf = pSrc->cc_event.Write_Link_Supervision_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Write_Link_Supervision_TO.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 3169: - *pBuf = pSrc->cc_event.Read_Logical_Link_Accept_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Logical_Link_Accept_TO.logical_link_accept_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 3170: - *pBuf = pSrc->cc_event.Write_Logical_Link_Accept_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3171: - *pBuf = pSrc->cc_event.Set_Event_Mask_Page_2.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3172: - *pBuf = pSrc->cc_event.Read_Location_Data.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Location_Data.loc_domain_aware; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->cc_event.Read_Location_Data.loc_domain, 3); - *pnConsumed += 3; - pBuf += 3; - nBuf -= 3; - *pBuf = pSrc->cc_event.Read_Location_Data.loc_options; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3173: - *pBuf = pSrc->cc_event.Write_Location_Data.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3174: - *pBuf = pSrc->cc_event.Read_Flow_Control_Mode.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Flow_Control_Mode.flow_control_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3175: - *pBuf = pSrc->cc_event.Write_Flow_Control_Mode.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3177: - *pBuf = pSrc->cc_event.Read_BE_Flush_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_BE_Flush_TO.best_effort_flush_timeout, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - break; - case 3178: - *pBuf = pSrc->cc_event.Write_BE_Flush_TO.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 3179: - *pBuf = pSrc->cc_event.Set_Short_Range_Mode.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 4097: - *pBuf = pSrc->cc_event.Read_Local_Version_Info.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Local_Version_Info.HC_HCI_Version; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_HCI_Revision, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->cc_event.Read_Local_Version_Info.HC_PAL_Version; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_Manufac_Name, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 4098: - *pBuf = pSrc->cc_event.Read_Local_Supported_Cmds.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds, 64); - *pnConsumed += 64; - pBuf += 64; - nBuf -= 64; - break; - case 4101: - *pBuf = pSrc->cc_event.Read_Buffer_Size.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->cc_event.Read_Buffer_Size.HC_SCO_Packet_Length; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 4106: - *pBuf = pSrc->cc_event.Read_Data_Block_Size.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Data_Block_Length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 5121: - *pBuf = pSrc->cc_event.Read_Failed_Contact_Counter.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Failed_Contact_Counter.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Failed_Contact_Counter.failed_contact_counter, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 5122: - *pBuf = pSrc->cc_event.Reset_Failed_Contact_Counter.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Reset_Failed_Contact_Counter.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - case 5123: - *pBuf = pSrc->cc_event.Read_Link_Quality.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Link_Quality.log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->cc_event.Read_Link_Quality.link_quality; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 5125: - *pBuf = pSrc->cc_event.Read_RSSI.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_RSSI.phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_RSSI.rssi; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 5129: - *pBuf = pSrc->cc_event.Read_Local_AMP_Info.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Local_AMP_Info.HC_AMP_Status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Total_BW, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Min_Latency, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - *pBuf = pSrc->cc_event.Read_Local_AMP_Info.HC_Controller_Type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - frameshtonl(pCtx, pBuf, pSrc->cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - break; - case 5130: - *pBuf = pSrc->cc_event.Read_Read_Local_AMP_Assoc.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment ), pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length); - *pnConsumed += pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length; - pBuf += ( pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ); - nBuf -= ( pSrc->cc_event.Read_Read_Local_AMP_Assoc.remaining_length ); - break; - case 5131: - *pBuf = pSrc->cc_event.Write_Remote_AMP_Assoc.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Write_Remote_AMP_Assoc.phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 6145: - *pBuf = pSrc->cc_event.Read_Loopback_Mode.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->cc_event.Read_Loopback_Mode.loopback_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - case 6146: - *pBuf = pSrc->cc_event.Write_Loopback_Mode.status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Command_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Command_Complete_Event_t)(void *, tBtampTLVHCI_Command_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Command_Complete_Event ( 0x0084 ) - -v_U32_t btampPackTlvHCI_Command_Status_Event(void * pCtx, - tBtampTLVHCI_Command_Status_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Command_Status_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 15, 0); - else *pBuf = 15; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->num_hci_command_packets; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->command_opcode, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Command_Status_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Command_Status_Event_t)(void *, tBtampTLVHCI_Command_Status_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Command_Status_Event ( 0x0085 ) - -v_U32_t btampPackTlvHCI_Create_Logical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Create_Logical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - - nConsumedOnEntry = *pnConsumed; - status = btampGetPackedTlvHCI_Create_Logical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1080, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Create_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Create_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Create_Logical_Link_Cmd ( 0x0086 ) - -v_U32_t btampPackTlvHCI_Create_Physical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Create_Physical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Create_Physical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1077, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->key_length; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->key_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->key_material ), pSrc->key_length); - *pnConsumed += pSrc->key_length; - pBuf += ( pSrc->key_length ); - nBuf -= ( pSrc->key_length ); - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Create_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Create_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Create_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Create_Physical_Link_Cmd ( 0x0087 ) - -v_U32_t btampPackTlvHCI_Data_Buffer_Overflow_Event(void * pCtx, - tBtampTLVHCI_Data_Buffer_Overflow_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Data_Buffer_Overflow_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 26, 0); - else *pBuf = 26; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->link_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Data_Buffer_Overflow_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Data_Buffer_Overflow_Event_t)(void *, tBtampTLVHCI_Data_Buffer_Overflow_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Data_Buffer_Overflow_Event ( 0x0088 ) - -v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Disconnect_Logical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1082, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Disconnect_Logical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Logical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Disconnect_Logical_Link_Cmd ( 0x0089 ) - -v_U32_t btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event(void * pCtx, - tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Disconnect_Logical_Link_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 70, 0); - else *pBuf = 70; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->reason; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Disconnect_Logical_Link_Complete_Event ( 0x008a ) - -v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Cmd(void * pCtx, - tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Disconnect_Physical_Link_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1079, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->reason; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Disconnect_Physical_Link_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Physical_Link_Cmd_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Disconnect_Physical_Link_Cmd ( 0x008b ) - -v_U32_t btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event(void * pCtx, - tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Disconnect_Physical_Link_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 66, 0); - else *pBuf = 66; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->reason; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Disconnect_Physical_Link_Complete_Event ( 0x008c ) - -v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Cmd(void * pCtx, - tBtampTLVHCI_Flow_Spec_Modify_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Flow_Spec_Modify_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1084, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->be_aggr_counter; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->tx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->rx_flow_spec, 18); - *pnConsumed += 18; - pBuf += 18; - nBuf -= 18; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Flow_Spec_Modify_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Flow_Spec_Modify_Cmd_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Flow_Spec_Modify_Cmd ( 0x008d ) - -v_U32_t btampPackTlvHCI_Flow_Spec_Modify_Complete_Event(void * pCtx, - tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Flow_Spec_Modify_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 71, 0); - else *pBuf = 71; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Flow_Spec_Modify_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(void *, tBtampTLVHCI_Flow_Spec_Modify_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Flow_Spec_Modify_Complete_Event ( 0x008e ) - -v_U32_t btampPackTlvHCI_Flush_Cmd(void * pCtx, - tBtampTLVHCI_Flush_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Flush_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3080, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Flush_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Flush_Cmd_t)(void *, tBtampTLVHCI_Flush_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Flush_Cmd ( 0x008f ) - -v_U32_t btampPackTlvHCI_Flush_Occurred_Event(void * pCtx, - tBtampTLVHCI_Flush_Occurred_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Flush_Occurred_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 17, 0); - else *pBuf = 17; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Flush_Occurred_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Flush_Occurred_Event_t)(void *, tBtampTLVHCI_Flush_Occurred_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Flush_Occurred_Event ( 0x0090 ) - -v_U32_t btampPackTlvHCI_Num_Completed_Pkts_Event(void * pCtx, - tBtampTLVHCI_Num_Completed_Pkts_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Num_Completed_Pkts_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; -// while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 19, 0); - else *pBuf = 19; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->num_handles; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->conn_handles[0], 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->num_completed_pkts[0], 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; -#if 0 - // New - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; -// End of new -#endif -// break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Num_Completed_Pkts_Event. */ - -v_U32_t btampPackTlvHCI_Num_Completed_Data_Blocks_Event(void * pCtx, - tBtampTLVHCI_Num_Completed_Data_Blocks_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Num_Completed_Data_Blocks_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; -// while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 72, 0); - else *pBuf = 72; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->total_num_data_blocks, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->num_handles; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->conn_handles[0], 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->num_completed_pkts[0], 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->num_completed_blocks[0], 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; -#if 0 - // New - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, 0, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; -// End of new -#endif -// break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Num_Completed_Data_Blocks_Event. */ - -//typedef v_U32_t (*pfnPackTlvHCI_Num_Completed_Pkts_Event_t)(void *, tBtampTLVHCI_Num_Completed_Pkts_Event *, v_U8_t*, v_U32_t, v_U32_t*); -//#define SigPackTlvHCI_Num_Completed_Pkts_Event ( 0x0085 ) - -v_U32_t btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event(void * pCtx, - tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Generic_AMP_Link_Key_Notification_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 62, 0); - else *pBuf = 62; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->bd_addr, 6); - *pnConsumed += 6; - pBuf += 6; - nBuf -= 6; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->generic_amp_link_key, 32); - *pnConsumed += 32; - pBuf += 32; - nBuf -= 32; - *pBuf = pSrc->key_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(void *, tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Generic_AMP_Link_Key_Notification_Event ( 0x0091 ) - -v_U32_t btampPackTlvHCI_Hardware_Error_Event(void * pCtx, - tBtampTLVHCI_Hardware_Error_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Hardware_Error_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 16, 0); - else *pBuf = 16; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->hardware_code; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Hardware_Error_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Hardware_Error_Event_t)(void *, tBtampTLVHCI_Hardware_Error_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Hardware_Error_Event ( 0x0092 ) - -v_U32_t btampPackTlvHCI_Logical_Link_Cancel_Cmd(void * pCtx, - tBtampTLVHCI_Logical_Link_Cancel_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Logical_Link_Cancel_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 1083, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->tx_flow_spec_id; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Logical_Link_Cancel_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Logical_Link_Cancel_Cmd_t)(void *, tBtampTLVHCI_Logical_Link_Cancel_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Logical_Link_Cancel_Cmd ( 0x0093 ) - -v_U32_t btampPackTlvHCI_Logical_Link_Complete_Event(void * pCtx, - tBtampTLVHCI_Logical_Link_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Logical_Link_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 69, 0); - else *pBuf = 69; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->flow_spec_id; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Logical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Logical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Logical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Logical_Link_Complete_Event ( 0x0094 ) - -v_U32_t btampPackTlvHCI_Loopback_Command_Event(void * pCtx, - tBtampTLVHCI_Loopback_Command_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Loopback_Command_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 25, 0); - else *pBuf = 25; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->hci_command_packet, 64); - *pnConsumed += 64; - pBuf += 64; - nBuf -= 64; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Loopback_Command_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Loopback_Command_Event_t)(void *, tBtampTLVHCI_Loopback_Command_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Loopback_Command_Event ( 0x0095 ) - -v_U32_t btampPackTlvHCI_Physical_Link_Complete_Event(void * pCtx, - tBtampTLVHCI_Physical_Link_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Physical_Link_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 64, 0); - else *pBuf = 64; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Physical_Link_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Complete_Event_t)(void *, tBtampTLVHCI_Physical_Link_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Physical_Link_Complete_Event ( 0x0096 ) - -v_U32_t btampPackTlvHCI_Physical_Link_Loss_Warning_Event(void * pCtx, - tBtampTLVHCI_Physical_Link_Loss_Warning_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Physical_Link_Loss_Warning_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 67, 0); - else *pBuf = 67; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->reason; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Physical_Link_Loss_Warning_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Loss_Warning_Event_t)(void *, tBtampTLVHCI_Physical_Link_Loss_Warning_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Physical_Link_Loss_Warning_Event ( 0x0097 ) - -v_U32_t btampPackTlvHCI_Physical_Link_Recovery_Event(void * pCtx, - tBtampTLVHCI_Physical_Link_Recovery_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Physical_Link_Recovery_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 68, 0); - else *pBuf = 68; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Physical_Link_Recovery_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Physical_Link_Recovery_Event_t)(void *, tBtampTLVHCI_Physical_Link_Recovery_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Physical_Link_Recovery_Event ( 0x0098 ) - -v_U32_t btampPackTlvHCI_Qos_Violation_Event(void * pCtx, - tBtampTLVHCI_Qos_Violation_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Qos_Violation_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 30, 0); - else *pBuf = 30; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Qos_Violation_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Qos_Violation_Event_t)(void *, tBtampTLVHCI_Qos_Violation_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Qos_Violation_Event ( 0x0099 ) - -v_U32_t btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3177, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd ( 0x009a ) - -v_U32_t btampPackTlvHCI_Read_Buffer_Size_Cmd(void * pCtx, - tBtampTLVHCI_Read_Buffer_Size_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Buffer_Size_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 4101, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Buffer_Size_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Buffer_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Buffer_Size_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Buffer_Size_Cmd ( 0x009b ) - -v_U32_t btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Connection_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3093, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Connection_Accept_Timeout_Cmd ( 0x009c ) - -v_U32_t btampPackTlvHCI_Read_Data_Block_Size_Cmd(void * pCtx, - tBtampTLVHCI_Read_Data_Block_Size_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Data_Block_Size_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 4106, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Data_Block_Size_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Data_Block_Size_Cmd_t)(void *, tBtampTLVHCI_Read_Data_Block_Size_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Data_Block_Size_Cmd ( 0x009d ) - -v_U32_t btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd(void * pCtx, - tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Failed_Contact_Counter_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5121, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Failed_Contact_Counter_Cmd ( 0x009e ) - -v_U32_t btampPackTlvHCI_Read_Flow_Control_Mode_Cmd(void * pCtx, - tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Flow_Control_Mode_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3174, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Flow_Control_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Flow_Control_Mode_Cmd ( 0x009f ) - -v_U32_t btampPackTlvHCI_Read_Link_Quality_Cmd(void * pCtx, - tBtampTLVHCI_Read_Link_Quality_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Link_Quality_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5123, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Link_Quality_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Link_Quality_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Quality_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Link_Quality_Cmd ( 0x00a0 ) - -v_U32_t btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Link_Supervision_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3126, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Link_Supervision_Timeout_Cmd ( 0x00a1 ) - -v_U32_t btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd(void * pCtx, - tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Local_AMP_Assoc_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5130, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->length_so_far, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->max_remote_amp_assoc_length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Local_AMP_Assoc_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Local_AMP_Assoc_Cmd ( 0x00a2 ) - -v_U32_t btampPackTlvHCI_Read_Local_AMP_Information_Cmd(void * pCtx, - tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Local_AMP_Information_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5129, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Local_AMP_Information_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Local_AMP_Information_Cmd_t)(void *, tBtampTLVHCI_Read_Local_AMP_Information_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Local_AMP_Information_Cmd ( 0x00a3 ) - -v_U32_t btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd(void * pCtx, - tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Local_Supported_Cmds_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 4098, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Local_Supported_Cmds_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Local_Supported_Cmds_Cmd ( 0x00a4 ) - -v_U32_t btampPackTlvHCI_Read_Local_Version_Info_Cmd(void * pCtx, - tBtampTLVHCI_Read_Local_Version_Info_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Local_Version_Info_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 4097, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Local_Version_Info_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Local_Version_Info_Cmd_t)(void *, tBtampTLVHCI_Read_Local_Version_Info_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Local_Version_Info_Cmd ( 0x00a5 ) - -v_U32_t btampPackTlvHCI_Read_Location_Data_Cmd(void * pCtx, - tBtampTLVHCI_Read_Location_Data_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Location_Data_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3172, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Read_Location_Data_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Location_Data_Cmd ( 0x00a6 ) - -v_U32_t btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3169, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd ( 0x00a7 ) - -v_U32_t btampPackTlvHCI_Read_Loopback_Mode_Cmd(void * pCtx, - tBtampTLVHCI_Read_Loopback_Mode_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_Loopback_Mode_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 6145, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Read_Loopback_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_Loopback_Mode_Cmd ( 0x00a8 ) - -v_U32_t btampPackTlvHCI_Read_RSSI_Cmd(void * pCtx, - tBtampTLVHCI_Read_RSSI_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Read_RSSI_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5125, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Read_RSSI_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Read_RSSI_Cmd_t)(void *, tBtampTLVHCI_Read_RSSI_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Read_RSSI_Cmd ( 0x00a9 ) - -v_U32_t btampPackTlvHCI_Reset_Cmd(void * pCtx, - tBtampTLVHCI_Reset_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Reset_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3075, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Reset_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Reset_Cmd_t)(void *, tBtampTLVHCI_Reset_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Reset_Cmd ( 0x00aa ) - -v_U32_t btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd(void * pCtx, - tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Reset_Failed_Contact_Counter_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5122, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Reset_Failed_Contact_Counter_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(void *, tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Reset_Failed_Contact_Counter_Cmd ( 0x00ab ) - -v_U32_t btampPackTlvHCI_Set_Event_Mask_Cmd(void * pCtx, - tBtampTLVHCI_Set_Event_Mask_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Set_Event_Mask_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3077, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->event_mask, 8); - *pnConsumed += 8; - pBuf += 8; - nBuf -= 8; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Set_Event_Mask_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Set_Event_Mask_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Set_Event_Mask_Cmd ( 0x00ac ) - -v_U32_t btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd(void * pCtx, - tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Set_Event_Mask_Page_2_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3171, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->event_mask_page_2, 8); - *pnConsumed += 8; - pBuf += 8; - nBuf -= 8; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Set_Event_Mask_Page_2_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(void *, tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Set_Event_Mask_Page_2_Cmd ( 0x00ad ) - -v_U32_t btampPackTlvHCI_Set_Short_Range_Mode_Cmd(void * pCtx, - tBtampTLVHCI_Set_Short_Range_Mode_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Set_Short_Range_Mode_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3179, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->short_range_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Set_Short_Range_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Set_Short_Range_Mode_Cmd_t)(void *, tBtampTLVHCI_Set_Short_Range_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Set_Short_Range_Mode_Cmd ( 0x00ae ) - -v_U32_t btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event(void * pCtx, - tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Short_Range_Mode_Change_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 76, 0); - else *pBuf = 76; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->status; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - *pBuf = pSrc->short_range_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(void *, tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Short_Range_Mode_Change_Complete_Event ( 0x00af ) - -v_U32_t btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3178, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtonl(pCtx, pBuf, pSrc->best_effort_flush_timeout, 0); - *pnConsumed += 4; - pBuf += 4; - nBuf -= 4; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd ( 0x00b0 ) - -v_U32_t btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Connection_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3094, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->connection_accept_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Connection_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Connection_Accept_Timeout_Cmd ( 0x00b1 ) - -v_U32_t btampPackTlvHCI_Write_Flow_Control_Mode_Cmd(void * pCtx, - tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Flow_Control_Mode_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3175, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->flow_control_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Flow_Control_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Flow_Control_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Flow_Control_Mode_Cmd ( 0x00b2 ) - -v_U32_t btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Link_Supervision_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3127, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->link_supervision_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Link_Supervision_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Link_Supervision_Timeout_Cmd ( 0x00b3 ) - -v_U32_t btampPackTlvHCI_Write_Location_Data_Cmd(void * pCtx, - tBtampTLVHCI_Write_Location_Data_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Location_Data_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3173, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->loc_domain_aware; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - BTAMP_MEMCPY(pCtx, pBuf, pSrc->loc_domain, 3); - *pnConsumed += 3; - pBuf += 3; - nBuf -= 3; - *pBuf = pSrc->loc_options; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Location_Data_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Location_Data_Cmd_t)(void *, tBtampTLVHCI_Write_Location_Data_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Location_Data_Cmd ( 0x00b4 ) - -v_U32_t btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(void * pCtx, - tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3170, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->logical_link_accept_timeout, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(void *, tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd ( 0x00b5 ) - -v_U32_t btampPackTlvHCI_Write_Loopback_Mode_Cmd(void * pCtx, - tBtampTLVHCI_Write_Loopback_Mode_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Loopback_Mode_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 6146, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->loopback_mode; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Loopback_Mode_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Loopback_Mode_Cmd_t)(void *, tBtampTLVHCI_Write_Loopback_Mode_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Loopback_Mode_Cmd ( 0x00b6 ) - -v_U32_t btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd(void * pCtx, - tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Write_Remote_AMP_ASSOC_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 5131, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - *pBuf = pSrc->phy_link_handle; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - frameshtons(pCtx, pBuf, pSrc->length_so_far, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - frameshtons(pCtx, pBuf, pSrc->amp_assoc_remaining_length, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - BTAMP_MEMCPY(pCtx, pBuf, &( pSrc->amp_assoc_fragment ), pSrc->amp_assoc_remaining_length); - *pnConsumed += pSrc->amp_assoc_remaining_length; - pBuf += ( pSrc->amp_assoc_remaining_length ); - nBuf -= ( pSrc->amp_assoc_remaining_length ); - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(void *, tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd ( 0x00b7 ) - -v_U32_t btampPackTlvHCI_Enhanced_Flush_Cmd(void * pCtx, - tBtampTLVHCI_Enhanced_Flush_Cmd *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 2; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Enhanced_Flush_Cmd(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 3167, 0); - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - *pBuf = pSrc->packet_type; - *pnConsumed += 1; - pBuf += 1; - nBuf -= 1; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Enhanced_Flush_Cmd. */ - -typedef v_U32_t (*pfnPackTlvHCI_Enhanced_Flush_Cmd_t)(void *, tBtampTLVHCI_Enhanced_Flush_Cmd *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Enhanced_Flush_Cmd ( 0x00b8 ) - -v_U32_t btampPackTlvHCI_Enhanced_Flush_Complete_Event(void * pCtx, - tBtampTLVHCI_Enhanced_Flush_Complete_Event *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed) -{ - v_U8_t* pTlvLen = 0; - v_U32_t nConsumedOnEntry; - v_U32_t status = BTAMP_PARSE_SUCCESS; - v_U32_t nNeeded = 0U; - v_U32_t sType = 0U; - v_U32_t sLen = 0U; - sType = 1; - sLen = 1; - // sanity checking - if( pCtx == NULL || pSrc == NULL || - pBuf == NULL || pnConsumed == NULL) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "bad input" ); - return BTAMP_BAD_INPUT_BUFFER; - } - nConsumedOnEntry = *pnConsumed; - - status = btampGetPackedTlvHCI_Enhanced_Flush_Complete_Event(pCtx, pSrc, &nNeeded); - if ( ! BTAMP_SUCCEEDED( status ) ) return status; - nNeeded += sType + sLen; - if ( nNeeded > nBuf ) return BTAMP_BUFFER_OVERFLOW; - pTlvLen = pBuf; - while ( pSrc->present ) - { - if( sType == 2) frameshtons( pCtx, pBuf, 57, 0); - else *pBuf = 57; - pBuf += sType; nBuf -= sType; *pnConsumed += sType; - pTlvLen = pBuf; - pBuf += sLen; nBuf -= sLen; *pnConsumed += sLen; - frameshtons(pCtx, pBuf, pSrc->log_link_handle, 0); - *pnConsumed += 2; - pBuf += 2; - nBuf -= 2; - break; - } - - if (pTlvLen && sLen == 2) - { - frameshtons( pCtx, pTlvLen, *pnConsumed - nConsumedOnEntry - sType - sLen, 0); - } else if(NULL != pTlvLen) - { - *pTlvLen = (v_U8_t)(*pnConsumed - nConsumedOnEntry - sType - sLen); - } - return status; -} /* End btampPackTlvHCI_Enhanced_Flush_Complete_Event. */ - -typedef v_U32_t (*pfnPackTlvHCI_Enhanced_Flush_Complete_Event_t)(void *, tBtampTLVHCI_Enhanced_Flush_Complete_Event *, v_U8_t*, v_U32_t, v_U32_t*); -#define SigPackTlvHCI_Enhanced_Flush_Complete_Event ( 0x00b9 ) - -v_U32_t btampPackAMP_ASSOC(void * pCtx, tBtampAMP_ASSOC *pFrm, v_U8_t *pBuf, v_U32_t nBuf, v_U32_t *pnConsumed) -{ - v_U32_t i; - static tTLVDefn TLVS[ ] = { - {BTAMP_TLV_AMP_ASSOC_MAC_ADDR, 0, 9, 9, offsetof(tBtampAMP_ASSOC, AMP_Assoc_MAC_Addr), offsetof(tBtampTLVAMP_Assoc_MAC_Addr, present), SigPackTlvAMP_Assoc_MAC_Addr, (pfnGeneric_t)btampPackTlvAMP_Assoc_MAC_Addr, "AMP_Assoc_MAC_Addr", 1, }, - {BTAMP_TLV_AMP_ASSOC_PREFERRED_CHANNEL_LIST, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Preferred_Channel_List), offsetof(tBtampTLVAMP_Assoc_Preferred_Channel_List, present), SigPackTlvAMP_Assoc_Preferred_Channel_List, (pfnGeneric_t)btampPackTlvAMP_Assoc_Preferred_Channel_List, "AMP_Assoc_Preferred_Channel_List", 1, }, - {BTAMP_TLV_AMP_ASSOC_CONNECTED_CHANNEL, 0, 9, 12, offsetof(tBtampAMP_ASSOC, AMP_Assoc_Connected_Channel), offsetof(tBtampTLVAMP_Assoc_Connected_Channel, present), SigPackTlvAMP_Assoc_Connected_Channel, (pfnGeneric_t)btampPackTlvAMP_Assoc_Connected_Channel, "AMP_Assoc_Connected_Channel", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_CAPABILITIES, 0, 7, 7, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Capabilities), offsetof(tBtampTLVAMP_Assoc_PAL_Capabilities, present), SigPackTlvAMP_Assoc_PAL_Capabilities, (pfnGeneric_t)btampPackTlvAMP_Assoc_PAL_Capabilities, "AMP_Assoc_PAL_Capabilities", 0, }, - {BTAMP_TLV_AMP_ASSOC_PAL_VERSION, 0, 8, 8, offsetof(tBtampAMP_ASSOC, AMP_Assoc_PAL_Version), offsetof(tBtampTLVAMP_Assoc_PAL_Version, present), SigPackTlvAMP_Assoc_PAL_Version, (pfnGeneric_t)btampPackTlvAMP_Assoc_PAL_Version, "AMP_Assoc_PAL_Version", 1, }, - { 0xffff, 0 }, - }; - - v_U32_t idx = 0; - v_U32_t status = 0; - (void)i; - *pnConsumed = 0U; - status |= PackTlvCore(pCtx,(v_U8_t*)pFrm,pBuf,nBuf,pnConsumed,TLVS,&idx); - -# ifdef BTAMP_DUMP_FRAMES - if (!BTAMP_FAILED(status)) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Packed the AMP_ASSOC:\n")); - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_MAC_Addr:\n")); - if (!pFrm->AMP_Assoc_MAC_Addr.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_MAC_Addr.mac_addr, 6); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Preferred_Channel_List:\n")); - if (!pFrm->AMP_Assoc_Preferred_Channel_List.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Preferred_Channel_List.country, 3); - FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Preferred_Channel_List.triplets, 3 * pFrm->AMP_Assoc_Preferred_Channel_List.num_triplets); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_Connected_Channel:\n")); - if (!pFrm->AMP_Assoc_Connected_Channel.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_Connected_Channel.country, 3); - FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("num_triplets: %d.\n"), pFrm->AMP_Assoc_Connected_Channel.num_triplets); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* ) pFrm->AMP_Assoc_Connected_Channel.triplets, 3 * pFrm->AMP_Assoc_Connected_Channel.num_triplets); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Capabilities:\n")); - if (!pFrm->AMP_Assoc_PAL_Capabilities.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Capabilities.pal_capabilities, 4); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("AMP_Assoc_PAL_Version:\n")); - if (!pFrm->AMP_Assoc_PAL_Version.present) - { - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("Not present.\n")); - } - else - { - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_version, 1); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_CompanyID, 2); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), ( v_U8_t* )&pFrm->AMP_Assoc_PAL_Version.pal_subversion, 2); - } - FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), FRFL("to:\n")); - FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, BTAMP_AMP_ASSOC), pBuf, nBuf); - } -# endif // BTAMP_DUMP_FRAMES - return status; - -} /* End btampUnpackAMP_ASSOC. */ - - -static v_U32_t PackTlvCore(void * pCtx, - v_U8_t *pSrc, - v_U8_t *pBuf, - v_U32_t nBuf, - v_U32_t *pnConsumed, - tTLVDefn TLVs[], - v_U32_t *pidx) -{ - tTLVDefn *pTlv; - tFRAMES_BOOL *pfFound; - v_U8_t *pBufRemaining; - v_U32_t nBufRemaining, status, status2, len; - - BTAMP_PARAMETER_CHECK2(pSrc, pBuf, nBuf, pnConsumed); - - (void)pCtx; - status = BTAMP_PARSE_SUCCESS; - status2 = BTAMP_PARSE_SUCCESS; - pBufRemaining = pBuf; - nBufRemaining = nBuf; - - pTlv = &( TLVs[0] ); - while ( 0xffff != pTlv->id ) - { - pfFound = (tFRAMES_BOOL*)(pSrc + pTlv->offset + - pTlv->presenceOffset); - if ( *pfFound && pTlv->minSize > nBufRemaining ) - { - FRAMES_LOG3(pCtx, FRLOGE, FRFL("The TLV %s takes at least" - " %d bytes, but there are only %d left in the buffer." - "\n"), pTlv->name, pTlv->minSize, nBufRemaining); - return BTAMP_BUFFER_OVERFLOW; - } - - len = 0U; - - if ( *pfFound ) { - switch ( pTlv->sig ) - { - case SigPackTlvAMP_Assoc_Connected_Channel: - status2 = ( (pfnPackTlvAMP_Assoc_Connected_Channel_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Connected_Channel* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvAMP_Assoc_MAC_Addr: - status2 = ( (pfnPackTlvAMP_Assoc_MAC_Addr_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_MAC_Addr* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvAMP_Assoc_PAL_Capabilities: - status2 = ( (pfnPackTlvAMP_Assoc_PAL_Capabilities_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Capabilities* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvAMP_Assoc_PAL_Version: - status2 = ( (pfnPackTlvAMP_Assoc_PAL_Version_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_PAL_Version* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvAMP_Assoc_Preferred_Channel_List: - status2 = ( (pfnPackTlvAMP_Assoc_Preferred_Channel_List_t)(pTlv->pfn) )(pCtx, ( tBtampTLVAMP_Assoc_Preferred_Channel_List* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvFlow_Spec: - status2 = ( (pfnPackTlvFlow_Spec_t)(pTlv->pfn) )(pCtx, ( tBtampTLVFlow_Spec* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Accept_Logical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Accept_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Accept_Physical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Accept_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Accept_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Channel_Selected_Event: - status2 = ( (pfnPackTlvHCI_Channel_Selected_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Channel_Selected_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Command_Complete_Event: - status2 = ( (pfnPackTlvHCI_Command_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Command_Status_Event: - status2 = ( (pfnPackTlvHCI_Command_Status_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Command_Status_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Create_Logical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Create_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Create_Physical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Create_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Create_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Data_Buffer_Overflow_Event: - status2 = ( (pfnPackTlvHCI_Data_Buffer_Overflow_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Data_Buffer_Overflow_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Disconnect_Logical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Disconnect_Logical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Disconnect_Logical_Link_Complete_Event: - status2 = ( (pfnPackTlvHCI_Disconnect_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Logical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Disconnect_Physical_Link_Cmd: - status2 = ( (pfnPackTlvHCI_Disconnect_Physical_Link_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Disconnect_Physical_Link_Complete_Event: - status2 = ( (pfnPackTlvHCI_Disconnect_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Disconnect_Physical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Flow_Spec_Modify_Cmd: - status2 = ( (pfnPackTlvHCI_Flow_Spec_Modify_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Flow_Spec_Modify_Complete_Event: - status2 = ( (pfnPackTlvHCI_Flow_Spec_Modify_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flow_Spec_Modify_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Flush_Cmd: - status2 = ( (pfnPackTlvHCI_Flush_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Flush_Occurred_Event: - status2 = ( (pfnPackTlvHCI_Flush_Occurred_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Flush_Occurred_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Generic_AMP_Link_Key_Notification_Event: - status2 = ( (pfnPackTlvHCI_Generic_AMP_Link_Key_Notification_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Generic_AMP_Link_Key_Notification_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Hardware_Error_Event: - status2 = ( (pfnPackTlvHCI_Hardware_Error_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Hardware_Error_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Logical_Link_Cancel_Cmd: - status2 = ( (pfnPackTlvHCI_Logical_Link_Cancel_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Cancel_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Logical_Link_Complete_Event: - status2 = ( (pfnPackTlvHCI_Logical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Logical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Loopback_Command_Event: - status2 = ( (pfnPackTlvHCI_Loopback_Command_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Loopback_Command_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Physical_Link_Complete_Event: - status2 = ( (pfnPackTlvHCI_Physical_Link_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Physical_Link_Loss_Warning_Event: - status2 = ( (pfnPackTlvHCI_Physical_Link_Loss_Warning_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Loss_Warning_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Physical_Link_Recovery_Event: - status2 = ( (pfnPackTlvHCI_Physical_Link_Recovery_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Physical_Link_Recovery_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Qos_Violation_Event: - status2 = ( (pfnPackTlvHCI_Qos_Violation_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Qos_Violation_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Buffer_Size_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Buffer_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Buffer_Size_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Connection_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Data_Block_Size_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Data_Block_Size_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Data_Block_Size_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Failed_Contact_Counter_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Flow_Control_Mode_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Flow_Control_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Link_Quality_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Link_Quality_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Quality_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Local_AMP_Assoc_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Local_AMP_Assoc_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Local_AMP_Information_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Local_AMP_Information_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_AMP_Information_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Local_Supported_Cmds_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Local_Supported_Cmds_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Supported_Cmds_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Local_Version_Info_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Local_Version_Info_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Local_Version_Info_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Location_Data_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Location_Data_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Logical_Link_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_Loopback_Mode_Cmd: - status2 = ( (pfnPackTlvHCI_Read_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_Loopback_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Read_RSSI_Cmd: - status2 = ( (pfnPackTlvHCI_Read_RSSI_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Read_RSSI_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Reset_Cmd: - status2 = ( (pfnPackTlvHCI_Reset_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Reset_Failed_Contact_Counter_Cmd: - status2 = ( (pfnPackTlvHCI_Reset_Failed_Contact_Counter_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Set_Event_Mask_Cmd: - status2 = ( (pfnPackTlvHCI_Set_Event_Mask_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Set_Event_Mask_Page_2_Cmd: - status2 = ( (pfnPackTlvHCI_Set_Event_Mask_Page_2_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Set_Short_Range_Mode_Cmd: - status2 = ( (pfnPackTlvHCI_Set_Short_Range_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Set_Short_Range_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Short_Range_Mode_Change_Complete_Event: - status2 = ( (pfnPackTlvHCI_Short_Range_Mode_Change_Complete_Event_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Short_Range_Mode_Change_Complete_Event* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Connection_Accept_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Connection_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Flow_Control_Mode_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Flow_Control_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Flow_Control_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Link_Supervision_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Link_Supervision_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Location_Data_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Location_Data_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Location_Data_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Loopback_Mode_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Loopback_Mode_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Loopback_Mode_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - case SigPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd: - status2 = ( (pfnPackTlvHCI_Write_Remote_AMP_ASSOC_Cmd_t)(pTlv->pfn) )(pCtx, ( tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd* )(pSrc + pTlv->offset), pBufRemaining, nBufRemaining, &len); - if (status2) status |= status2; - break; - default: - FRAMES_LOG1(pCtx, FRLOGE, FRFL("INTERNAL ERROR-- I don't " - "know about the TLV %d; this is most likely a bug in " - "'framesc'.\n"), pTlv->sig); - return BTAMP_INTERNAL_ERROR; - } - - } /* End if on *pfFound */ - pBufRemaining += len; - nBufRemaining -= len; - *pnConsumed += len; - ++pTlv; - if(len) ++*pidx; - } - - return status; - -} diff --git a/CORE/BAP/src/fsmDefs.h b/CORE/BAP/src/fsmDefs.h deleted file mode 100644 index 8705a98c328c..000000000000 --- a/CORE/BAP/src/fsmDefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -// Project/System dependant defines and typedefs - -#ifndef __FSMDEFS_H__ -#define __FSMDEFS_H__ - -/* Temporary fix until I clean up all the type names */ -#define BTAMPFSM_INSTANCEDATA_T tWLAN_BAPbapPhysLinkMachine - -typedef unsigned char BTAMPFSM_ENTRY_FLAG_T; -typedef unsigned char BTAMPFSM_STATEVAR_T; -typedef unsigned char BTAMPFSM_INST_ID_T; -typedef unsigned char BTAMPFSM_EVENT_T; -#endif diff --git a/CORE/CLD_TXRX/TLSHIM/tl_shim.c b/CORE/CLD_TXRX/TLSHIM/tl_shim.c index 347e36dffc4c..28e83287b822 100644 --- a/CORE/CLD_TXRX/TLSHIM/tl_shim.c +++ b/CORE/CLD_TXRX/TLSHIM/tl_shim.c @@ -1210,14 +1210,6 @@ VOS_STATUS WLANTL_SuspendDataTx(void *vos_ctx, u_int8_t *sta_id, return VOS_STATUS_SUCCESS; } -VOS_STATUS WLANTL_TxBAPFrm(void *vos_ctx, vos_pkt_t *buf, - WLANTL_MetaInfoType *meta_info, - WLANTL_TxCompCBType txcomp_cb) -{ - /* Not needed */ - return VOS_STATUS_SUCCESS; -} - void WLANTL_AssocFailed(u_int8_t sta_id) { /* Not needed */ @@ -1263,14 +1255,6 @@ VOS_STATUS WLANTL_TxFreeMsg(void *vos_ctx, vos_msg_t *message) return VOS_STATUS_SUCCESS; } -VOS_STATUS WLANTL_RegisterBAPClient(void *vos_ctx, - WLANTL_BAPRxCBType bap_rx, - WLANTL_FlushOpCompCBType flush_cb) -{ - /* Not needed */ - return VOS_STATUS_SUCCESS; -} - /* * Txrx does weighted RR scheduling, set/get ac weights does not * apply here, this is no operation. diff --git a/CORE/HDD/inc/bap_hdd_main.h b/CORE/HDD/inc/bap_hdd_main.h deleted file mode 100644 index e9f58da105a9..000000000000 --- a/CORE/HDD/inc/bap_hdd_main.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#if !defined( BAP_HDD_MAIN_H ) -#define BAP_HDD_MAIN_H - -/**=========================================================================== - - \file BAP_HDD_MAIN_H.h - - \brief Linux HDD Adapter Type - - ==========================================================================*/ - -/*--------------------------------------------------------------------------- - Include files - -------------------------------------------------------------------------*/ - -#include <linux/netdevice.h> -#include <linux/skbuff.h> -#include <vos_list.h> -#include <vos_types.h> - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -#define BSL_MAX_CLIENTS 1 -#define BSL_MAX_PHY_LINK_PER_CLIENT 1 - -/*--------------------------------------------------------------------------- - Function declarations and documenation - -------------------------------------------------------------------------*/ - -/**--------------------------------------------------------------------------- - - \brief BSL_Init() - Initialize the BSL Misc char driver - - This is called in by WLANBAP_Open() as part of bringing up the BT-AMP PAL (BAP) - WLANBAP_Open() will pass in the device context created. - - \param - NA - - \return - 0 for success non-zero for failure - - --------------------------------------------------------------------------*/ -int BSL_Init (void *pCtx); - -/**--------------------------------------------------------------------------- - - \brief BSL_Deinit() - De-initialize the BSL Misc char driver - - This is called in by WLANBAP_Close() as part of bringing down the BT-AMP PAL (BAP) - - \param - NA - - \return - 0 for success non-zero for failure - - --------------------------------------------------------------------------*/ - -int BSL_Deinit(void *pCtx); - - - -#endif // end #if !defined( BAP_HDD_MAIN_H ) diff --git a/CORE/HDD/inc/bap_hdd_misc.h b/CORE/HDD/inc/bap_hdd_misc.h deleted file mode 100644 index 889961d4a0b1..000000000000 --- a/CORE/HDD/inc/bap_hdd_misc.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - -#if !defined( BAP_HDD_MISC_H ) -#define BAP_HDD_MISC_H - -/**=========================================================================== - - \file BAP_HDD_MISC.h - - \brief Linux HDD Adapter Type - - ==========================================================================*/ - -/*--------------------------------------------------------------------------- - Include files - -------------------------------------------------------------------------*/ - -#include <bapApi.h> -#include <vos_types.h> -/*--------------------------------------------------------------------------- - Function declarations and documenation - -------------------------------------------------------------------------*/ - -/**--------------------------------------------------------------------------- - - \brief WLANBAP_SetConfig() - To updates some configuration for BAP module in - SME - - This should be called after WLANBAP_Start(). - - \param - NA - - \return - - The result code associated with performing the operation - - VOS_STATUS_E_FAILURE: failed to set the config in SME BAP - VOS_STATUS_SUCCESS: Success - - - --------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_SetConfig -( - WLANBAP_ConfigType *pConfig -); - -/**--------------------------------------------------------------------------- - - \brief WLANBAP_RegisterWithHCI() - To register WLAN PAL with HCI - - - \param - pAdapter : HDD adapter - - \return - - The result code associated with performing the operation - - VOS_STATUS_E_FAILURE: failed to register with HCI - VOS_STATUS_SUCCESS: Success - - - --------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_RegisterWithHCI(hdd_adapter_t *pAdapter); - -/**--------------------------------------------------------------------------- - - \brief WLANBAP_DeregisterFromHCI() - To deregister WLAN PAL with HCI - - - \param - NA - - \return - - The result code associated with performing the operation - - VOS_STATUS_E_FAILURE: failed to deregister with HCI - VOS_STATUS_SUCCESS: Success - - - --------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_DeregisterFromHCI(void); - -/**--------------------------------------------------------------------------- - - \brief WLANBAP_StopAmp() - To stop the current AMP traffic/connection - - - \param - NA - - \return - - The result code associated with performing the operation - - VOS_STATUS_E_FAILURE: failed to stop AMP connection - VOS_STATUS_SUCCESS: Success - - - --------------------------------------------------------------------------*/ -VOS_STATUS WLANBAP_StopAmp(void); - -/**--------------------------------------------------------------------------- - - \brief WLANBAP_AmpSessionOn() - To check if AMP connection is on currently - - - \param - NA - - \return - - The result code associated with performing the operation - - VOS_TRUE: AMP connection is on - VOS_FALSE: AMP connection is not on - - - --------------------------------------------------------------------------*/ -v_BOOL_t WLANBAP_AmpSessionOn(void); -#endif // end #if !defined( BAP_HDD_MISC_H ) diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h index 74e47cefa6d1..7e0d02706f81 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg.h +++ b/CORE/HDD/inc/wlan_hdd_cfg.h @@ -1395,18 +1395,6 @@ typedef enum #define CFG_ENABLE_HOST_NSOFFLOAD_DEFAULT ( 0 ) -#define CFG_ENABLE_BTAMP_NAME "gEnableBtAmp" -#define CFG_ENABLE_BTAMP_MIN ( 0 ) -#define CFG_ENABLE_BTAMP_MAX ( 1 ) -#define CFG_ENABLE_BTAMP_DEFAULT ( 0 ) - -#ifdef WLAN_BTAMP_FEATURE -#define CFG_BT_AMP_PREFERRED_CHANNEL_NAME "BtAmpPreferredChannel" -#define CFG_BT_AMP_PREFERRED_CHANNEL_MIN (1) -#define CFG_BT_AMP_PREFERRED_CHANNEL_MAX (11) -#define CFG_BT_AMP_PREFERRED_CHANNEL_DEFAULT (1) -#endif //WLAN_BTAMP_FEATURE - #define CFG_BAND_CAPABILITY_NAME "BandCapability" #define CFG_BAND_CAPABILITY_MIN (0) #define CFG_BAND_CAPABILITY_MAX (2) @@ -1659,7 +1647,6 @@ typedef enum * hence a value of 0xFF would set all bits (enable all logs) */ -#define CFG_VOS_TRACE_ENABLE_BAP_NAME "vosTraceEnableBAP" #define CFG_VOS_TRACE_ENABLE_TL_NAME "vosTraceEnableTL" #define CFG_VOS_TRACE_ENABLE_WDI_NAME "vosTraceEnableWDI" #define CFG_VOS_TRACE_ENABLE_HDD_NAME "vosTraceEnableHDD" @@ -2637,6 +2624,16 @@ This feature requires the dependent cfg.ini "gRoamPrefer5GHz" set to 1 */ #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_DEFAULT ( 3000 ) #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MIN ( 1000 ) #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MAX ( 10000 ) + +#define CFG_TCP_DELACK_THRESHOLD_HIGH "gTcpDelAckThresholdHigh" +#define CFG_TCP_DELACK_THRESHOLD_HIGH_DEFAULT ( 4000 ) +#define CFG_TCP_DELACK_THRESHOLD_HIGH_MIN ( 1000 ) +#define CFG_TCP_DELACK_THRESHOLD_HIGH_MAX ( 10000 ) + +#define CFG_TCP_DELACK_THRESHOLD_LOW "gTcpDelAckThresholdLow" +#define CFG_TCP_DELACK_THRESHOLD_LOW_DEFAULT ( 1000 ) +#define CFG_TCP_DELACK_THRESHOLD_LOW_MIN ( 0 ) +#define CFG_TCP_DELACK_THRESHOLD_LOW_MAX ( 4000 ) #endif /* MSM_PLATFORM */ #ifdef WLAN_FEATURE_11W @@ -3099,10 +3096,6 @@ typedef struct /* RF Settling Time Clock */ v_U32_t rfSettlingTimeUs; - v_U8_t enableBtAmp; -#ifdef WLAN_BTAMP_FEATURE - v_U8_t preferredChannel; -#endif //WLAN_BTAMP_FEATURE v_U8_t dynamicPsPollValue; v_BOOL_t AddTSWhenACMIsOff; @@ -3117,7 +3110,6 @@ typedef struct v_BOOL_t teleBcnWakeupEn; /* VOS Trace Control*/ - v_U16_t vosTraceEnableBAP; v_U16_t vosTraceEnableTL; v_U16_t vosTraceEnableWDI; v_U16_t vosTraceEnableHDD; @@ -3351,6 +3343,8 @@ typedef struct v_U32_t busBandwidthMediumThreshold; v_U32_t busBandwidthLowThreshold; v_U32_t busBandwidthComputeInterval; + v_U32_t tcpDelackThresholdHigh; + v_U32_t tcpDelackThresholdLow; #endif /* MSM_PLATFORM */ /* FW debug log parameters */ diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index 5200fac444d5..d98068822a92 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -1428,6 +1428,8 @@ struct hdd_context_s vos_timer_t bus_bw_timer; int cur_vote_level; spinlock_t bus_bw_lock; + int cur_rx_level; + uint64_t prev_rx; #endif v_U8_t issplitscan_enabled; diff --git a/CORE/HDD/src/bap_hdd_main.c b/CORE/HDD/src/bap_hdd_main.c deleted file mode 100644 index 85632ac8d1c9..000000000000 --- a/CORE/HDD/src/bap_hdd_main.c +++ /dev/null @@ -1,4576 +0,0 @@ -/* - * Copyright (c) 2012-2014 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. - */ - -/**======================================================================== - - \file bap_hdd_main.c - - \brief 802.11 BT-AMP PAL Host Device Driver implementation - - ========================================================================*/ - -/**========================================================================= - - EDIT HISTORY FOR FILE - - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - - $Header: /prj/qct/asw/engbuilds/scl/users02/jzmuda/gb-bluez/vendor/qcom/proprietary/wlan/libra/CORE/HDD/src/bap_hdd_main.c,v 1.63 2011/04/01 15:24:20 jzmuda Exp jzmuda $ $DateTime: $ $Author: jzmuda $ - - - when who what, where, why - -------- --- -------------------------------------------------------- - 12/1/09 JZmuda Created module. - - ==========================================================================*/ - -/*-------------------------------------------------------------------------- - Include Files - ------------------------------------------------------------------------*/ -#ifdef WLAN_BTAMP_FEATURE -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/miscdevice.h> -#include <linux/platform_device.h> -#include <linux/fs.h> -#include <linux/file.h> -#include <linux/spinlock.h> -//#include <linux/delay.h> -#include <linux/uaccess.h> -#include <linux/io.h> -//#include <wlan_qct_driver.h> -#include <wlan_hdd_includes.h> -#include <wlan_hdd_dp_utils.h> -/* -------------------------------------------------------------------------*/ -#include <bap_hdd_main.h> -#include <vos_api.h> -#include <bapApi.h> -#include <btampHCI.h> -/* -------------------------------------------------------------------------*/ -#include <net/bluetooth/bluetooth.h> -#include <net/bluetooth/hci_core.h> - -#include <wlan_hdd_misc.h> -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - -// the difference between the next two is that the first is the max -// number we support in our current implementation while the second is -// the max allowed by the spec -#define BSL_MAX_PHY_LINKS ( BSL_MAX_CLIENTS * BSL_MAX_PHY_LINK_PER_CLIENT ) -#define BSL_MAX_ALLOWED_PHY_LINKS 255 - -// these likely will need tuning based on experiments -#define BSL_MAX_RX_PKT_DESCRIPTOR 100 -#define BSL_MAX_TX_PKT_DESCRIPTOR 100 - -// these caps are in place to not have run-away queues, again needs empirical tuning -#define BSL_MAX_SIZE_TX_ACL_QUEUE 50 -#define BSL_MAX_SIZE_RX_ACL_QUEUE 50 -#define BSL_MAX_SIZE_RX_EVT_QUEUE 50 - -#if 0 -What are the maximum sizes of a command packet, an event packet and an ACL -data packet? - -[JimZ]: Sizes: -1. Cmd Maximum size is slightly greater than 672 btyes. But I am pretty sure -right now that I will never have more than 240 bytes to send down at a time. And -that is good. Because some rather unpleasant things happen at the HCI interface -if I exceed that. ( Think 8-bit CPUs. And the limitations of an 8-bit length - field. ) - -2. Event - Ditto. - -3. Data 1492 bytes -#endif - -// jimz -// TLV related defines - -#define USE_FINAL_FRAMESC -//#undef USE_FINAL_FRAMESC -// jimz -// TLV related defines - -#ifndef USE_FINAL_FRAMESC //USE_FINAL_FRAMESC -// AMP ASSOC TLV related defines -#define AMP_ASSOC_TLV_TYPE_SIZE 2 -#define AMP_ASSOC_TLV_LEN_SIZE 2 -#define AMP_ASSOC_TLV_TYPE_AND_LEN_SIZE (AMP_ASSOC_TLV_TYPE_SIZE + AMP_ASSOC_TLV_LEN_SIZE) - -// FLOW SPEC TLV related defines -#define FLOWSPEC_TYPE_SIZE 2 -#define FLOWSPEC_LEN_SIZE 2 -#define FLOWSPEC_TYPE_AND_LEN_SIZE (FLOWSPEC_TYPE_SIZE + FLOWSPEC_LEN_SIZE) - -// CMD TLV related defines -#define CMD_TLV_TYPE_SIZE 2 -#define CMD_TLV_LEN_SIZE 2 -#define CMD_TLV_TYPE_AND_LEN_SIZE (CMD_TLV_TYPE_SIZE + CMD_TLV_LEN_SIZE) - -// Event TLV related defines -#define EVENT_TLV_TYPE_SIZE 2 -#define EVENT_TLV_LEN_SIZE 2 -#define EVENT_TLV_TYPE_AND_LEN_SIZE (EVENT_TLV_TYPE_SIZE + EVENT_TLV_LEN_SIZE) - -// Data header size related defines -#define DATA_HEADER_SIZE 4 - -#else //USE_FINAL_FRAMESC - -// AMP ASSOC TLV related defines -#define AMP_ASSOC_TLV_TYPE_SIZE 1 -#define AMP_ASSOC_TLV_LEN_SIZE 2 -#define AMP_ASSOC_TLV_TYPE_AND_LEN_SIZE (AMP_ASSOC_TLV_TYPE_SIZE + AMP_ASSOC_TLV_LEN_SIZE) - -// FLOW SPEC TLV related defines -#define FLOWSPEC_TYPE_SIZE 1 -#define FLOWSPEC_LEN_SIZE 1 -#define FLOWSPEC_TYPE_AND_LEN_SIZE (FLOWSPEC_TYPE_SIZE + FLOWSPEC_LEN_SIZE) - -// CMD TLV related defines -#define CMD_TLV_TYPE_SIZE 2 -#define CMD_TLV_LEN_SIZE 1 -#define CMD_TLV_TYPE_AND_LEN_SIZE (CMD_TLV_TYPE_SIZE + CMD_TLV_LEN_SIZE) - -// Event TLV related defines -#define EVENT_TLV_TYPE_SIZE 1 -#define EVENT_TLV_LEN_SIZE 1 -#define EVENT_TLV_TYPE_AND_LEN_SIZE (EVENT_TLV_TYPE_SIZE + EVENT_TLV_LEN_SIZE) - -// Data header size related defines -#define DATA_HEADER_SIZE 4 - -#endif // USE_FINAL_FRAMESC -// jimz - -#define BSL_MAX_EVENT_SIZE 700 - -#define BSL_DEV_HANDLE 0x1234 - -// Debug related defines -#define DBGLOG printf -//#define DUMPLOG -#if defined DUMPLOG -#define DUMPLOG(n, name1, name2, aStr, size) do { \ - int i; \ - DBGLOG("%d. %s: %s = \n", n, name1, name2); \ - for (i = 0; i < size; i++) \ - DBGLOG("%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ - DBGLOG("\n"); \ - } while (0) -#else -#define DUMPLOG(n, name1, name2, aStr, size) -#endif - -// These are required to replace some Microsoft specific specifiers -//#define UNALIGNED __align -#define UNALIGNED -#define INFINITE 0 - -#define BT_AMP_HCI_CTX_MAGIC 0x48434949 // "HCII" - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -// Temporary Windows types -typedef int BOOL; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef void * HANDLE; -typedef char TCHAR; -typedef void *LPVOID; -typedef const void *LPCVOID; - -typedef struct -{ - BOOL used; // is this a valid context? - vos_event_t ReadableEvt; // the event a ReadFile can block on - ptBtampHandle bapHdl; // our handle in BAP - vos_list_t PhyLinks; // a list of all associations setup by this client -// Newly added for BlueZ - struct hci_dev *hdev; // the BlueZ HCI device structure - - /* I don't know how many of these Tx fields we need */ - spinlock_t lock; /* For serializing operations */ - - struct sk_buff_head txq; /* We need the ACL Data Tx queue */ - - /* We definitely need some of these rx_skb fields */ - unsigned long rx_state; - unsigned long rx_count; - struct sk_buff *rx_skb; - - struct net_device *p_dev; // Our parent wlan network device - -} BslClientCtxType; - -typedef struct -{ - BslClientCtxType* pctx; - /* Tx skb queue and the workstructure for handling Tx as deferred work. */ - struct sk_buff *tx_skb; - - struct work_struct hciInterfaceProcessing; - v_U32_t magic; - -} BslHciWorkStructure; - -typedef struct -{ - TCHAR* ValueName; // name of the value - DWORD Type; // type of value - DWORD DwordValue; // DWORD value - TCHAR* StringValue; // string value - -} BslRegEntry; - -typedef struct -{ - BOOL used; // is this a valid context? - hdd_list_t ACLTxQueue[WLANTL_MAX_AC]; // the TX ACL queues - BslClientCtxType* pClientCtx; // ptr to application context that spawned - // this association - v_U8_t PhyLinkHdl; // BAP handle for this association - void* pPhyLinkDescNode; // ptr to node in list of assoc in client ctx - // real type BslPhyLinksNodeType* - -} BslPhyLinkCtxType; - -typedef struct -{ - vos_list_node_t node; // MUST be first element - BslPhyLinkCtxType* pPhy; // ptr to an association context - -} BslPhyLinksNodeType; - -typedef struct -{ - vos_list_node_t node; // MUST be first element - vos_pkt_t* pVosPkt; // ptr to a RX VoS pkt which can hold an HCI event or ACL data - -} BslRxListNodeType; - -// Borrowed from wlan_hdd_dp_utils.h -typedef struct -{ - hdd_list_node_t node; // MUST be first element - struct sk_buff * skb; // ptr to the ACL data - -} BslTxListNodeType; - -typedef struct -{ - BslPhyLinkCtxType* ptr; // ptr to the association context for this phy_link_handle - -} BslPhyLinkMapEntryType; - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ -BslClientCtxType* gpBslctx; - -/*---------------------------------------------------------------------------- - * Static Variable Definitions - * -------------------------------------------------------------------------*/ -// Temporary (until multi-phy link) pointer to BT-AMP context -static void *gpCtx; - -// an efficient lookup from phy_link_handle to phy link context -static BslPhyLinkMapEntryType BslPhyLinkMap[BSL_MAX_ALLOWED_PHY_LINKS]; - -//static HANDLE hBsl = NULL; //INVALID_HANDLE_VALUE; -static BOOL bBslInited = FALSE; - -static BslClientCtxType BslClientCtx[BSL_MAX_CLIENTS]; -//static vos_lock_t BslClientLock; - -static BslPhyLinkCtxType BslPhyLinkCtx[BSL_MAX_PHY_LINKS]; -//static vos_lock_t BslPhyLock; - -// the pool for association contexts -static vos_list_t BslPhyLinksDescPool; -static BslPhyLinksNodeType BslPhyLinksDesc[BSL_MAX_PHY_LINKS]; - -//static v_U32_t Eventlen = 0; - -/*--------------------------------------------------------------------------- - * Forward declarations - *-------------------------------------------------------------------------*/ -static void bslWriteFinish(struct work_struct *work); - -/*--------------------------------------------------------------------------- - * Driver Entry points and Structure definitions - *-------------------------------------------------------------------------*/ -static int BSL_Open (struct hci_dev *hdev); -static int BSL_Close (struct hci_dev *hdev); -static int BSL_Flush(struct hci_dev *hdev); -static int BSL_IOControl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); -static int BSL_Write(struct sk_buff *skb); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) -static void BSL_Destruct(struct hci_dev *hdev); -#endif - - -/*---------------------------------------------------------------------------- - * Static Function Declarations and Definitions - * -------------------------------------------------------------------------*/ -static v_BOOL_t WLANBAP_AmpConnectionAllowed(void) -{ - v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); - hdd_context_t *pHddCtx; - v_BOOL_t retVal = VOS_FALSE; - - if (NULL != pVosContext) - { - pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); - if (NULL != pHddCtx) - { - return pHddCtx->isAmpAllowed; - } - else - { - return retVal; - } - } - return retVal; -} - -/** - @brief WLANBAP_STAFetchPktCB() - The fetch packet callback registered - with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_STAFetchPktCBType routine being called. Which is called by - TL when the scheduling algorithms allows for transmission of another - packet to the module. - - This function is here to "wrap" or abstract WLANTL_STAFetchPktCBType. - Because the BAP-specific HDD "shim" layer (BSL) doesn't know anything - about STAIds, or other parameters required by TL. - - @param pHddHdl: [in] The HDD(BSL) specific context for this association. - Use the STAId passed to me by TL in WLANTL_STAFetchCBType to retreive - this value. - @param pucAC: [inout] access category requested by TL, if HDD does not - have packets on this AC it can choose to service another AC queue in - the order of priority - @param vosDataBuff: [out] pointer to the VOSS data buffer that was - transmitted - @param tlMetaInfo: [out] meta info related to the data frame - - @return - The result code associated with performing the operation -*/ -static VOS_STATUS WLANBAP_STAFetchPktCB -( - v_PVOID_t pHddHdl, - WLANTL_ACEnumType ucAC, - vos_pkt_t** vosDataBuff, - WLANTL_MetaInfoType* tlMetaInfo -) -{ - BslPhyLinkCtxType* pPhyCtx; - VOS_STATUS VosStatus; - v_U8_t AcIdxStart; - v_U8_t AcIdx; - hdd_list_node_t *pLink; - BslTxListNodeType *pNode; - struct sk_buff * skb; - BslClientCtxType* pctx; - WLANTL_ACEnumType Ac; - vos_pkt_t* pVosPkt; - WLANTL_MetaInfoType TlMetaInfo; - pctx = &BslClientCtx[0]; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "WLANBAP_STAFetchPktCB" ); - - // sanity checking - if( pHddHdl == NULL || vosDataBuff == NULL || - tlMetaInfo == NULL || ucAC >= WLANTL_MAX_AC || ucAC < 0 ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB bad input" ); - return VOS_STATUS_E_FAILURE; - } - - // Initialize the VOSS packet returned to NULL - in case of error - *vosDataBuff = NULL; - - pPhyCtx = (BslPhyLinkCtxType *)pHddHdl; - AcIdx = AcIdxStart = ucAC; - - spin_lock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock); - VosStatus = hdd_list_remove_front( &pPhyCtx->ACLTxQueue[AcIdx], &pLink ); - spin_unlock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock); - - if ( VOS_STATUS_E_EMPTY == VosStatus ) - { - do - { - AcIdx = (AcIdx + 1) % WLANTL_MAX_AC; - - spin_lock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock); - VosStatus = hdd_list_remove_front( &pPhyCtx->ACLTxQueue[AcIdx], &pLink ); - spin_unlock_bh(&pPhyCtx->ACLTxQueue[AcIdx].lock); - - } - while ( VosStatus == VOS_STATUS_E_EMPTY && AcIdx != AcIdxStart ); - - if ( VosStatus == VOS_STATUS_E_EMPTY ) - { - // Queue is empty. This can happen. Just return NULL back to TL... - return(VOS_STATUS_E_EMPTY); - } - else if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT( 0 ); - } - } - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT( 0 ); - } - - pNode = (BslTxListNodeType *)pLink; - skb = pNode->skb; - - // I will access the skb in a VOSS packet - // Wrap the OS provided skb in a VOSS packet - // Attach skb to VOS packet. - VosStatus = vos_pkt_wrap_data_packet( &pVosPkt, - VOS_PKT_TYPE_TX_802_3_DATA, - skb, - NULL, - NULL); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB vos_pkt_wrap_data_packet " - "failed status =%d", VosStatus ); - kfree_skb(skb); - return VosStatus; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s: pVosPkt(vos_pkt_t *)=%p", __func__, - pVosPkt ); - - VosStatus = WLANBAP_XlateTxDataPkt( pctx->bapHdl, pPhyCtx->PhyLinkHdl, - &Ac, &TlMetaInfo, pVosPkt); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STAFetchPktCB WLANBAP_XlateTxDataPkt " - "failed status =%d", VosStatus ); - - // return the packet - VosStatus = vos_pkt_return_packet( pVosPkt ); - kfree_skb(skb); - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return VosStatus; - } - // give TL the VoS pkt - *vosDataBuff = pVosPkt; - - // provide the meta-info BAP provided previously - *tlMetaInfo = TlMetaInfo; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: *vosDataBuff(vos_pkt_t *)=%p", __func__, *vosDataBuff ); - - return(VOS_STATUS_SUCCESS); -} // WLANBAP_STAFetchPktCB() - -/** - @brief WLANBAP_STARxCB() - The receive callback registered with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_STARxCBType routine being called. Which is called by - TL to notify when a packet was received for a registered STA. - - @param pHddHdl: [in] The HDD(BSL) specific context for this association. - Use the STAId passed to me by TL in WLANTL_STARxCBType to retrieve this value. - @param vosDataBuff: [in] pointer to the VOSS data buffer that was received - (it may be a linked list) - @param pRxMetaInfo: [in] Rx meta info related to the data frame - - @return - The result code associated with performing the operation -*/ -static VOS_STATUS WLANBAP_STARxCB -( - v_PVOID_t pHddHdl, - vos_pkt_t* vosDataBuff, - WLANTL_RxMetaInfoType* pRxMetaInfo -) -{ - BslPhyLinkCtxType* pctx; - BslClientCtxType* ppctx; - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - WLANTL_ACEnumType Ac; // this is not needed really - struct sk_buff *skb = NULL; - vos_pkt_t* pVosPacket; - vos_pkt_t* pNextVosPacket; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "WLANBAP_STARxCB" ); - - // sanity checking - if ( pHddHdl == NULL || vosDataBuff == NULL || pRxMetaInfo == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STARxCB bad input" ); - if(NULL != vosDataBuff) - { - VosStatus = vos_pkt_return_packet( vosDataBuff ); - } - return VOS_STATUS_E_FAILURE; - } - - pctx = (BslPhyLinkCtxType *)pHddHdl; - ppctx = pctx->pClientCtx; - - if( NULL == ppctx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_STARxCB ClientCtx is NULL" ); - VosStatus = vos_pkt_return_packet( vosDataBuff ); - return VOS_STATUS_E_FAILURE; - } - - // walk the chain until all are processed - pVosPacket = vosDataBuff; - do - { - // get the pointer to the next packet in the chain - // (but don't unlink the packet since we free the entire chain later) - VosStatus = vos_pkt_walk_packet_chain( pVosPacket, &pNextVosPacket, VOS_FALSE); - - // both "success" and "empty" are acceptable results - if (!((VosStatus == VOS_STATUS_SUCCESS) || (VosStatus == VOS_STATUS_E_EMPTY))) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: Failure walking packet chain", __func__); - return VOS_STATUS_E_FAILURE; - } - - // process the packet - VosStatus = WLANBAP_XlateRxDataPkt( ppctx->bapHdl, pctx->PhyLinkHdl, - &Ac, pVosPacket ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "WLANBAP_STARxCB WLANBAP_XlateRxDataPkt " - "failed status = %d", VosStatus ); - - VosStatus = VOS_STATUS_E_FAILURE; - - break; - } - - // Extract the OS packet (skb). - // Tell VOS to detach the OS packet from the VOS packet - VosStatus = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE ); - if(!VOS_IS_STATUS_SUCCESS( VosStatus )) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: Failure extracting skb from vos pkt. " - "VosStatus = %d", __func__, VosStatus ); - - VosStatus = VOS_STATUS_E_FAILURE; - - break; - } - - //JEZ100809: While an skb is being handled by the kernel, is "skb->dev" de-ref'd? - skb->dev = (struct net_device *) gpBslctx->hdev; - bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; - //skb->protocol = eth_type_trans(skb, skb->dev); - //skb->ip_summed = CHECKSUM_UNNECESSARY; - - // This is my receive skb pointer - gpBslctx->rx_skb = skb; - - // This is how data and events are passed up to BlueZ - hci_recv_frame(gpBslctx->rx_skb); - - // now process the next packet in the chain - pVosPacket = pNextVosPacket; - - } while (pVosPacket); - - - //JEZ100922: We are free to return the enclosing VOSS packet. - VosStatus = vos_pkt_return_packet( vosDataBuff ); - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - - return(VOS_STATUS_SUCCESS); -} // WLANBAP_STARxCB() - -/** - @brief WLANBAP_TxCompCB() - The Tx complete callback registered with BAP by HDD. - - It is called by the BAP immediately upon the underlying - WLANTL_TxCompCBType routine being called. Which is called by - TL to notify when a transmission for a packet has ended. - - @param pHddHdl: [in] The HDD(BSL) specific context for this association - @param vosDataBuff: [in] pointer to the VOSS data buffer that was transmitted - @param wTxSTAtus: [in] status of the transmission - - @return - The result code associated with performing the operation -*/ -extern v_VOID_t WLANBAP_TxPacketMonitorHandler ( v_PVOID_t ); // our handle in BAP - -static VOS_STATUS WLANBAP_TxCompCB -( - v_PVOID_t pHddHdl, - vos_pkt_t* vosDataBuff, - VOS_STATUS wTxSTAtus -) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - //BslTxListNodeType* pTxNode; - void* pOsPkt = NULL; - BslPhyLinkCtxType* pctx; - BslClientCtxType* ppctx; - static int num_packets; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "WLANBAP_TxCompCB. vosDataBuff(vos_pkt_t *)=%p", vosDataBuff ); - - // be aware that pHddHdl can be NULL or can point to the per association - // BSL context from the register data plane. In either case it does not - // matter since we will simply free the VoS pkt and reclaim the TX - // descriptor - - // sanity checking - if ( vosDataBuff == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_TxCompCB bad input" ); - return VOS_STATUS_E_FAILURE; - } - - //Return the skb to the OS - VosStatus = vos_pkt_get_os_packet( vosDataBuff, &pOsPkt, VOS_TRUE ); - if(!VOS_IS_STATUS_SUCCESS( VosStatus )) - { - //This is bad but still try to free the VOSS resources if we can - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __func__); - vos_pkt_return_packet( vosDataBuff ); - return VOS_STATUS_E_FAILURE; - } - - kfree_skb((struct sk_buff *)pOsPkt); - - //Return the VOS packet resources. - VosStatus = vos_pkt_return_packet( vosDataBuff ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT(0); - } - - // JEZ110330: Now signal the layer above me...that I have released some packets. - pctx = (BslPhyLinkCtxType *)pHddHdl; - ppctx = pctx->pClientCtx; - num_packets = (num_packets + 1) % 4; - if (num_packets == 0 ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s: Sending up number of completed packets. num_packets = %d.", __func__, num_packets ); - WLANBAP_TxPacketMonitorHandler ( (v_PVOID_t) ppctx->bapHdl ); // our handle in BAP - } - - return(VOS_STATUS_SUCCESS); -} // WLANBAP_TxCompCB() - -/** - @brief BslFlushTxQueues() - flush the Tx queues - - @param pPhyCtx : [in] ptr to the phy context whose queues need to be flushed - - @return - VOS_STATUS - -*/ -static VOS_STATUS BslFlushTxQueues -( - BslPhyLinkCtxType* pPhyCtx -) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - v_SINT_t i = -1; - hdd_list_node_t* pLink; - BslTxListNodeType *pNode; - - - if(TRUE == pPhyCtx->used) - { - while (++i != WLANTL_MAX_AC) - { - //Free up any packets in the Tx queue - spin_lock_bh(&pPhyCtx->ACLTxQueue[i].lock); - while (true) - { - VosStatus = hdd_list_remove_front(&pPhyCtx->ACLTxQueue[i], &pLink ); - if(VOS_STATUS_E_EMPTY != VosStatus) - { - pNode = (BslTxListNodeType *)pLink; - kfree_skb(pNode->skb); - continue; - } - break; - } - spin_unlock_bh(&pPhyCtx->ACLTxQueue[i].lock); - } - } - return(VOS_STATUS_SUCCESS); -} // BslFlushTxQueues - - -/** - @brief BslReleasePhyCtx() - this function will free up an association context - - @param pPhyCtx : [in] ptr to the phy context to release - - @return - None - -*/ -static void BslReleasePhyCtx -( - BslPhyLinkCtxType* pPhyCtx -) -{ - uintptr_t OldMapVal; - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslReleasePhyCtx" ); - - pPhyCtx->used = FALSE; - - - if (BslPhyLinkMap[pPhyCtx->PhyLinkHdl].ptr == NULL) return; - - - // update the phy link handle based map so TX data is stopped from flowing through - OldMapVal = vos_atomic_set( (uintptr_t *) (BslPhyLinkMap[pPhyCtx->PhyLinkHdl].ptr), - (uintptr_t) 0 ); - - // clear out the Tx Queues - VosStatus = BslFlushTxQueues(pPhyCtx); - - // clear out the parent ptr - // pPhyCtx->pClientCtx = NULL;//commented to debug exception - - // we also need to remove this assocation from the list of active - // associations maintained in the application context - if( pPhyCtx->pPhyLinkDescNode ) - { - VosStatus = vos_list_remove_node( &pPhyCtx->pClientCtx->PhyLinks, - &((BslPhyLinksNodeType*)pPhyCtx->pPhyLinkDescNode)->node); - if (VOS_STATUS_SUCCESS != VosStatus) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: vos_list_remove_node() is not succses", __func__); - } else { - //Return the PhyLink handle to the free pool - VosStatus = vos_list_insert_front(&BslPhyLinksDescPool,&((BslPhyLinksNodeType*)pPhyCtx->pPhyLinkDescNode)->node); - if (VOS_STATUS_SUCCESS != VosStatus) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: vos_list_insert_front() is not succses", __func__); - } - } - pPhyCtx->pPhyLinkDescNode = NULL; - } - pPhyCtx->pClientCtx = NULL;//Moved here to bebug the exception - - pPhyCtx->used = FALSE; - -} // BslReleasePhyCtx() - -/** - @brief WLAN_BAPEventCB() - Implements the callback for ALL asynchronous events. - - Including Events resulting from: - * HCI Create Physical Link, - * Disconnect Physical Link, - * Create Logical Link, - * Flow Spec Modify, - * HCI Reset, - * HCI Flush,... - - Also used to return sync events locally by BSL - - @param pHddHdl: [in] The HDD(BSL) specific context for this association. - BSL gets this from the downgoing packets Physical handle value. - @param pBapHCIEvent: [in] pointer to the union of "HCI Event" structures. - Contains all info needed for HCI event. - @param AssocSpecificEvent: [in] flag indicates assoc-specific (1) or - global (0) event - - @return - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to pBapHCIEvent is NULL - VOS_STATUS_SUCCESS: Success -*/ -static VOS_STATUS WLANBAP_EventCB -( - v_PVOID_t pHddHdl, /* this could refer to either the BSL per - association context which got passed in during - register data plane OR the BSL per application - context passed in during register BAP callbacks - based on setting of the Boolean flag below */ - tpBtampHCI_Event pBapHCIEvent, /* This now encodes ALL event types including - Command Complete and Command Status*/ - v_BOOL_t AssocSpecificEvent /* Flag to indicate global or assoc-specific event */ -) -{ - BslClientCtxType* pctx; - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - vos_pkt_t* pVosPkt; - v_U32_t PackStatus; - static v_U8_t Buff[BSL_MAX_EVENT_SIZE]; // stack overflow? - v_U32_t Written = 0; // FramesC REQUIRES this - v_U32_t OldMapVal; - struct sk_buff *skb = NULL; - - // sanity checking - if ( pBapHCIEvent == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB bad input" ); - return VOS_STATUS_E_FAILURE; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB event=%d " - "assoc_specific=%d", pBapHCIEvent->bapHCIEventCode, AssocSpecificEvent ); - - if ( pHddHdl == NULL ) - { - /* Consider the following error scenarios to bypass the NULL check: - - create LL without a call for create PL before - - delete LL or PL when no AMP connection has been established yet - Client context is unimportant from HCI point of view, only needed by the TLV API in BAP - TODO: Change the TLV APIs to not to carry the client context; it doesn't use it anyway - */ - if (( AssocSpecificEvent ) && - (BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT != pBapHCIEvent->bapHCIEventCode) && - (BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT != pBapHCIEvent->bapHCIEventCode)) - { - pctx = gpBslctx; - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "WLANBAP_EventCB bad input" ); - return VOS_STATUS_E_FAILURE; - } - } - - - if(NULL != pHddHdl) - { - if ( AssocSpecificEvent ) - { - // get the app context from the assoc context - pctx = ((BslPhyLinkCtxType *)pHddHdl)->pClientCtx; - } - else - { - pctx = (BslClientCtxType *)pHddHdl; - } - } - - if(NULL == pctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "pctx is NULL in %s", __func__); - - return VOS_STATUS_E_FAULT; - - } - - VosStatus = vos_pkt_get_packet( &pVosPkt, VOS_PKT_TYPE_RX_RAW, - BSL_MAX_EVENT_SIZE, 1, 0, NULL, NULL); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB vos_pkt_get_packet " - "failed status=%d", VosStatus ); - return(VosStatus); - } - - switch ( pBapHCIEvent->bapHCIEventCode ) - { - /** BT events */ - case BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT: - { - /* - BTAMP_TLV_HCI_RESET_CMD: - BTAMP_TLV_HCI_FLUSH_CMD: - BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD: - BTAMP_TLV_HCI_SET_EVENT_MASK_CMD: - BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD: - BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD: - BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD: - BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD: - BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD: - BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD: - BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD: - BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD: - BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD: - BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD: - BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD: - BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TO_CMD: - BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TO_CMD: - BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD: - BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFORMATION_CMD: - BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_COMMANDS_CMD: - BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD: - BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD: - BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD: - BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD: - BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD: - BTAMP_TLV_HCI_READ_RSSI_CMD: - BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD: - BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD: - BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD: - BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD: - BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD: - BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0: - - */ - - // pack - PackStatus = btampPackTlvHCI_Command_Complete_Event( pctx, - &pBapHCIEvent->u.btampCommandCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Command_Complete_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_COMMAND_STATUS_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Command_Status_Event( pctx, - &pBapHCIEvent->u.btampCommandStatusEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Command_Status_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Num_Completed_Pkts_Event( pctx, - &pBapHCIEvent->u.btampNumOfCompletedPktsEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Num_Completed_Pkts_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Num_Completed_Data_Blocks_Event( pctx, - &pBapHCIEvent->u.btampNumOfCompletedDataBlocksEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Num_Completed_Data_Blocks_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_HARDWARE_ERROR_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Hardware_Error_Event( pctx, - &pBapHCIEvent->u.btampHardwareErrorEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_FLUSH_OCCURRED_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Flush_Occurred_Event( pctx, - &pBapHCIEvent->u.btampFlushOccurredEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Flush_Occurred_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_ENHANCED_FLUSH_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Enhanced_Flush_Complete_Event( pctx, - &pBapHCIEvent->u.btampEnhancedFlushCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampPackTlvHCI_Enhanced_Flush_Complete_Event failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_LOOPBACK_COMMAND_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Loopback_Command_Event( pctx, - &pBapHCIEvent->u.btampLoopbackCommandEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_DATA_BUFFER_OVERFLOW_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Data_Buffer_Overflow_Event( pctx, - &pBapHCIEvent->u.btampDataBufferOverflowEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_QOS_VIOLATION_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Qos_Violation_Event( pctx, - &pBapHCIEvent->u.btampQosViolationEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - /** BT v3.0 events */ - case BTAMP_TLV_HCI_GENERIC_AMP_LINK_KEY_NOTIFICATION_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Generic_AMP_Link_Key_Notification_Event( pctx, - &pBapHCIEvent->u.btampGenericAMPLinkKeyNotificationEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Physical_Link_Complete_Event( pctx, - &pBapHCIEvent->u.btampPhysicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - // look at this event to determine whether to cleanup the PHY context - if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_STATUS_SUCCESS ) - { - // register the data plane now - VosStatus = WLANBAP_RegisterDataPlane( pctx->bapHdl, - WLANBAP_STAFetchPktCB, - WLANBAP_STARxCB, - WLANBAP_TxCompCB, - (BslPhyLinkCtxType *)pHddHdl ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB WLANBAP_RegisterDataPlane " - "failed status = %d", VosStatus ); - // we still want to send the event upto app so do not bail - } - else - { - // update the phy link handle based map so TX data can start flowing through - OldMapVal = vos_atomic_set( (uintptr_t*)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle, - (uintptr_t) pHddHdl ); - -// VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect - } - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_ERROR_HOST_REJ_RESOURCES ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_ERROR_HOST_TIMEOUT ) - { - //We need to update the phy link handle here to be able to reissue physical link accept - // update the phy link handle based map so TX data can start flowing through - OldMapVal = vos_atomic_set( (uintptr_t*)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle, - (uintptr_t) pHddHdl ); - -// VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect - - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_ERROR_MAX_NUM_CNCTS ) - { - //We need to update the phy link handle here to be able to reissue physical link /create/accept - // update the phy link handle based map so TX data can start flowing through - OldMapVal = vos_atomic_set( (uintptr_t*)BslPhyLinkMap+pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.phy_link_handle, - (uintptr_t) pHddHdl ); -// VOS_ASSERT( OldMapVal == 0 );//Commented to test reconnect - - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_ERROR_HOST_TIMEOUT ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - 0x16 /* WLANBAP_ERROR_FAILED_CONNECTION? */ ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - 0x8 /* WLANBAP_ERROR_AUTH_FAILED? */ ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else if ( pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status == - WLANBAP_ERROR_NO_CNCT ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected HCI Phy Link Comp Evt " - "status =%d", pBapHCIEvent->u.btampPhysicalLinkCompleteEvent.status ); - } - - break; - } - case BTAMP_TLV_HCI_CHANNEL_SELECTED_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Channel_Selected_Event( pctx, - &pBapHCIEvent->u.btampChannelSelectedEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Disconnect_Physical_Link_Complete_Event( pctx, - &pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - // we need to cleanup the PHY context always but have these checks to make - // sure we catch unexpected behavior, strangely enough even when peer triggers - // the disconnect the reason code is still 0x16, weird - if ( pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.status == WLANBAP_STATUS_SUCCESS && - pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.reason == WLANBAP_ERROR_TERM_BY_LOCAL_HOST ) - { - BslReleasePhyCtx( (BslPhyLinkCtxType *)pHddHdl ); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected HCI Dis Phy Link Comp Evt " - "status =%d reason =%d", pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.status, - pBapHCIEvent->u.btampDisconnectPhysicalLinkCompleteEvent.reason ); - } - - break; - } - case BTAMP_TLV_HCI_PHYSICAL_LINK_LOSS_WARNING_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Physical_Link_Loss_Warning_Event( pctx, - &pBapHCIEvent->u.btampPhysicalLinkLossWarningEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_PHYSICAL_LINK_RECOVERY_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Physical_Link_Recovery_Event( pctx, - &pBapHCIEvent->u.btampPhysicalLinkRecoveryEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Logical_Link_Complete_Event( pctx, - &pBapHCIEvent->u.btampLogicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Disconnect_Logical_Link_Complete_Event( pctx, - &pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Flow_Spec_Modify_Complete_Event( pctx, - &pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - case BTAMP_TLV_HCI_SHORT_RANGE_MODE_CHANGE_COMPLETE_EVENT: - { - // pack - PackStatus = btampPackTlvHCI_Short_Range_Mode_Change_Complete_Event( pctx, - &pBapHCIEvent->u.btampShortRangeModeChangeCompleteEvent, Buff, BSL_MAX_EVENT_SIZE, &Written ); - - if ( !BTAMP_SUCCEEDED( PackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_EventCB: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", PackStatus); - // handle the error - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - break; - } - default: - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB unexpected event" ); - - VosStatus = vos_pkt_return_packet( pVosPkt ); - - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - break; - } - } - - if (BSL_MAX_EVENT_SIZE < Written) - { - VosStatus = vos_pkt_return_packet( pVosPkt ); - VOS_ASSERT(0); - return(VOS_STATUS_E_FAILURE); - } - - // stick the event into a VoS pkt - VosStatus = vos_pkt_push_head( pVosPkt, Buff, Written ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_EventCB vos_pkt_push_head " - "status =%d", VosStatus ); - - // return the packet - VosStatus = vos_pkt_return_packet( pVosPkt ); - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - // Extract the OS packet (skb). - // Tell VOS to detach the OS packet from the VOS packet - VosStatus = vos_pkt_get_os_packet( pVosPkt, (v_VOID_t **)&skb, VOS_TRUE ); - if(!VOS_IS_STATUS_SUCCESS( VosStatus )) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: Failure extracting skb from vos pkt. " - "VosStatus = %d", __func__, VosStatus ); - - // return the packet - VosStatus = vos_pkt_return_packet( pVosPkt ); - VOS_ASSERT(VOS_IS_STATUS_SUCCESS( VosStatus )); - - return(VOS_STATUS_E_FAILURE); - } - - //JEZ100922: We are free to return the enclosing VOSS packet. - VosStatus = vos_pkt_return_packet( pVosPkt ); - if(VOS_STATUS_SUCCESS != VosStatus) - { - // just print no action required - VOS_ASSERT(0); - } - - //JEZ100809: While an skb is being handled by the kernel, is "skb->dev" de-ref'd? - skb->dev = (struct net_device *) gpBslctx->hdev; - bt_cb(skb)->pkt_type = HCI_EVENT_PKT; - //skb->protocol = eth_type_trans(skb, skb->dev); - //skb->ip_summed = CHECKSUM_UNNECESSARY; - - // This is my receive skb pointer - gpBslctx->rx_skb = skb; - - // This is how data and events are passed up to BlueZ - hci_recv_frame(gpBslctx->rx_skb); - - return(VOS_STATUS_SUCCESS); -} // WLANBAP_EventCB() - -static VOS_STATUS -WLANBAP_PhyLinkFailure -( - BslClientCtxType* pctx, - v_U8_t phy_link_handle -) -{ - VOS_STATUS vosStatus; - tBtampHCI_Event bapHCIEvent; - - /* Format the Physical Link Complete event to return... */ - bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = WLANBAP_ERROR_UNSPECIFIED_ERROR; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle - = phy_link_handle; - bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number - = 0; - //TBD: Could be a cleaner way to get the PhyLinkCtx handle; For now works - BslPhyLinkCtx[0].pClientCtx = pctx; - vosStatus = WLANBAP_EventCB( &BslPhyLinkCtx[0], &bapHCIEvent, TRUE ); - - return vosStatus; -} - -/** - @brief BslFindAndInitClientCtx() - This function will find and initialize a client - a.k.a app context - - @param pctx : [inout] ptr to the client context - - @return - TRUE if all OK, FALSE otherwise - -*/ -static BOOL BslFindAndInitClientCtx -( - BslClientCtxType** pctx_ -) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - BslClientCtxType* pctx; - v_U8_t i; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslFindAndInitClientCtx" ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,"%s:BslClientLock already inited",__func__); - // return(0); - } - - for ( i=0; i < BSL_MAX_CLIENTS; i++ ) - { - if ( !BslClientCtx[i].used ) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,"%s:BslClientCtx[%d] selected",__func__, i); - BslClientCtx[i].used = TRUE; - break; - } - } - - if ( i == BSL_MAX_CLIENTS ) - { - // no more clients can be supported - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslFindAndInitClientCtx no more " - "clients can be supported MAX=%d", BSL_MAX_CLIENTS ); - return FALSE; - } - - //pctx = BslClientCtx + i; - pctx = gpBslctx; - - // get a handle from BAP - VosStatus = WLANBAP_GetNewHndl(&pctx->bapHdl); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - pctx->used = FALSE; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:WLAN_GetNewHndl Failed",__func__); - - return(FALSE); - } - - // register the event cb with BAP, this cb is used for BOTH association - // specific and non-association specific event notifications by BAP. - // However association specific events will be called with a different - // cookie that is passed in during the physical link create/accept - VosStatus = WLAN_BAPRegisterBAPCallbacks( pctx->bapHdl, WLANBAP_EventCB, pctx ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - pctx->used = FALSE; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:WLAN_BAPRegsiterBAPCallaback Failed",__func__); - - return(FALSE); - } - - // init the PhyLinks queue to keep track of the assoc's of this client - VosStatus = vos_list_init( &pctx->PhyLinks ); - if (VOS_STATUS_SUCCESS != VosStatus) - { - pctx->used = FALSE; - VOS_ASSERT(0); - return(FALSE); - } - - *pctx_ = pctx; - - return(TRUE); -} //BslFindAndInitClientCtx() - -/** - @brief BslReleaseClientCtx() - This function will release a client a.k.a. app - context - - @param pctx : [in] ptr to the client context - - @return - None - -*/ -//#if 0 -static void BslReleaseClientCtx -( - BslClientCtxType* pctx -) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - vos_list_node_t* pLink; - BslPhyLinksNodeType *pPhyNode; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslReleaseClientCtx" ); - - // an app can do this without cleaning up after itself i.e. it can have active associations and - // data pending, we need to cleanup its mess - - // first tell BAP we dont want the handle anymore, BAP will cleanup all the associations and - // consume resulting HCI events, so after this we will not get any HCI events. we will also - // not see any FetchPktCB and RxPktCB. We can still expect TxCompletePktCB - VosStatus = WLANBAP_ReleaseHndl( pctx->bapHdl ); - if (VOS_STATUS_SUCCESS != VosStatus) - { - // just print no action required - VOS_ASSERT(0); - } - - // find and free all of the association contexts belonging to this app - while ( VOS_IS_STATUS_SUCCESS( VosStatus = vos_list_remove_front( &pctx->PhyLinks, &pLink ) ) ) - { - pPhyNode = (BslPhyLinksNodeType *)pLink; - - // since the phy link has already been removed from the list of active - // associations, make sure we dont attempt to do this again - pPhyNode->pPhy->pPhyLinkDescNode = NULL; - - BslReleasePhyCtx( pPhyNode->pPhy ); - } - - VOS_ASSERT( VosStatus == VOS_STATUS_E_EMPTY ); - - // destroy the PhyLinks queue - VosStatus = vos_list_destroy( &pctx->PhyLinks ); - if (VOS_STATUS_SUCCESS != VosStatus) - { - // just print no action required - VOS_ASSERT(0); - } - - pctx->used = FALSE; - -} // BslReleaseClientCtx() -//#endif - -/** - @brief BslInitPhyCtx() - Initialize the Phy Context array. - - - @return - TRUE if all OK, FALSE otherwise - -*/ -static BOOL BslInitPhyCtx (void) -{ - v_U16_t i; - // free PHY context - - for ( i=0; i<BSL_MAX_PHY_LINKS; i++ ) - { - BslPhyLinkCtx[i].used = FALSE; - } - - return (TRUE); -} // BslInitPhyCtx() - - -/** - @brief BslFindAndInitPhyCtx() - This function will try to find a free physical - link a.k.a assocation context and if successful, then init that context - - @param pctx : [in] the client context - @param PhyLinkHdl : [in] the physical link handle chosen by application - @param ppPhyCtx : [inout] ptr to the physical link context - - @return - TRUE if all OK, FALSE otherwise - -*/ -static BOOL BslFindAndInitPhyCtx -( - BslClientCtxType* pctx, - v_U8_t PhyLinkHdl, - BslPhyLinkCtxType** ppPhyCtx -) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - v_U16_t i; - v_U16_t j; - vos_list_node_t* pLink; - BslPhyLinksNodeType *pNode; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslFindAndInitPhyCtx" ); - - for ( i=0; i<BSL_MAX_PHY_LINKS; i++ ) - { - if ( !BslPhyLinkCtx[i].used ) - { - BslPhyLinkCtx[i].used = TRUE; - break; - } - } - - if ( i==BSL_MAX_PHY_LINKS ) - { - return(FALSE); - } - else - { - - // now init this context - - *ppPhyCtx = BslPhyLinkCtx + i; - - // setup a ptr to the app context that this assocation specific context lives in - BslPhyLinkCtx[i].pClientCtx = pctx; - - // Mark as used - (*ppPhyCtx)->used = TRUE; - - // store the PHY link handle - BslPhyLinkCtx[i].PhyLinkHdl = PhyLinkHdl; - - // init the TX queues - for ( j=0; j<WLANTL_MAX_AC; j++ ) - { - hdd_list_init( &BslPhyLinkCtx[i].ACLTxQueue[j], HDD_TX_QUEUE_MAX_LEN ); - } - - // need to add this Phy context to the client list of associations, - // useful during Close operation - - // get a pkt desc - VosStatus = vos_list_remove_front( &BslPhyLinksDescPool, &pLink ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - // this could happen due to pool not being big enough, etc - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslFindAndInitPhyCtx failed to " - "get node from BslPhyLinksDescPool vstatus=%d", VosStatus ); - BslReleasePhyCtx( *ppPhyCtx ); - return FALSE; - } - - // stick the VOS pkt into the node - pNode = (BslPhyLinksNodeType *) pLink; - pNode->node = *pLink; - pNode->pPhy = *ppPhyCtx; - - - // now queue the pkt into the correct queue - VosStatus = vos_list_insert_back( &pctx->PhyLinks, pLink ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT(0); - } - - // need to record the desc for this assocation in the list of - // active assocations in client context to allow cleanup later - (*ppPhyCtx)->pPhyLinkDescNode = pNode; - - return(TRUE); - } -} // BslFindAndInitPhyCtx() - -/** - @brief BslProcessHCICommand() - This function will process an HCI command i.e - take an HCI command buffer, unpack it and then call the appropriate BAP API - - @param pctx : [in] ptr to the client context - @param pBuffer_ : [in] the input buffer containing the HCI command - @param Count_ : [in] size of the HCI command buffer - - @return - TRUE if all OK, FALSE otherwise - -*/ -static BOOL BslProcessHCICommand -( - BslClientCtxType* pctx, - LPCVOID pBuffer_, - DWORD Count_ -) -{ - LPVOID pBuffer = (LPVOID) pBuffer_; // castaway the const-ness of the ptr - v_U16_t Count = (v_U16_t) Count_; // this should be OK max size < 1500 - v_U32_t UnpackStatus; - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - BOOL Status; - BslPhyLinkCtxType* pPhyCtx; - tBtampHCI_Event HCIEvt; - v_U16_t x = 1; - int i = 0; - - // the opcode is in LE, if we are LE too then this is fine else we need some - // byte swapping - v_U16_t cmdOpcode = *(UNALIGNED v_U16_t *)pBuffer; - v_U8_t *pBuf = (v_U8_t *)pBuffer; - v_U8_t *pTmp = (v_U8_t *)pBuf; - - // TODO: do we really need to do this per call even though the op is quite cheap - if(*(v_U8_t *)&x == 0) - { - // BE - cmdOpcode = ( cmdOpcode & 0xFF ) << 8 | ( cmdOpcode & 0xFF00 ) >> 8; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslProcessHCICommand: cmdOpcode = %hx", cmdOpcode ); - - for(i=0; i<4; i++) - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: *pBuf before advancepTmp[%x] = %x", i,pTmp[i] ); - - pBuf+=CMD_TLV_TYPE_AND_LEN_SIZE; - - - switch ( cmdOpcode ) - { - /** BT v3.0 Link Control commands */ - case BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD: - { - tBtampTLVHCI_Create_Physical_Link_Cmd CreatePhysicalLinkCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Create_Physical_Link_Cmd( NULL, - pBuf, Count, &CreatePhysicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Create_Physical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - if(VOS_FALSE == WLANBAP_AmpConnectionAllowed()) - { - VosStatus = WLANBAP_PhyLinkFailure(pctx, CreatePhysicalLinkCmd.phy_link_handle); - if ( VOS_STATUS_SUCCESS != VosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_PhyLinkFailure failed"); - // handle the error - return(FALSE); - } - break; - } - - // setup the per PHY link BAP context - Status = BslFindAndInitPhyCtx( pctx, CreatePhysicalLinkCmd.phy_link_handle, - &pPhyCtx ); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "CreatePhysicalLinkCmd.phy_link_handle=%d",CreatePhysicalLinkCmd.phy_link_handle); - - if ( !Status ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: BslFindAndInitPhyCtx failed"); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPPhysicalLinkCreate( pctx->bapHdl, - &CreatePhysicalLinkCmd, pPhyCtx, &HCIEvt ); - - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkCreate failed status %d", VosStatus); - // handle the error - BslReleasePhyCtx( pPhyCtx ); - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pPhyCtx, &HCIEvt, TRUE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - BslReleasePhyCtx( pPhyCtx ); - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD: - { - tBtampTLVHCI_Accept_Physical_Link_Cmd AcceptPhysicalLinkCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Accept_Physical_Link_Cmd( NULL, - pBuf, Count, &AcceptPhysicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Accept_Physical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - if(VOS_FALSE == WLANBAP_AmpConnectionAllowed()) - { - VosStatus = WLANBAP_PhyLinkFailure(pctx, AcceptPhysicalLinkCmd.phy_link_handle); - if ( VOS_STATUS_SUCCESS != VosStatus ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_PhyLinkFailure failed"); - // handle the error - return(FALSE); - } - break; - } - - // setup the per PHY link BAP context - Status = BslFindAndInitPhyCtx( pctx, AcceptPhysicalLinkCmd.phy_link_handle, - &pPhyCtx ); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "AcceptPhysicalLinkCmd.phy_link_handle=%d",AcceptPhysicalLinkCmd.phy_link_handle); - - if ( !Status ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: BslFindAndInitPhyCtx failed"); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPPhysicalLinkAccept( pctx->bapHdl, - &AcceptPhysicalLinkCmd, pPhyCtx, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkAccept failed status %d", VosStatus); - // handle the error - BslReleasePhyCtx( pPhyCtx ); - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pPhyCtx, &HCIEvt, TRUE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - BslReleasePhyCtx( pPhyCtx ); - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD: - { - tBtampTLVHCI_Disconnect_Physical_Link_Cmd DisconnectPhysicalLinkCmd; - Count = Count - 3;//Type and length field lengths are not needed - pTmp = pBuf; - for(i=0; i<4; i++) - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: *pBuf in Disconnect phy link pTmp[%x] = %x", i,pTmp[i] ); - // unpack - UnpackStatus = btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd( NULL, - pBuf, Count, &DisconnectPhysicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Disconnect_Physical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPPhysicalLinkDisconnect( pctx->bapHdl, - &DisconnectPhysicalLinkCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPPhysicalLinkDisconnect failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD: - { - tBtampTLVHCI_Create_Logical_Link_Cmd CreateLogicalLinkCmd; - Count -= 3; //To send the correct length to unpack event - // unpack - UnpackStatus = btampUnpackTlvHCI_Create_Logical_Link_Cmd( NULL, - pBuf, Count, &CreateLogicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Create_Logical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPLogicalLinkCreate( pctx->bapHdl, - &CreateLogicalLinkCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkCreate failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD: - { - tBtampTLVHCI_Accept_Logical_Link_Cmd AcceptLogicalLinkCmd; - Count = Count - 3;//Subtract Type and Length fields - // unpack - UnpackStatus = btampUnpackTlvHCI_Accept_Logical_Link_Cmd( NULL, - pBuf, Count, &AcceptLogicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Accept_Logical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPLogicalLinkAccept( pctx->bapHdl, - &AcceptLogicalLinkCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkAccept failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD: - { - tBtampTLVHCI_Disconnect_Logical_Link_Cmd DisconnectLogicalLinkCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd( NULL, - pBuf, Count, &DisconnectLogicalLinkCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Disconnect_Logical_Link_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPLogicalLinkDisconnect( pctx->bapHdl, - &DisconnectLogicalLinkCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkDisconnect failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD: - { - tBtampTLVHCI_Logical_Link_Cancel_Cmd LogicalLinkCancelCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Logical_Link_Cancel_Cmd( NULL, - pBuf, Count, &LogicalLinkCancelCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Logical_Link_Cancel_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPLogicalLinkCancel( pctx->bapHdl, - &LogicalLinkCancelCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPLogicalLinkCancel failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD: - { - tBtampTLVHCI_Flow_Spec_Modify_Cmd FlowSpecModifyCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Flow_Spec_Modify_Cmd( NULL, - pBuf, Count, &FlowSpecModifyCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Flow_Spec_Modify_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPFlowSpecModify( pctx->bapHdl, - &FlowSpecModifyCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPFlowSpecModify failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* - Host Controller and Baseband Commands - */ - case BTAMP_TLV_HCI_RESET_CMD: - { - VosStatus = WLAN_BAPReset( pctx->bapHdl ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReset failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_SET_EVENT_MASK_CMD: - { - tBtampTLVHCI_Set_Event_Mask_Cmd SetEventMaskCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Set_Event_Mask_Cmd( NULL, - pBuf, Count, &SetEventMaskCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Event_Mask_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPSetEventMask( pctx->bapHdl, - &SetEventMaskCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetEventMask failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_FLUSH_CMD: - { - tBtampTLVHCI_Flush_Cmd FlushCmd; - - // unpack - UnpackStatus = btampUnpackTlvHCI_Flush_Cmd( NULL, - pBuf, Count, &FlushCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Flush_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - /* Flush the TX queue */ -//#ifdef BAP_DEBUG - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s:HCI Flush command - will flush Tx Queue", __func__); -//#endif //BAP_DEBUG - // JEZ100604: Temporary short cut - pPhyCtx = &BslPhyLinkCtx[0]; - VosStatus = BslFlushTxQueues ( pPhyCtx); - - /* Acknowledge the command */ - VosStatus = WLAN_BAPFlush( pctx->bapHdl, &FlushCmd ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLAN_BAPFlush failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_ENHANCED_FLUSH_CMD: - { - tBtampTLVHCI_Enhanced_Flush_Cmd FlushCmd; - - // unpack - UnpackStatus = btampUnpackTlvHCI_Enhanced_Flush_Cmd( NULL, - pBuf, Count, &FlushCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: btampUnpackTlvHCI_Enhanced_Flush_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - /* Flush the TX queue */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s:HCI Flush command - will flush Tx Queue for pkt type %d", __func__, FlushCmd.packet_type); - // We support BE traffic only - if(WLANTL_AC_BE == FlushCmd.packet_type) - { - pPhyCtx = &BslPhyLinkCtx[0]; - VosStatus = BslFlushTxQueues ( pPhyCtx); - } - - /* Acknowledge the command */ - VosStatus = WLAN_EnhancedBAPFlush( pctx->bapHdl, &FlushCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLAN_EnahncedBAPFlush failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_CONNECTION_ACCEPT_TIMEOUT_CMD: - { - VosStatus = WLAN_BAPReadConnectionAcceptTimeout( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadConnectionAcceptTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_CMD: - { - tBtampTLVHCI_Write_Connection_Accept_Timeout_Cmd WriteConnectionAcceptTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd( NULL, - pBuf, Count, &WriteConnectionAcceptTimeoutCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Connection_Accept_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteConnectionAcceptTimeout( pctx->bapHdl, - &WriteConnectionAcceptTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteConnectionAcceptTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LINK_SUPERVISION_TIMEOUT_CMD: - { - tBtampTLVHCI_Read_Link_Supervision_Timeout_Cmd ReadLinkSupervisionTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd( NULL, - pBuf, Count, &ReadLinkSupervisionTimeoutCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Link_Supervision_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadLinkSupervisionTimeout( pctx->bapHdl, - &ReadLinkSupervisionTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLinkSupervisionTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_LINK_SUPERVISION_TIMEOUT_CMD: - { - tBtampTLVHCI_Write_Link_Supervision_Timeout_Cmd WriteLinkSupervisionTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd( NULL, - pBuf, Count, &WriteLinkSupervisionTimeoutCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Link_Supervision_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteLinkSupervisionTimeout( pctx->bapHdl, - &WriteLinkSupervisionTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLinkSupervisionTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* v3.0 Host Controller and Baseband Commands */ - case BTAMP_TLV_HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD: - { - VosStatus = WLAN_BAPReadLogicalLinkAcceptTimeout( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLogicalLinkAcceptTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CMD: - { - tBtampTLVHCI_Write_Logical_Link_Accept_Timeout_Cmd WriteLogicalLinkAcceptTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd( NULL, - pBuf, Count, &WriteLogicalLinkAcceptTimeoutCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Logical_Link_Accept_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteLogicalLinkAcceptTimeout( pctx->bapHdl, - &WriteLogicalLinkAcceptTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLogicalLinkAcceptTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_SET_EVENT_MASK_PAGE_2_CMD: - { - tBtampTLVHCI_Set_Event_Mask_Page_2_Cmd SetEventMaskPage2Cmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd( NULL, - pBuf, Count, &SetEventMaskPage2Cmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Event_Mask_Page_2_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPSetEventMaskPage2( pctx->bapHdl, - &SetEventMaskPage2Cmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetEventMaskPage2 failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LOCATION_DATA_CMD: - { - VosStatus = WLAN_BAPReadLocationData( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocationData failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_LOCATION_DATA_CMD: - { - tBtampTLVHCI_Write_Location_Data_Cmd WriteLocationDataCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Location_Data_Cmd( NULL, - pBuf, Count, &WriteLocationDataCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Location_Data_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteLocationData( pctx->bapHdl, - &WriteLocationDataCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLocationData failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_FLOW_CONTROL_MODE_CMD: - { - VosStatus = WLAN_BAPReadFlowControlMode( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadFlowControlMode failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_FLOW_CONTROL_MODE_CMD: - { - tBtampTLVHCI_Write_Flow_Control_Mode_Cmd WriteFlowControlModeCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd( NULL, - pBuf, Count, &WriteFlowControlModeCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Flow_Control_Mode_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteFlowControlMode( pctx->bapHdl, - &WriteFlowControlModeCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteFlowControlMode failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_BEST_EFFORT_FLUSH_TIMEOUT_CMD: - { - tBtampTLVHCI_Read_Best_Effort_Flush_Timeout_Cmd ReadBestEffortFlushTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd( NULL, - pBuf, Count, &ReadBestEffortFlushTimeoutCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Best_Effort_Flush_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadBestEffortFlushTimeout( pctx->bapHdl, - &ReadBestEffortFlushTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadBestEffortFlushTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CMD: - { - tBtampTLVHCI_Write_Best_Effort_Flush_Timeout_Cmd WriteBestEffortFlushTimeoutCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd( NULL, - pBuf, Count, &WriteBestEffortFlushTimeoutCmd); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Best_Effort_Flush_Timeout_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteBestEffortFlushTimeout( pctx->bapHdl, - &WriteBestEffortFlushTimeoutCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteBestEffortFlushTimeout failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /** opcode definition for this command from AMP HCI CR D9r4 markup */ - case BTAMP_TLV_HCI_SET_SHORT_RANGE_MODE_CMD: - { - tBtampTLVHCI_Set_Short_Range_Mode_Cmd SetShortRangeModeCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd( NULL, - pBuf, Count, &SetShortRangeModeCmd); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Set_Short_Range_Mode_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPSetShortRangeMode( pctx->bapHdl, - &SetShortRangeModeCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPSetShortRangeMode failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* End of v3.0 Host Controller and Baseband Commands */ - /* - Informational Parameters - */ - case BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD: - { - VosStatus = WLAN_BAPReadLocalVersionInfo( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalVersionInfo failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD: - { - VosStatus = WLAN_BAPReadLocalSupportedCmds( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalSupportedCmds failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD: - { - VosStatus = WLAN_BAPReadBufferSize( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadBufferSize failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* v3.0 Informational commands */ - case BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD: - { - VosStatus = WLAN_BAPReadDataBlockSize( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadDataBlockSize failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* - Status Parameters - */ - case BTAMP_TLV_HCI_READ_FAILED_CONTACT_COUNTER_CMD: - { - tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd ReadFailedContactCounterCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd( NULL, - pBuf, Count, &ReadFailedContactCounterCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Failed_Contact_Counter_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadFailedContactCounter( pctx->bapHdl, - &ReadFailedContactCounterCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadFailedContactCounter failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_RESET_FAILED_CONTACT_COUNTER_CMD: - { - tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd ResetFailedContactCounterCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd( NULL, - pBuf, Count, &ResetFailedContactCounterCmd); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Reset_Failed_Contact_Counter_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPResetFailedContactCounter( pctx->bapHdl, - &ResetFailedContactCounterCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPResetFailedContactCounter failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD: - { - tBtampTLVHCI_Read_Link_Quality_Cmd ReadLinkQualityCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Link_Quality_Cmd( NULL, - pBuf, Count, &ReadLinkQualityCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Link_Quality_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadLinkQuality( pctx->bapHdl, - &ReadLinkQualityCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLinkQuality failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_RSSI_CMD: - { - tBtampTLVHCI_Read_RSSI_Cmd ReadRssiCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_RSSI_Cmd( NULL, - pBuf, Count, &ReadRssiCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_RSSI_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadRSSI( pctx->bapHdl, - &ReadRssiCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadRSSI failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD: - { - tBtampTLVHCI_Read_Local_AMP_Information_Cmd ReadLocalAmpInformationCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd( NULL, - pBuf, Count, &ReadLocalAmpInformationCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Local_AMP_Information_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadLocalAMPInfo( pctx->bapHdl, - &ReadLocalAmpInformationCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalAMPInfo failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD: - { - tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd ReadLocalAmpAssocCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd( NULL, - pBuf, Count, &ReadLocalAmpAssocCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Local_AMP_Assoc_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadLocalAMPAssoc( pctx->bapHdl, - &ReadLocalAmpAssocCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLocalAMPAssoc failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD: - { - tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd WriteRemoteAmpAssocCmd; - // unpack - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: HCI_Write_Remote_AMP_ASSOC_Cmd Count = %d", Count); - DUMPLOG(1, __func__, "HCI_Write_Remote_AMP_ASSOC cmd", - pBuf, - Count); - - UnpackStatus = btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd( NULL, - pBuf, Count, &WriteRemoteAmpAssocCmd ); - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WriteRemoteAmpAssocCmd.amp_assoc_remaining_length = %d", - WriteRemoteAmpAssocCmd.amp_assoc_remaining_length - ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Remote_AMP_ASSOC_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - -//#define BAP_UNIT_TEST -#ifdef BAP_UNIT_TEST - { - unsigned char test_amp_assoc_fragment[] = - { - 0x01, 0x00, 0x06, 0x00, 0x00, 0xde, 0xad, 0xbe, - 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x0c, 0x00, 0x55, 0x53, 0x20, 0xc9, 0x0c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x55, 0x53, - 0x20, 0xc9, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, - 0x00, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 - }; - WriteRemoteAmpAssocCmd.present = 1; - WriteRemoteAmpAssocCmd.phy_link_handle = 1; - WriteRemoteAmpAssocCmd.length_so_far = 0; - WriteRemoteAmpAssocCmd.amp_assoc_remaining_length = 74; - /* Set the amp_assoc_fragment to the right values of MAC addr and - * channels - */ - vos_mem_copy( - WriteRemoteAmpAssocCmd.amp_assoc_fragment, - test_amp_assoc_fragment, - sizeof( test_amp_assoc_fragment)); - - } -#endif - - VosStatus = WLAN_BAPWriteRemoteAMPAssoc( pctx->bapHdl, - &WriteRemoteAmpAssocCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteRemoteAMPAssoc failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - /* - Debug Commands - */ - case BTAMP_TLV_HCI_READ_LOOPBACK_MODE_CMD: - { - tBtampTLVHCI_Read_Loopback_Mode_Cmd ReadLoopbackModeCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Read_Loopback_Mode_Cmd( NULL, - pBuf, Count, &ReadLoopbackModeCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Read_Loopback_Mode_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPReadLoopbackMode( pctx->bapHdl, - &ReadLoopbackModeCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPReadLoopbackMode failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_WRITE_LOOPBACK_MODE_CMD: - { - tBtampTLVHCI_Write_Loopback_Mode_Cmd WriteLoopbackModeCmd; - // unpack - UnpackStatus = btampUnpackTlvHCI_Write_Loopback_Mode_Cmd( NULL, - pBuf, Count, &WriteLoopbackModeCmd ); - - if ( !BTAMP_SUCCEEDED( UnpackStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: btampUnpackTlvHCI_Write_Loopback_Mode_Cmd failed status %d", UnpackStatus); - // handle the error - return(FALSE); - } - - VosStatus = WLAN_BAPWriteLoopbackMode( pctx->bapHdl, - &WriteLoopbackModeCmd, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPWriteLoopbackMode failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_0: - { - VosStatus = WLAN_BAPVendorSpecificCmd0( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPVendorSpecificCmd0 failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - case BTAMP_TLV_HCI_VENDOR_SPECIFIC_CMD_1: - { - VosStatus = WLAN_BAPVendorSpecificCmd1( pctx->bapHdl, &HCIEvt ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLAN_BAPVendorSpecificCmd1 failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - break; - } - default: - { - /* Unknow opcode. Return a command status event...with "Unknown Opcode" status */ - - /* Format the command status event to return... */ - HCIEvt.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT; - HCIEvt.u.btampCommandStatusEvent.present = 1; - HCIEvt.u.btampCommandStatusEvent.status = WLANBAP_ERROR_UNKNOWN_HCI_CMND; - HCIEvt.u.btampCommandStatusEvent.num_hci_command_packets = 1; - HCIEvt.u.btampCommandStatusEvent.command_opcode - = cmdOpcode; - - // this may look strange as this is the function registered - // with BAP for the EventCB but we are also going to use it - // as a helper function. The difference is that this invocation - // runs in HCI command sending caller context while the callback - // will happen in BAP's context whatever that may be - VosStatus = WLANBAP_EventCB( pctx, &HCIEvt, FALSE ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BslProcessHCICommand: WLANBAP_EventCB failed status %d", VosStatus); - // handle the error - return(FALSE); - } - - - break; - } - } - - return(TRUE); -} // BslProcessHCICommand() - - -/** - @brief BslProcessACLDataTx() - This function will process an egress ACL data packet - - @param pctx : [in] ptr to the client context - @param pBuffer_ : [in] ptr to the buffer containing the ACL data packet - @param pCount : [in] size of the ACL data packet buffer - - @return - TRUE if all OK, FALSE otherwise - -*/ -#define BTAMP_USE_VOS_WRAPPER -//#undef BTAMP_USE_VOS_WRAPPER -#ifdef BTAMP_USE_VOS_WRAPPER -static BOOL BslProcessACLDataTx -( - BslClientCtxType* pctx, - struct sk_buff *skb, - v_SIZE_t* pCount -) -#else -static BOOL BslProcessACLDataTx -( - BslClientCtxType* pctx, - LPCVOID pBuffer_, - v_SIZE_t* pCount -) -#endif -{ -#ifndef BTAMP_USE_VOS_WRAPPER - LPVOID pBuffer = (LPVOID) pBuffer_; // castaway const-ness of ptr -#endif - BOOL findPhyStatus; - BslPhyLinkCtxType* pPhyCtx; - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - WLANTL_ACEnumType Ac; - hdd_list_node_t* pLink; - BslTxListNodeType *pNode; - v_SIZE_t ListSize; - // I will access the skb in a VOSS packet -#ifndef BTAMP_USE_VOS_WRAPPER - struct sk_buff *skb; -#endif -#if 0 - static int num_packets; -#endif - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BslProcessACLDataTx" ); - - // need to find the PHY link for this ACL data pkt based on phy_link_handle - // TODO need some endian-ness check? - ////findPhyStatus = BslFindPhyCtx( pctx, *(v_U8_t *)skb->data, &pPhyCtx ); - //findPhyStatus = BslFindPhyCtx( pctx, *(v_U8_t *)pBuffer, &pPhyCtx ); - // JEZ100604: Temporary short cut - pPhyCtx = &BslPhyLinkCtx[0]; - findPhyStatus = VOS_TRUE; - - if ( findPhyStatus ) - { - //Use the skb->cb field to hold the list node information - pNode = (BslTxListNodeType *) &skb->cb; - - // This list node info includes the VOS pkt - pNode->skb = skb; - - // stick the SKB into the node - pLink = (hdd_list_node_t *) pNode; - VosStatus = WLANBAP_GetAcFromTxDataPkt(pctx->bapHdl, skb->data, &Ac); - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx WLANBAP_GetAcFromTxDataPkt " - "failed status =%d", VosStatus ); - - Ac = WLANTL_AC_BE; - } - - // now queue the pkt into the correct queue - // We will want to insert a node of type BslTxListNodeType (was going to be vos_pkt_list_node_t) - spin_lock_bh(&pPhyCtx->ACLTxQueue[Ac].lock); - VosStatus = hdd_list_insert_back( &pPhyCtx->ACLTxQueue[Ac], pLink ); - spin_unlock_bh(&pPhyCtx->ACLTxQueue[Ac].lock); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT(0); - } - - // determine if there is a need to signal TL through BAP - hdd_list_size( &pPhyCtx->ACLTxQueue[Ac], &ListSize ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_ASSERT(0); - } - - if ( ListSize == 1 ) - { - // Let TL know we have a packet to send for this AC - VosStatus = WLANBAP_STAPktPending( pctx->bapHdl, pPhyCtx->PhyLinkHdl, Ac ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx WLANBAP_STAPktPending " - "failed status =%d", VosStatus ); - VOS_ASSERT(0); - } - } - - return(TRUE); - } - else - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BslProcessACLDataTx attempting to send " - "data for a non-existant assocation" ); - - return(FALSE); - } - - -} // BslProcessACLDataTx() - - -static inline void *hci_get_drvdata(struct hci_dev *hdev) -{ - return hdev->driver_data; -} - -static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) -{ - hdev->driver_data = data; -} - -/*--------------------------------------------------------------------------- - * Function definitions - *-------------------------------------------------------------------------*/ - -/**--------------------------------------------------------------------------- - - \brief BSL_Init() - Initialize the BSL Misc char driver - - This is called in vos_open(), right after WLANBAP_Open(), as part of - bringing up the BT-AMP PAL (BAP) - vos_open() will pass in the VOS context. In which a BSL context can be created. - - \param - NA - - \return - 0 for success non-zero for failure - - --------------------------------------------------------------------------*/ -//int BSL_Init (void *pCtx) -int BSL_Init ( v_PVOID_t pvosGCtx ) -{ - BslClientCtxType* pctx = NULL; - ptBtampHandle bapHdl = NULL; // our handle in BAP - //ptBtampContext pBtampCtx = NULL; - int err = 0; - struct hci_dev *hdev = NULL; - //struct net_device *dev = NULL; // Our parent wlan network device - hdd_adapter_t *pAdapter = NULL; // Used to retrieve the parent WLAN device - hdd_context_t *pHddCtx = NULL; - hdd_config_t *pConfig = NULL; - hdd_adapter_list_node_t *pAdapterNode = NULL; - VOS_STATUS status; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Init"); - - /*------------------------------------------------------------------------ - Allocate (and sanity check?!) BSL control block - ------------------------------------------------------------------------*/ - //vos_alloc_context(pvosGCtx, VOS_MODULE_ID_BSL, (v_VOID_t**)&pctx, sizeof(BslClientCtxType)); - pctx = &BslClientCtx[0]; - - bapHdl = vos_get_context( VOS_MODULE_ID_BAP, pvosGCtx); - if ( NULL == bapHdl ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BAP pointer from pvosGCtx on BSL_Init"); - return VOS_STATUS_E_FAULT; - } - // Save away the btamp (actually the vos) context - gpCtx = pvosGCtx; - - /* Save away the pointer to the BT-AMP PAL context in the BSL driver context */ - pctx->bapHdl = bapHdl; - - /* Save away the pointer to the BSL driver context in a global (fix this) */ - gpBslctx = pctx; - - /* Initialize all the Phy Contexts to un-used */ - BslInitPhyCtx(); - - /* Initialize the Rx fields in the HCI driver context */ - //pctx->rx_state = RECV_WAIT_PACKET_TYPE; - pctx->rx_count = 0; - pctx->rx_skb = NULL; - - /* JEZ100713: Temporarily the Tx skb queue will have depth one.*/ - // Don't disturb tx_skb - //pctx->tx_skb = NULL; - //pctx->tx_skb = alloc_skb(WLANBAP_MAX_80211_PAL_PDU_SIZE+12, GFP_ATOMIC); - - pctx->hdev = NULL; - //Get the HDD context. - pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, pvosGCtx ); - if(NULL != pHddCtx) - { - pConfig = pHddCtx->cfg_ini; - } - if(NULL == pConfig) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Didn't register as HCI device"); - return 0; - } - else if(0 == pConfig->enableBtAmp) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, - "Didn't register as HCI device, user option(gEnableBtAmp) is set to 0"); - return 0; - } - - if (VOS_STA_SAP_MODE == hdd_get_conparam()) - { - status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); - if ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) - { - if ( WLAN_HDD_SOFTAP == pAdapterNode->pAdapter->device_mode) - { - pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); - } - else if (WLAN_HDD_P2P_GO == pAdapterNode->pAdapter->device_mode) - { - pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_GO); - } - } - } - else - pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); - - - if ( NULL == pAdapter ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid HDD Adapter pointer from pvosGCtx on BSL_Init"); - return VOS_STATUS_E_FAULT; - } - - /* Save away the pointer to the parent WLAN device in BSL driver context */ - pctx->p_dev = pAdapter->dev; - - /* Initialize HCI device */ - hdev = hci_alloc_dev(); - if (!hdev) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Can't allocate HCI device in BSL_Init"); - return VOS_STATUS_E_FAULT; - } - - /* Save away the HCI device pointer in the BSL driver context */ - pctx->hdev = hdev; - -#if defined HCI_80211 || defined HCI_AMP -#define BUILD_FOR_BLUETOOTH_NEXT_2_6 -#else -#undef BUILD_FOR_BLUETOOTH_NEXT_2_6 -#endif - -#ifdef BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* HCI "bus type" of HCI_VIRTUAL should apply */ - hdev->bus = HCI_VIRTUAL; - /* Set the dev_type to BT-AMP 802.11 */ -#ifdef HCI_80211 - hdev->dev_type = HCI_80211; -#else - hdev->dev_type = HCI_AMP; -#endif -#ifdef FEATURE_WLAN_BTAMP_UT - /* For the "real" BlueZ build, DON'T Set the device "quirks" to indicate RAW */ - set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); -#endif -#else //BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* HCI "bus type" of HCI_VIRTUAL should apply */ - hdev->type = HCI_VIRTUAL; - /* Set the dev_type to BT-AMP 802.11 */ - //hdev->dev_type = HCI_80211; - ////hdev->dev_type = HCI_AMP; - /* For the "temporary" BlueZ build, Set the device "quirks" to indicate RAW */ - set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); -#endif //BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* Save away the BSL driver pointer in the HCI device context */ - - hci_set_drvdata(hdev, pctx); - /* Set the parent device for this HCI device. This is our WLAN net_device */ - SET_HCIDEV_DEV(hdev, &pctx->p_dev->dev); - - hdev->open = BSL_Open; - hdev->close = BSL_Close; - hdev->flush = BSL_Flush; - hdev->send = BSL_Write; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) - hdev->destruct = BSL_Destruct; - hdev->owner = THIS_MODULE; -#endif - hdev->ioctl = BSL_IOControl; - - - /* Timeout before it is safe to send the first HCI packet */ - msleep(1000); - - /* Register HCI device */ - err = hci_register_dev(hdev); - if (err < 0) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Unable to register HCI device, err=%d", err); - pctx->hdev = NULL; - hci_free_dev(hdev); - return -ENODEV; - } - - pHddCtx->isAmpAllowed = VOS_TRUE; - return 0; -} // BSL_Init() - -/**--------------------------------------------------------------------------- - - \brief BSL_Deinit() - De-initialize the BSL Misc char driver - - This is called in by WLANBAP_Close() as part of bringing down the BT-AMP PAL (BAP) - - \param - NA - - \return - 0 for success non-zero for failure - - --------------------------------------------------------------------------*/ - -int BSL_Deinit( v_PVOID_t pvosGCtx ) -{ - //int err = 0; - struct hci_dev *hdev; - BslClientCtxType* pctx = NULL; - - //pctx = vos_get_context( VOS_MODULE_ID_BSL, pvosGCtx); - pctx = gpBslctx; - - if ( NULL == pctx ) - { - //VOS_TRACE( VOS_MODULE_ID_BSL, VOS_TRACE_LEVEL_ERROR, - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pvosGCtx on BSL_Init"); - return VOS_STATUS_E_FAULT; - } - - /* Retrieve the HCI device pointer from the BSL driver context */ - hdev = pctx->hdev; - - if (!hdev) - return 0; - - /* hci_unregister_dev is called again here, in case user didn't call it */ - /* Unregister device from BlueZ; fcn sends us HCI commands before it returns */ - /* And then the registered hdev->close fcn should be called by BlueZ (BSL_Close) */ - hci_unregister_dev(hdev); - /* BSL_Close is called again here, in case BlueZ didn't call it */ - BSL_Close(hdev); - hci_free_dev(hdev); - pctx->hdev = NULL; - - return 0; -} // BSL_Deinit() - - -/** - @brief BSL_Open() - This function opens a device for reading, and writing. - An application indirectly invokes this function when it calls the fopen() - system call to open a special device file names. - - @param *hdev : [in] pointer to the open HCI device structure. - BSL_Init (Device Manager) function creates and stores this HCI - device context in the BSL context. - - @return - This function returns a status code. Negative codes are failures. - - NB: I don't seem to be following this convention. -*/ -//static int BSL_Open(struct inode *pInode, struct file *pFile) -static int BSL_Open( struct hci_dev *hdev ) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - BslClientCtxType* pctx = (BslClientCtxType *)(hci_get_drvdata(hdev)); - v_U16_t i; - BOOL rval; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Open"); - - /* you can only open a btamp device one time */ - if (bBslInited) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "BSL_Open: Already Opened."); - return -EPERM; /* Operation not permitted */ - } - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSLClientLock already inited"); - // return -EIO; /* I/O error */ - return 0; - } - - VosStatus = vos_list_init( &BslPhyLinksDescPool ); - - if ( !VOS_IS_STATUS_SUCCESS( VosStatus ) ) - { - //return -EIO; /* I/O error */ - return 0; - } - - // now we need to populate this pool with the free pkt desc from the array - for ( i=0; i<BSL_MAX_PHY_LINKS; i++ ) - { - VosStatus = vos_list_insert_front( &BslPhyLinksDescPool, &BslPhyLinksDesc[i].node ); - if (VOS_STATUS_SUCCESS != VosStatus) - { - VOS_ASSERT(0); - return 0; - } - } - - // This is redundent. See the check above on (fp->private_data != NULL) - bBslInited = TRUE; - - rval = BslFindAndInitClientCtx( &pctx ); - - if(rval != TRUE) - { - // Where is the clean-up in case the above BslFindAndInitClientCtx() call - // fails? - //return -EIO; /* I/O error */ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSLFindAndInitClientContext failed"); - return 0; - } - - - /* Let Linux fopen() know everything is all right */ - return 0; -} // BSL_Open() - -/** - @brief BSL_Close() - This function closes a device context created by - BSL_Open(). May be called more than once during AMP PAL shut down. - - @param *hdev : [in] pointer to the open HCI device structure. - BSL_Init (Device Manager) function creates and stores this HCI - device context in the BSL context. - - @return - TRUE indicates success. FALSE indicates failure. -*/ -//static int BSL_Close (struct inode *pInode, struct file *pFile) -static int BSL_Close ( struct hci_dev *hdev ) -{ - VOS_STATUS VosStatus = VOS_STATUS_SUCCESS; - BslClientCtxType* pctx; - vos_list_node_t* pLink; - v_U16_t i; - v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); - hdd_context_t *pHddCtx; - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Close"); - if (NULL != pVosContext) - { - pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); - if (NULL != pHddCtx) - { - pHddCtx->isAmpAllowed = VOS_FALSE; - } - } - - // it may seem there is some risk here because we are using a value - // passed into us as a pointer. what if this pointer is 0 or points to - // someplace bad? as it turns out the caller is device manager and not - // the application. kernel should trap such invalid access but we will check - // for NULL pointer - if ( hdev == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Close: NULL hdev specified"); - return FALSE; - } - - pctx = (BslClientCtxType *)(hci_get_drvdata(hdev)); - - if ( pctx == NULL || !bBslInited) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_LOW, "BSL_Close: %s is not open", hdev->name); - return TRUE; - } - - // need to cleanup any per PHY state and the common RX state - BslReleaseClientCtx( pctx ); - for ( i=0; i<BslPhyLinksDescPool.count; i++ ) - { - VosStatus = vos_list_remove_front( &BslPhyLinksDescPool, &pLink ); - //nothing to free as the nodes came from BslPhyLinksDesc, which is a static - //this is needed to allow vos_list_destroy() to go through - } - VosStatus = vos_list_destroy( &BslPhyLinksDescPool ); - - if (VOS_STATUS_SUCCESS != VosStatus) - { - VOS_ASSERT(0); - return FALSE; - } - - bBslInited = FALSE; - -// The next line is temporary - return(0); -} //BSL_Close() - -/** - @brief BSL_IOControl() - This function sends a command to a device. - - @param *hdev : [in] pointer to the open HCI device structure. - @param cmd : [in] I/O control operation to perform. These codes are - device-specific and are usually exposed to developers through a header file. - @param arg : [in] Additional input parameter. - - @return - TRUE indicates success. FALSE indicates failure. -*/ -//static long BSL_IOControl(struct file *pFile, unsigned int cmd, unsigned long arg) -static int BSL_IOControl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) -{ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_IOControl - not supported"); - return(TRUE); -} // BSL_IOControl() - -/** - @brief BSL_Flush() - This function flushes all pending commands on a device. - - @param *hdev : [in] pointer to the open HCI device structure. - - @return - TRUE indicates success. FALSE indicates failure. -*/ -static int BSL_Flush(struct hci_dev *hdev) -{ - VOS_STATUS VosStatus; - BslPhyLinkCtxType* pPhyCtx; - - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Flush - will flush ALL Tx Queues"); - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s - will flush ALL Tx Queues", __func__); - - /* Flush the TX queue */ - // JEZ100604: Temporary short cut - pPhyCtx = &BslPhyLinkCtx[0]; - - VosStatus = BslFlushTxQueues ( pPhyCtx); - - //return(TRUE); - return(0); -} // BSL_Flush() - -/** - @brief BSL_Destruct() - This function destroys an HCI device. - - @param *hdev : [in] pointer to the open HCI device structure. - - @return - TRUE indicates success. FALSE indicates failure. -*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) -static void BSL_Destruct(struct hci_dev *hdev) -{ - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "BSL_Destruct - not supported"); - return; //(TRUE); -} // BSL_Destruct() -#endif - - -/** - @brief BSL_Write() - This function writes data to the device. - An application indirectly invokes this function when it calls the fwrite() - system call to write to a special device file. - - @param *skb : [in] pointer to the skb being transmitted. This skb contains - the HCI command or HCI data. Also a pointer (hdev) to the HCI device struct - - @return - The number of bytes written indicates success. - Negative values indicate various failures. -*/ -//static ssize_t BSL_Write(struct file *pFile, const char __user *pBuffer, -// size_t Count, loff_t *pOff) -static int BSL_Write(struct sk_buff *skb) -{ - struct hci_dev *hdev; - BslClientCtxType* pctx; - v_SIZE_t written = 0; - BOOL status; - //char *bslBuff = NULL; - BslHciWorkStructure *pHciContext; - - //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s", __func__); - - // Sanity check inputs - if ( skb == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is bad i/p", __func__); - //return -EFAULT; /* Bad address */ - return 0; - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Count (skb->len)=%d", __func__, skb->len); - - // Sanity check inputs - if ( 0 == skb->len ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is empty", __func__); - //return -EFAULT; /* Bad address */ - return 0; - } - - hdev = (struct hci_dev *)(skb->dev); - - // Sanity check the HCI device in the skb - if ( hdev == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Frame for Unknown HCI device (hdev=NULL)", __func__); - //return -ENODEV; /* no device */ - return 0; - } - - pctx = (BslClientCtxType *)hci_get_drvdata(hdev); - - // Sanity check inputs - if ( pctx == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx is bad i/p", __func__); - //return -EFAULT; /* Bad address */ - return 0; - /* Maybe I should return "no device" */ - //return -ENODEV; /* no device */ - } - - // Switch for each case of packet type - switch (bt_cb(skb)->pkt_type) - { - case HCI_ACLDATA_PKT: - // Directly execute the data write - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: HCI ACL data tx, skb=%p", - __func__, skb); - // ACL data - hdev->stat.acl_tx++; - // Correct way of doing this... - written = skb->len; -#ifdef BTAMP_USE_VOS_WRAPPER - status = BslProcessACLDataTx( pctx, skb, &written ); -#else - status = BslProcessACLDataTx( pctx, skb->data, &written ); - // Free up the skb - kfree_skb(skb); -#endif //BTAMP_USE_VOS_WRAPPER - break; - case HCI_COMMAND_PKT: - // Defer the HCI command writes - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HCI command", __func__); - hdev->stat.cmd_tx++; - - // Allocate an HCI context. To use as a "container" for the "work" to be deferred. - pHciContext = kmalloc(sizeof(*pHciContext), GFP_ATOMIC); - if (NULL == pHciContext) - { - // no memory for HCI context. Nothing we can do but drop - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "%s: Unable to allocate context", __func__); - kfree_skb(skb); - return 0; - } - - // save away the tx skb in the HCI context...so it can be - // retrieved by the work procedure. - pHciContext->tx_skb = skb; - // save away the pctx context...so it can be retrieved by the work procedure. - pHciContext->pctx = pctx; - pHciContext->magic = BT_AMP_HCI_CTX_MAGIC; -#ifdef CONFIG_CNSS - cnss_init_work(&pHciContext->hciInterfaceProcessing, - bslWriteFinish); -#else - INIT_WORK(&pHciContext->hciInterfaceProcessing, - bslWriteFinish); -#endif - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: Scheduling work for skb %p, BT-AMP Client context %p, work %p", - __func__, skb, pctx, pHciContext); - - status = schedule_work(&pHciContext->hciInterfaceProcessing); - - // Check result - if ( 0 == status ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: hciInterfaceProcessing work already queued. This should never happen.", __func__); - } - - - // Temporary way of doing this - //written = skb->len-CMD_TLV_TYPE_AND_LEN_SIZE; - written = skb->len; - break; - case HCI_SCODATA_PKT: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: unknown type", __func__); - hdev->stat.sco_tx++; - // anything else including HCI events and SCO data - status = FALSE; - // Free up the skb - kfree_skb(skb); - break; - default: - // anything else including HCI events and SCO data - status = FALSE; - // Free up the skb - kfree_skb(skb); - break; - }; - - - // JEZ100809: For the HCI command, will the caller need to wait until the work takes place and - // return the ACTUAL amount of data written. - -// The next line is temporary - //written = skb->len; - return(written); -} // BSL_Write() - -/** - @brief bslWriteFinish() - This function finished the writes operation - started by BSL_Write(). - - @param work : [in] pointer to work structure - - @return : void - -*/ -static void bslWriteFinish(struct work_struct *work) -{ - //BslClientCtxType* pctx = - // container_of(work, BslClientCtxType, hciInterfaceProcessing); - BslHciWorkStructure *pHciContext = - container_of(work, BslHciWorkStructure, hciInterfaceProcessing); - BslClientCtxType* pctx = pHciContext->pctx; - VOS_STATUS status; - struct sk_buff *skb; - struct hci_dev *hdev; - //char *bslBuff = NULL; - v_SIZE_t written = 0; - - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "%s: Entered, context %p", - __func__, pctx); - - // Sanity check inputs - if ( pctx == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx is bad i/p", __func__); - return; // -EFAULT; /* Bad address */ - } - - //skb = pctx->tx_skb; - skb = pHciContext->tx_skb; - kfree( pHciContext); - - // Sanity check inputs - if ( skb == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: skb is bad i/p", __func__); - return; // -EFAULT; /* Bad address */ - } - - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Count (skb->len)=%d", __func__, skb->len); - - hdev = (struct hci_dev *)(skb->dev); - - // Sanity check the HCI device in the skb - if ( hdev == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Frame for Unknown HCI device (hdev=NULL)", __func__); - return; // -ENODEV; /* no device */ - } - - - // Sanity check inputs - if ( pctx != (BslClientCtxType *)hci_get_drvdata(hdev)); - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: pctx and hdev not consistent - bad i/p", __func__); - return; // -EFAULT; /* Bad address */ - /* Maybe I should return "no device" */ - //return -ENODEV; /* no device */ - } - - // Switch for each case of packet type - switch (bt_cb(skb)->pkt_type) - { - case HCI_COMMAND_PKT: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HCI command", __func__); - hdev->stat.cmd_tx++; - // HCI command - status = BslProcessHCICommand( pctx, skb->data, skb->len-CMD_TLV_TYPE_AND_LEN_SIZE); - // Temporary way of doing this - //written = skb->len-CMD_TLV_TYPE_AND_LEN_SIZE; - written = skb->len; - break; - case HCI_SCODATA_PKT: - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: unknown type", __func__); - hdev->stat.sco_tx++; - // anything else including HCI events and SCO data - status = FALSE; - break; - default: - // anything else including HCI events and SCO data - status = FALSE; - break; - }; - - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: Freeing skb %p", - __func__, skb); - - consume_skb(skb); - -// How do I return the actual number of bytes written to the caller? -// return(written); - return; -} //bslWriteFinish() - -VOS_STATUS WLANBAP_SetConfig -( - WLANBAP_ConfigType *pConfig -) -{ - BslClientCtxType* pctx; - VOS_STATUS status; - // sanity checking - if ( pConfig == NULL ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig bad input" ); - return VOS_STATUS_E_FAILURE; - } - pctx = gpBslctx; - if ( NULL == pctx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pctx on WLANBAP_SetConfig"); - return VOS_STATUS_E_FAULT; - } - - // get a handle from BAP - status = WLANBAP_GetNewHndl(&pctx->bapHdl); - if ( !VOS_IS_STATUS_SUCCESS( status ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig can't get BAP handle" ); - return VOS_STATUS_E_FAILURE; - } - - - status = WLAN_BAPSetConfig(pctx->bapHdl, pConfig); - if ( !VOS_IS_STATUS_SUCCESS( status ) ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_SetConfig can't set BAP config" ); - return VOS_STATUS_E_FAILURE; - } - - return(VOS_STATUS_SUCCESS); -} - -VOS_STATUS WLANBAP_RegisterWithHCI(hdd_adapter_t *pAdapter) -{ - struct hci_dev *hdev = NULL; - BslClientCtxType* pctx = NULL; - int err = 0; - v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); - hdd_context_t *pHddCtx; - - pctx = gpBslctx; - - if ( NULL == pctx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pctx on WLANBAP_RegisterWithHCI"); - return VOS_STATUS_E_FAULT; - } - if ( NULL == pAdapter ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid HDD Adapter pointer from pvosGCtx on WLANBAP_RegisterWithHCI"); - return VOS_STATUS_E_FAULT; - } - - if(NULL != pctx->hdev) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_WARN, - "Already registered as HCI device"); - return VOS_STATUS_SUCCESS; - } - - - - /* Save away the pointer to the parent WLAN device in BSL driver context */ - pctx->p_dev = pAdapter->dev; - - /* Initialize HCI device */ - hdev = hci_alloc_dev(); - if (!hdev) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Can't allocate HCI device in WLANBAP_RegisterWithHCI"); - return VOS_STATUS_E_FAULT; - } - - /* Save away the HCI device pointer in the BSL driver context */ - pctx->hdev = hdev; - -#if defined HCI_80211 || defined HCI_AMP -#define BUILD_FOR_BLUETOOTH_NEXT_2_6 -#else -#undef BUILD_FOR_BLUETOOTH_NEXT_2_6 -#endif - -#ifdef BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* HCI "bus type" of HCI_VIRTUAL should apply */ - hdev->bus = HCI_VIRTUAL; - /* Set the dev_type to BT-AMP 802.11 */ -#ifdef HCI_80211 - hdev->dev_type = HCI_80211; -#else - hdev->dev_type = HCI_AMP; -#endif -#ifdef FEATURE_WLAN_BTAMP_UT - /* For the "real" BlueZ build, DON'T Set the device "quirks" to indicate RAW */ - set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); -#endif -#else //BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* HCI "bus type" of HCI_VIRTUAL should apply */ - hdev->type = HCI_VIRTUAL; - /* Set the dev_type to BT-AMP 802.11 */ - //hdev->dev_type = HCI_80211; - ////hdev->dev_type = HCI_AMP; - /* For the "temporary" BlueZ build, Set the device "quirks" to indicate RAW */ - set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); -#endif //BUILD_FOR_BLUETOOTH_NEXT_2_6 - /* Save away the BSL driver pointer in the HCI device context */ - hci_set_drvdata(hdev, pctx); - /* Set the parent device for this HCI device. This is our WLAN net_device */ - SET_HCIDEV_DEV(hdev, &pctx->p_dev->dev); - - hdev->open = BSL_Open; - hdev->close = BSL_Close; - hdev->flush = BSL_Flush; - hdev->send = BSL_Write; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) - hdev->owner = THIS_MODULE; - hdev->destruct = BSL_Destruct; -#endif - hdev->ioctl = BSL_IOControl; - - - /* Timeout before it is safe to send the first HCI packet */ - msleep(1000); - - /* Register HCI device */ - err = hci_register_dev(hdev); - if (err < 0) - { - VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Unable to register HCI device, err=%d", err); - pctx->hdev = NULL; - hci_free_dev(hdev); - return VOS_STATUS_E_FAULT; - } - if (NULL != pVosContext) - { - pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); - if (NULL != pHddCtx) - { - pHddCtx->isAmpAllowed = VOS_TRUE; - } - } - - return VOS_STATUS_SUCCESS; -} - -VOS_STATUS WLANBAP_DeregisterFromHCI(void) -{ - struct hci_dev *hdev; - BslClientCtxType* pctx = NULL; - - pctx = gpBslctx; - - if ( NULL == pctx ) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pvosGCtx on WLANBAP_DeregisterFromHCI"); - return VOS_STATUS_E_FAULT; - } - - /* Retrieve the HCI device pointer from the BSL driver context */ - hdev = pctx->hdev; - - if (!hdev) - return VOS_STATUS_E_FAULT; - - /* Unregister device from BlueZ; fcn sends us HCI commands before it returns */ - /* And then the registered hdev->close fcn should be called by BlueZ (BSL_Close) */ - hci_unregister_dev(hdev); - - /* BSL_Close is called again here, in case BlueZ didn't call it */ - BSL_Close(hdev); - hci_free_dev(hdev); - pctx->hdev = NULL; - - return VOS_STATUS_SUCCESS; -} - -VOS_STATUS WLANBAP_StopAmp(void) -{ - BslClientCtxType* pctx; - VOS_STATUS status = VOS_STATUS_SUCCESS; - - pctx = gpBslctx; - - if(NULL == pctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pvosGCtx on WLANBAP_StopAmp"); - status = VOS_STATUS_E_FAULT; - } - else - { - //is AMP session on, if so disconnect - if(VOS_TRUE == WLAN_BAPSessionOn(pctx->bapHdl)) - { - status = WLAN_BAPDisconnect(pctx->bapHdl); - } - } - return status; -} - -v_BOOL_t WLANBAP_AmpSessionOn(void) -{ - BslClientCtxType* pctx; - - pctx = gpBslctx; - if(NULL == pctx) - { - VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, - "Invalid BSL pointer from pvosGCtx on WLANBAP_AmpSessionOn"); - return VOS_FALSE; - } - else - { - return( WLAN_BAPSessionOn(pctx->bapHdl)); - } -} - - -#endif // WLAN_BTAMP_FEATURE diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c index 98f44e7b0d65..28a407912b6d 100644 --- a/CORE/HDD/src/wlan_hdd_cfg.c +++ b/CORE/HDD/src/wlan_hdd_cfg.c @@ -2239,22 +2239,6 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_AP_DATA_AVAIL_POLL_PERIOD_MIN, CFG_AP_DATA_AVAIL_POLL_PERIOD_MAX ), - REG_VARIABLE( CFG_ENABLE_BTAMP_NAME, WLAN_PARAM_Integer, - hdd_config_t, enableBtAmp, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_ENABLE_BTAMP_DEFAULT, - CFG_ENABLE_BTAMP_MIN, - CFG_ENABLE_BTAMP_MAX ), - -#ifdef WLAN_BTAMP_FEATURE - REG_VARIABLE( CFG_BT_AMP_PREFERRED_CHANNEL_NAME, WLAN_PARAM_Integer, - hdd_config_t, preferredChannel, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_BT_AMP_PREFERRED_CHANNEL_DEFAULT, - CFG_BT_AMP_PREFERRED_CHANNEL_MIN, - CFG_BT_AMP_PREFERRED_CHANNEL_MAX ), -#endif //WLAN_BTAMP_FEATURE - REG_VARIABLE( CFG_BAND_CAPABILITY_NAME, WLAN_PARAM_Integer, hdd_config_t, nBandCapability, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -2270,13 +2254,6 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_ENABLE_BEACON_EARLY_TERMINATION_MAX ), /* CFG_VOS_TRACE_ENABLE Parameters */ - REG_VARIABLE( CFG_VOS_TRACE_ENABLE_BAP_NAME, WLAN_PARAM_Integer, - hdd_config_t, vosTraceEnableBAP, - VAR_FLAGS_OPTIONAL, - CFG_VOS_TRACE_ENABLE_DEFAULT, - CFG_VOS_TRACE_ENABLE_MIN, - CFG_VOS_TRACE_ENABLE_MAX ), - REG_VARIABLE( CFG_VOS_TRACE_ENABLE_TL_NAME, WLAN_PARAM_Integer, hdd_config_t, vosTraceEnableTL, VAR_FLAGS_OPTIONAL, @@ -3647,6 +3624,20 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_DEFAULT, CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MIN, CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MAX), + + REG_VARIABLE( CFG_TCP_DELACK_THRESHOLD_HIGH, WLAN_PARAM_Integer, + hdd_config_t, tcpDelackThresholdHigh, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TCP_DELACK_THRESHOLD_HIGH_DEFAULT, + CFG_TCP_DELACK_THRESHOLD_HIGH_MIN, + CFG_TCP_DELACK_THRESHOLD_HIGH_MAX ), + + REG_VARIABLE( CFG_TCP_DELACK_THRESHOLD_LOW, WLAN_PARAM_Integer, + hdd_config_t, tcpDelackThresholdLow, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TCP_DELACK_THRESHOLD_LOW_DEFAULT, + CFG_TCP_DELACK_THRESHOLD_LOW_MIN, + CFG_TCP_DELACK_THRESHOLD_LOW_MAX ), #endif @@ -4356,10 +4347,6 @@ void print_hdd_cfg(hdd_context_t *pHddCtx) VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gStaKeepAlivePeriod] Value = [%u] ",pHddCtx->cfg_ini->infraStaKeepAlivePeriod); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApDataAvailPollInterVal] Value = [%u] ",pHddCtx->cfg_ini->apDataAvailPollPeriodInMs); - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableBtAmp] Value = [%u] ",pHddCtx->cfg_ini->enableBtAmp); -#ifdef WLAN_BTAMP_FEATURE - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [BtAmpPreferredChannel] Value = [%u] ",pHddCtx->cfg_ini->preferredChannel); -#endif //WLAN_BTAMP_FEATURE VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [BandCapability] Value = [%u] ",pHddCtx->cfg_ini->nBandCapability); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fEnableBeaconEarlyTermination] Value = [%u] ",pHddCtx->cfg_ini->fEnableBeaconEarlyTermination); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [teleBcnWakeupEnable] Value = [%u] ",pHddCtx->cfg_ini->teleBcnWakeupEn); @@ -4434,6 +4421,12 @@ void print_hdd_cfg(hdd_context_t *pHddCtx) VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gbusBandwidthComputeInterval] Value = [%u] ", pHddCtx->cfg_ini->busBandwidthComputeInterval); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, + "Name = [gTcpDelAckThresholdHigh] Value = [%u] ", + pHddCtx->cfg_ini->tcpDelackThresholdHigh); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, + "Name = [gTcpDelAckThresholdLow] Value = [%u] ", + pHddCtx->cfg_ini->tcpDelackThresholdLow); #endif #ifdef QCA_HT_2040_COEX diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 26f66fd2ab97..42b8f923d1ba 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -87,9 +87,6 @@ #include "vos_types.h" #include "vos_trace.h" #include "vos_utils.h" -#ifdef WLAN_BTAMP_FEATURE -#include "bap_hdd_misc.h" -#endif #include <qc_sap_ioctl.h> #ifdef FEATURE_WLAN_TDLS #include "wlan_hdd_tdls.h" @@ -1139,8 +1136,11 @@ wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, } #ifdef FEATURE_WLAN_BATCH_SCAN - if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { - hddLog(LOG1, FL("Batch scan is supported by firmware")); + if (fset & WIFI_FEATURE_EXTSCAN) { + hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); + fset &= ~WIFI_FEATURE_BATCH_SCAN; + } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { + hddLog(LOG1, FL("Batch scan (legacy) is supported by firmware")); fset |= WIFI_FEATURE_BATCH_SCAN; } #endif @@ -1750,7 +1750,7 @@ static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; tANI_U8 numChannels = 0; struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; - tANI_U32 requestId; + tANI_U32 requestId, maxChannels; tWifiBand wifiBand; eHalStatus status; struct sk_buff *reply_skb; @@ -1775,8 +1775,7 @@ static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); /* Parse and fetch wifi band */ - if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) - { + if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) { hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); return -EINVAL; } @@ -1784,6 +1783,15 @@ static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); + /* Parse and fetch max channels */ + if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) { + hddLog(LOGE, FL("attr max channels failed")); + return -EINVAL; + } + maxChannels = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]); + hddLog(LOG1, FL("Max channels (%d)"), maxChannels); + status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), wifiBand, ChannelList, &numChannels); @@ -1792,6 +1800,8 @@ static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, FL("sme_GetValidChannelsByBand failed (err=%d)"), status); return -EINVAL; } + + numChannels = VOS_MIN(numChannels, maxChannels); hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); for (i = 0; i < numChannels; i++) hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); @@ -6687,21 +6697,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, pConfig = pHddCtx->cfg_ini; wdev = ndev->ieee80211_ptr; -#ifdef WLAN_BTAMP_FEATURE - if((NL80211_IFTYPE_P2P_CLIENT == type)|| - (NL80211_IFTYPE_ADHOC == type)|| - (NL80211_IFTYPE_AP == type)|| - (NL80211_IFTYPE_P2P_GO == type)) { - pHddCtx->isAmpAllowed = VOS_FALSE; - /* Stop AMP traffic */ - vstatus = WLANBAP_StopAmp(); - if (VOS_STATUS_SUCCESS != vstatus) { - pHddCtx->isAmpAllowed = VOS_TRUE; - hddLog(LOGP, FL("Failed to stop AMP")); - return -EINVAL; - } - } -#endif /* WLAN_BTAMP_FEATURE */ /* Reset the current device mode bit mask */ wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); @@ -6973,13 +6968,6 @@ done: hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); } -#ifdef WLAN_BTAMP_FEATURE - if ((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && - (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) { - /* We are ok to do AMP */ - pHddCtx->isAmpAllowed = VOS_TRUE; - } -#endif /* WLAN_BTAMP_FEATURE */ #ifdef WLAN_FEATURE_LPSS wlan_hdd_send_all_scan_intf_info(pHddCtx); @@ -8949,24 +8937,6 @@ int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, cfg_param = pHddCtx->cfg_ini; pScanInfo = &pAdapter->scan_info; -#ifdef WLAN_BTAMP_FEATURE - //Scan not supported when AMP traffic is on. - if (VOS_TRUE == WLANBAP_AmpSessionOn()) - { - hddLog(VOS_TRACE_LEVEL_ERROR, - "%s: No scanning when AMP is on", __func__); - return -EOPNOTSUPP; - } -#endif - //Scan on any other interface is not supported. - if (pAdapter->device_mode == WLAN_HDD_SOFTAP) - { - hddLog(VOS_TRACE_LEVEL_ERROR, - "%s: Not scanning on device_mode = %d", - __func__, pAdapter->device_mode); - return -EOPNOTSUPP; - } - if (TRUE == pScanInfo->mScanPending) { if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) @@ -10339,14 +10309,6 @@ static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, wlan_hdd_disable_roaming(pAdapter); #endif -#ifdef WLAN_BTAMP_FEATURE - //Infra connect not supported when AMP traffic is on. - if (VOS_TRUE == WLANBAP_AmpSessionOn()) { - hddLog(VOS_TRACE_LEVEL_ERROR, - "%s: No connection when AMP is on", __func__); - return -ECONNREFUSED; - } -#endif //If Device Mode is Station Concurrent Sessions Exit BMps //P2P Mode will be taken care in Open/close adapter diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c index 1e01dd616526..dfaee1e2af7c 100644 --- a/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -67,11 +67,6 @@ #include <wlan_hdd_hostapd.h> #include "cfgApi.h" -#ifdef WLAN_BTAMP_FEATURE -#include "bapApi.h" -#include "bap_hdd_main.h" -#include "bap_hdd_misc.h" -#endif #include <wcnss_api.h> #include <linux/inetdevice.h> @@ -1862,14 +1857,6 @@ VOS_STATUS hdd_wlan_shutdown(void) vos_free_tlshim_pkt_freeq(vosSchedContext); #endif -#ifdef WLAN_BTAMP_FEATURE - vosStatus = WLANBAP_Stop(pVosContext); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to stop BAP",__func__); - } -#endif //WLAN_BTAMP_FEATURE hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing WDA STOP", __func__); vosStatus = WDA_stop(pVosContext, HAL_STOP_TYPE_RF_KILL); @@ -1956,10 +1943,6 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc) v_CONTEXT_t pVosContext = NULL; hdd_context_t *pHddCtx = NULL; eHalStatus halStatus; -#ifdef WLAN_BTAMP_FEATURE - hdd_config_t *pConfig = NULL; - WLANBAP_ConfigType btAmpConfig; -#endif adf_os_device_t adf_ctx; hdd_adapter_t *pAdapter; @@ -2123,32 +2106,6 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc) /* Pass FW version to HIF layer */ hif_set_fw_info(hif_sc, pHddCtx->target_fw_version); -#ifdef WLAN_BTAMP_FEATURE - vosStatus = WLANBAP_Open(pVosContext); - if(!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to open BAP",__func__); - goto err_vosstop; - } - vosStatus = BSL_Init(pVosContext); - if(!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to Init BSL",__func__); - goto err_bap_close; - } - vosStatus = WLANBAP_Start(pVosContext); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to start TL",__func__); - goto err_bap_close; - } - pConfig = pHddCtx->cfg_ini; - btAmpConfig.ucPreferredChannel = pConfig->preferredChannel; - vosStatus = WLANBAP_SetConfig(&btAmpConfig); -#endif //WLAN_BTAMP_FEATURE /* Restart all adapters */ hdd_start_all_adapters(pHddCtx); @@ -2221,14 +2178,7 @@ err_unregister_pmops: hdd_unregister_mcast_bcast_filter(pHddCtx); #endif hdd_close_all_adapters(pHddCtx); -#ifdef WLAN_BTAMP_FEATURE - WLANBAP_Stop(pVosContext); -#endif -#ifdef WLAN_BTAMP_FEATURE -err_bap_close: - WLANBAP_Close(pVosContext); -#endif err_vosstop: vos_stop(pVosContext); diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c index a4c7030292e9..3287bb79744c 100644 --- a/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/CORE/HDD/src/wlan_hdd_hostapd.c @@ -72,7 +72,6 @@ #include <linux/mmc/sdio_func.h> #include "wlan_nlink_common.h" #include "wlan_btc_svc.h" -#include <bap_hdd_main.h> #include "wlan_hdd_p2p.h" #ifdef IPA_OFFLOAD #include <wlan_hdd_ipa.h> diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 4c5a209cbfce..29eadca58d09 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -77,10 +77,6 @@ #include <wlan_hdd_wowl.h> #include <wlan_hdd_misc.h> #include <wlan_hdd_wext.h> -#ifdef WLAN_BTAMP_FEATURE -#include <bap_hdd_main.h> -#include <bapInternal.h> -#endif // WLAN_BTAMP_FEATURE #include "wlan_hdd_trace.h" #include "vos_types.h" #include "vos_trace.h" @@ -107,9 +103,6 @@ int wlan_hdd_ftm_start(hdd_context_t *pAdapter); #include <wlan_hdd_softap_tx_rx.h> #include "cfgApi.h" #include "wlan_hdd_dev_pwr.h" -#ifdef WLAN_BTAMP_FEATURE -#include "bap_hdd_misc.h" -#endif #include "qwlan_version.h" #include "wlan_qct_wda.h" #ifdef FEATURE_WLAN_TDLS @@ -647,9 +640,7 @@ static int hdd_netdev_notifier_call(struct notifier_block * nb, struct net_device *dev = ndev; hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); hdd_context_t *pHddCtx; -#ifdef WLAN_BTAMP_FEATURE - VOS_STATUS status; -#endif + //Make sure that this callback corresponds to our device. if ((strncmp(dev->name, "wlan", 4)) && (strncmp(dev->name, "p2p", 3))) @@ -718,26 +709,6 @@ static int hdd_netdev_notifier_call(struct notifier_block * nb, VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Scan is not Pending from user" , __func__); } -#ifdef WLAN_BTAMP_FEATURE - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __func__); - status = WLANBAP_StopAmp(); - if(VOS_STATUS_SUCCESS != status ) - { - pHddCtx->isAmpAllowed = VOS_TRUE; - hddLog(VOS_TRACE_LEVEL_FATAL, - "%s: Failed to stop AMP", __func__); - } - else - { - //a state m/c implementation in PAL is TBD to avoid this delay - msleep(500); - if ( pHddCtx->isAmpAllowed ) - { - WLANBAP_DeregisterFromHCI(); - pHddCtx->isAmpAllowed = VOS_FALSE; - } - } -#endif //WLAN_BTAMP_FEATURE break; default: @@ -10807,14 +10778,6 @@ void hdd_wlan_exit(hdd_context_t *pHddCtx) */ hdd_stop_all_adapters( pHddCtx ); -#ifdef WLAN_BTAMP_FEATURE - vosStatus = WLANBAP_Stop(pVosContext); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to stop BAP",__func__); - } -#endif //WLAN_BTAMP_FEATURE //Stop all the modules vosStatus = vos_stop( pVosContext ); @@ -11340,6 +11303,10 @@ void hdd_cnss_request_bus_bandwidth(hdd_context_t *pHddCtx, uint64_t total = tx_packets + rx_packets; enum cnss_bus_width_type next_vote_level = CNSS_BUS_WIDTH_NONE; + uint64_t temp_rx = (rx_packets + pHddCtx->prev_rx)/2; + enum cnss_bus_width_type next_rx_level = CNSS_BUS_WIDTH_NONE; + + if (total > pHddCtx->cfg_ini->busBandwidthHighThreshold) next_vote_level = CNSS_BUS_WIDTH_HIGH; else if (total > pHddCtx->cfg_ini->busBandwidthMediumThreshold) @@ -11354,6 +11321,22 @@ void hdd_cnss_request_bus_bandwidth(hdd_context_t *pHddCtx, pHddCtx->cur_vote_level = next_vote_level; cnss_request_bus_bandwidth(next_vote_level); } + + pHddCtx->prev_rx = rx_packets; + if (temp_rx > pHddCtx->cfg_ini->tcpDelackThresholdHigh) + next_rx_level = CNSS_BUS_WIDTH_HIGH; + else + next_rx_level = CNSS_BUS_WIDTH_LOW; + + if (pHddCtx->cur_rx_level != next_rx_level) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG, + "%s: TCP DELACK trigger level %d, average_rx: %llu", + __func__, next_rx_level, temp_rx); + pHddCtx->cur_rx_level = next_rx_level; + wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_TP_IND, + &next_rx_level, + sizeof(next_rx_level)); + } #endif } @@ -11468,11 +11451,6 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) #endif hdd_context_t *pHddCtx = NULL; v_CONTEXT_t pVosContext= NULL; -#ifdef WLAN_BTAMP_FEATURE - VOS_STATUS vStatus = VOS_STATUS_SUCCESS; - WLANBAP_ConfigType btAmpConfig; - hdd_config_t *pConfig; -#endif int ret; int i; struct wiphy *wiphy; @@ -11655,8 +11633,6 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) pHddCtx->fw_log_settings.dl_mod_loglevel[i] = 0; } // Update VOS trace levels based upon the cfg.ini - hdd_vos_trace_enable(VOS_MODULE_ID_BAP, - pHddCtx->cfg_ini->vosTraceEnableBAP); hdd_vos_trace_enable(VOS_MODULE_ID_TL, pHddCtx->cfg_ini->vosTraceEnableTL); hdd_vos_trace_enable(VOS_MODULE_ID_WDI, @@ -11984,35 +11960,6 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) } } -#ifdef WLAN_BTAMP_FEATURE - vStatus = WLANBAP_Open(pVosContext); - if(!VOS_IS_STATUS_SUCCESS(vStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to open BAP",__func__); - goto err_close_adapter; - } - - vStatus = BSL_Init(pVosContext); - if(!VOS_IS_STATUS_SUCCESS(vStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to Init BSL",__func__); - goto err_bap_close; - } - vStatus = WLANBAP_Start(pVosContext); - if (!VOS_IS_STATUS_SUCCESS(vStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to start TL",__func__); - goto err_bap_close; - } - - pConfig = pHddCtx->cfg_ini; - btAmpConfig.ucPreferredChannel = pConfig->preferredChannel; - status = WLANBAP_SetConfig(&btAmpConfig); - -#endif //WLAN_BTAMP_FEATURE #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD if(!(IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)) @@ -12034,11 +11981,7 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) if ( !VOS_IS_STATUS_SUCCESS( status ) ) { hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__); -#ifdef WLAN_BTAMP_FEATURE - goto err_bap_stop; -#else goto err_close_adapter; -#endif //WLAN_BTAMP_FEATURE } /* Open debugfs interface */ @@ -12320,15 +12263,7 @@ err_unregister_pmops: hdd_debugfs_exit(pHddCtx); -#ifdef WLAN_BTAMP_FEATURE -err_bap_stop: - WLANBAP_Stop(pVosContext); -#endif -#ifdef WLAN_BTAMP_FEATURE -err_bap_close: - WLANBAP_Close(pVosContext); -#endif err_close_adapter: #if defined(CONFIG_HDD_INIT_WITH_RTNL_LOCK) @@ -13585,7 +13520,10 @@ int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data, } pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - data->lpss_support = pHddCtx->lpss_support; + if (pHddCtx->lpss_support && pHddCtx->cfg_ini->enablelpasssupport) + data->lpss_support = 1; + else + data->lpss_support = 0; data->numChannels = WLAN_SVC_MAX_NUM_CHAN; sme_GetCfgValidChannels(pHddCtx->hHal, data->channel_list, &data->numChannels); @@ -13782,6 +13720,7 @@ void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len) case WLAN_SVC_DFS_CAC_END_IND: case WLAN_SVC_DFS_RADAR_DETECT_IND: case WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND: + case WLAN_SVC_WLAN_TP_IND: ani_hdr->length = len; nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + len)); nl_data = (char *)ani_hdr + sizeof(tAniMsgHdr); diff --git a/CORE/HDD/src/wlan_hdd_oemdata.c b/CORE/HDD/src/wlan_hdd_oemdata.c index 516f5a6da85a..21880b17d292 100644 --- a/CORE/HDD/src/wlan_hdd_oemdata.c +++ b/CORE/HDD/src/wlan_hdd_oemdata.c @@ -49,7 +49,7 @@ static struct hdd_context_s *pHddCtx; -/*--------------------------------------------------------------------------------------------- +/*--------------------------------------------------------------------------- \brief hdd_OemDataReqCallback() - @@ -57,7 +57,7 @@ static struct hdd_context_s *pHddCtx; \return - eHalStatus enumeration ------------------------------------------------------------------------------------------------*/ +----------------------------------------------------------------------------*/ static eHalStatus hdd_OemDataReqCallback(tHalHandle hHal, void *pContext, tANI_U32 oemDataReqID, @@ -79,7 +79,7 @@ static eHalStatus hdd_OemDataReqCallback(tHalHandle hHal, hddLog(LOGW, "%s: oem data req %d failed", __func__, oemDataReqID); } else if(oemDataReqStatus == eOEM_DATA_REQ_INVALID_MODE) { snprintf(buffer, IW_CUSTOM_MAX, "QCOM: OEM-DATA-REQ-INVALID-MODE"); - hddLog(LOGW, "%s: oem data req %d failed because the driver is in invalid mode (IBSS|BTAMP|AP)", __func__, oemDataReqID); + hddLog(LOGW, "%s: oem data req %d failed because the driver is in invalid mode (IBSS|AP)", __func__, oemDataReqID); } else { snprintf(buffer, IW_CUSTOM_MAX, "QCOM: OEM-DATA-REQ-SUCCESS"); } diff --git a/CORE/HDD/src/wlan_hdd_scan.c b/CORE/HDD/src/wlan_hdd_scan.c index 6b1657149f5c..5da544b5ff01 100644 --- a/CORE/HDD/src/wlan_hdd_scan.c +++ b/CORE/HDD/src/wlan_hdd_scan.c @@ -60,9 +60,6 @@ #include <palTypes.h> #include <aniGlobal.h> #include <dot11f.h> -#ifdef WLAN_BTAMP_FEATURE -#include "bap_hdd_misc.h" -#endif #include <linux/wireless.h> #include <net/cfg80211.h> @@ -626,14 +623,6 @@ int iw_set_scan(struct net_device *dev, struct iw_request_info *info, VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); -#ifdef WLAN_BTAMP_FEATURE - //Scan not supported when AMP traffic is on. - if( VOS_TRUE == WLANBAP_AmpSessionOn() ) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); - return eHAL_STATUS_SUCCESS; - } -#endif if(pAdapter->scan_info.mScanPending == TRUE) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__); @@ -905,14 +894,6 @@ int iw_set_cscan(struct net_device *dev, struct iw_request_info *info, ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); -#ifdef WLAN_BTAMP_FEATURE - //Scan not supported when AMP traffic is on. - if( VOS_TRUE == WLANBAP_AmpSessionOn() ) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); - return eHAL_STATUS_SUCCESS; - } -#endif if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c index 20cf50e1e174..c385a2d88c5c 100644 --- a/CORE/HDD/src/wlan_hdd_wext.c +++ b/CORE/HDD/src/wlan_hdd_wext.c @@ -50,9 +50,6 @@ #include <wlan_hdd_includes.h> #include <wlan_btc_svc.h> #include <wlan_nlink_common.h> -#ifdef WLAN_BTAMP_FEATURE -#include <bap_hdd_main.h> -#endif #include <vos_api.h> #include <net/arp.h> #include "ccmApi.h" @@ -94,7 +91,6 @@ #include "wlan_qct_tl.h" #include "wlan_hdd_misc.h" -#include "bap_hdd_misc.h" #include "wlan_hdd_dev_pwr.h" #include "qc_sap_ioctl.h" @@ -346,10 +342,6 @@ static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2}, /* Private ioctls and their sub-ioctls */ #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) #define WE_CLEAR_STATS 1 -#ifdef WLAN_BTAMP_FEATURE -#define WE_ENABLE_AMP 4 -#define WE_DISABLE_AMP 5 -#endif /* WLAN_BTAMP_FEATURE */ #define WE_ENABLE_DXE_STALL_DETECT 6 #define WE_DISPLAY_DXE_SNAP_SHOT 7 #define WE_SET_REASSOC_TRIGGER 8 @@ -7338,39 +7330,6 @@ static int iw_setnone_getnone(struct net_device *dev, struct iw_request_info *in break; } -#ifdef WLAN_BTAMP_FEATURE - case WE_ENABLE_AMP: - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: enabling AMP", __func__); - WLANBAP_RegisterWithHCI(pAdapter); - break; - } - case WE_DISABLE_AMP: - { - hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); - VOS_STATUS status; - - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __func__); - - pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); - status = WLANBAP_StopAmp(); - if(VOS_STATUS_SUCCESS != status ) - { - pHddCtx->isAmpAllowed = VOS_TRUE; - hddLog(VOS_TRACE_LEVEL_FATAL, - "%s: Failed to stop AMP", __func__); - } - else - { - //a state m/c implementation in PAL is TBD to avoid this delay - msleep(500); - pHddCtx->isAmpAllowed = VOS_FALSE; - WLANBAP_DeregisterFromHCI(); - } - - break; - } -#endif case WE_ENABLE_DXE_STALL_DETECT: { tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); @@ -10592,16 +10551,6 @@ static const struct iw_priv_args we_private_args[] = { 0, 0, "getRecoverStat" }, -#ifdef WLAN_BTAMP_FEATURE - { WE_ENABLE_AMP, - 0, - 0, - "enableAMP" }, - { WE_DISABLE_AMP, - 0, - 0, - "disableAMP" }, -#endif /* WLAN_BTAMP_FEATURE */ { WE_ENABLE_DXE_STALL_DETECT, 0, 0, diff --git a/CORE/MAC/inc/qwlan_version.h b/CORE/MAC/inc/qwlan_version.h index 25a6d7345755..277b7eb3099e 100644 --- a/CORE/MAC/inc/qwlan_version.h +++ b/CORE/MAC/inc/qwlan_version.h @@ -42,9 +42,9 @@ BRIEF DESCRIPTION: #define QWLAN_VERSION_MINOR 0 #define QWLAN_VERSION_PATCH 0 #define QWLAN_VERSION_EXTRA "" -#define QWLAN_VERSION_BUILD 203 +#define QWLAN_VERSION_BUILD 204 -#define QWLAN_VERSIONSTR "1.0.0.203" +#define QWLAN_VERSIONSTR "1.0.0.204" #define AR6320_REV1_VERSION 0x5000000 diff --git a/CORE/MAC/src/include/parserApi.h b/CORE/MAC/src/include/parserApi.h index 1f5e6312793b..8f5736958ebc 100644 --- a/CORE/MAC/src/include/parserApi.h +++ b/CORE/MAC/src/include/parserApi.h @@ -275,6 +275,9 @@ typedef struct sSirAssocRsp #endif tDot11fIEExtCap ExtCap; tSirQosMapSet QosMapSet; +#ifdef WLAN_FEATURE_11W + tDot11fIETimeoutInterval TimeoutInterval; +#endif } tSirAssocRsp, *tpSirAssocRsp; #if defined(FEATURE_WLAN_ESE_UPLOAD) diff --git a/CORE/MAC/src/pe/include/limSession.h b/CORE/MAC/src/pe/include/limSession.h index 4e8ac38860d1..89fff8ace52e 100644 --- a/CORE/MAC/src/pe/include/limSession.h +++ b/CORE/MAC/src/pe/include/limSession.h @@ -52,6 +52,21 @@ typedef struct sPowersaveoffloadInfo tANI_U8 bcnmiss; }tPowersaveoffloadInfo, tpPowersaveoffloadInfo; +#ifdef WLAN_FEATURE_11W +/* + * This struct is needed for handling of ASSOC RSP with TRY AGAIN LATER + * It stores the context and state machine setting for MLM so that it can + * go back send ASSOC REQ frame again after the timer has expired. + */ +typedef struct tagComebackTimerInfo +{ + tpAniSirGlobal pMac; + tANI_U8 sessionID; + tLimMlmStates limPrevMlmState; /* Previous MLM State */ + tLimSmeStates limMlmState; /* MLM State */ +} tComebackTimerInfo; +#endif /* WLAN_FEATURE_11W */ + /*-------------------------------------------------------------------------- Include Files ------------------------------------------------------------------------*/ @@ -451,6 +466,10 @@ typedef struct sPESession // Added to Support BT-AMP tftPEContext ftPEContext; #endif tANI_BOOLEAN isNonRoamReassoc; +#ifdef WLAN_FEATURE_11W + vos_timer_t pmfComebackTimer; + tComebackTimerInfo pmfComebackTimerInfo; +#endif /* WLAN_FEATURE_11W */ }tPESession, *tpPESession; /*------------------------------------------------------------------------- diff --git a/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c index acdd05deca0d..6b9283c6a319 100644 --- a/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c +++ b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c @@ -614,7 +614,11 @@ limProcessAssocRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U8 sub limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER); } - if (pAssocRsp->statusCode != eSIR_MAC_SUCCESS_STATUS) + if (pAssocRsp->statusCode != eSIR_MAC_SUCCESS_STATUS +#ifdef WLAN_FEATURE_11W + && pAssocRsp->statusCode != eSIR_MAC_TRY_AGAIN_LATER +#endif /* WLAN_FEATURE_11W */ + ) { // Re/Association response was received // either with failure code. @@ -654,6 +658,39 @@ limProcessAssocRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U8 sub * assoc/reassoc response * NOTE: for BTAMP case, it is being handled in limProcessMlmAssocReq */ + +#ifdef WLAN_FEATURE_11W + if (pAssocRsp->statusCode == eSIR_MAC_TRY_AGAIN_LATER) { + /* fetch timer value from IE */ + if (pAssocRsp->TimeoutInterval.present && + (pAssocRsp->TimeoutInterval.timeoutType == + SIR_MAC_TI_TYPE_ASSOC_COMEBACK) ) { + tANI_U16 timeout_value = pAssocRsp->TimeoutInterval.timeoutValue; + PELOGE(limLog(pMac, LOG1, + FL("ASSOC response with eSIR_MAC_TRY_AGAIN_LATER recvd. " + "Starting timer to wait timeout=%d."), + timeout_value);) + + /* start timer with callback */ + if (VOS_STATUS_SUCCESS != + vos_timer_start(&psessionEntry->pmfComebackTimer, + timeout_value)) { + PELOGE(limLog(pMac, LOGE, + FL("Failed to start comeback timer."));) + } + } else { + PELOGE(limLog(pMac, LOG1, + FL("ASSOC response with eSIR_MAC_TRY_AGAIN_LATER recvd." + "But try again time interval IE is wrong."));) + } + /* callback will send Assoc again */ + /* DO NOT send ASSOC CNF to MLM state machine */ + vos_mem_free(pBeaconStruct); + vos_mem_free(pAssocRsp); + return; + } +#endif /* WLAN_FEATURE_11W */ + if (!((psessionEntry->bssType == eSIR_BTAMP_STA_MODE) || ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE) && (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)))) @@ -667,6 +704,7 @@ limProcessAssocRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U8 sub return; } } + if (subType == LIM_REASSOC) { // Log success diff --git a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c index 131f91946ee4..b390d2f96515 100644 --- a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c +++ b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c @@ -2468,6 +2468,7 @@ limProcessMlmAssocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) return; } + pMlmAssocReq = (tLimMlmAssocReq *) pMsgBuf; if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL) @@ -2488,6 +2489,19 @@ limProcessMlmAssocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) /// map the session entry pointer to the AssocFailureTimer pMac->lim.limTimers.gLimAssocFailureTimer.sessionId = pMlmAssocReq->sessionId; +#ifdef WLAN_FEATURE_11W + /* + * Store current MLM state in case ASSOC response returns with + * TRY_AGAIN_LATER return code. + */ + if (psessionEntry->limRmfEnabled) { + psessionEntry->pmfComebackTimerInfo.limPrevMlmState = + psessionEntry->limPrevMlmState; + psessionEntry->pmfComebackTimerInfo.limMlmState = + psessionEntry->limMlmState; + } +#endif /* WLAN_FEATURE_11W */ + psessionEntry->limPrevMlmState = psessionEntry->limMlmState; psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE; MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c index 973c7a599c8f..05328a5f5a50 100644 --- a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c +++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c @@ -505,6 +505,164 @@ limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) } } /*** end limProcessMlmJoinCnf() ***/ +/* + * limSendMlmAssocReq() + * + * FUNCTION: + * This function is sends ASSOC request MLM message to MLM State machine. + * ASSOC request packet would be by picking parameters from psessionEntry + * automatically based on the current state of MLM state machine. + * + *LOGIC: + * + *ASSUMPTIONS: + * this function is called in middle of connection state machine and is + * expected to be called after auth cnf has been received or after ASSOC rsp + * with TRY_AGAIN_LATER was received and required time has elapsed after that. + * + *NOTE: + * + * @param pMac Pointer to Global MAC structure + * @param psessionEntry Pointer to session etnry + * + * @return None + */ + +void +limSendMlmAssocReq( tpAniSirGlobal pMac, + tpPESession psessionEntry) +{ + tLimMlmAssocReq *pMlmAssocReq; + tANI_U32 val; + tANI_U16 caps; + tANI_U32 teleBcnEn = 0; + + /* Successful MAC based authentication. Trigger Association with BSS */ + PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Authenticated with BSS"), + psessionEntry->peSessionId);) + + pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq)); + if ( NULL == pMlmAssocReq ) { + limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmAssocReq")); + return; + } + val = sizeof(tSirMacAddr); + sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId); + if (wlan_cfgGetInt(pMac, + WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, + (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout) + != eSIR_SUCCESS) { + /* Could not get AssocFailureTimeout value from CFG. Log error */ + limLog(pMac, LOGP, FL("could not retrieve AssocFailureTimeout value")); + } + + if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) { + /* Could not get Capabilities value from CFG. Log error */ + limLog(pMac, LOGP, + FL("could not retrieve Capabilities value")); + } + + /* Clear spectrum management bit if AP doesn't support it */ + if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & + LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) { + /* + * AP doesn't support spectrum management + * clear spectrum management bit + */ + caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK); + } + + /* Clear rrm bit if AP doesn't support it */ + if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo + & LIM_RRM_BIT_MASK)) { + caps &= (~LIM_RRM_BIT_MASK); + } + + /* Clear short preamble bit if AP does not support it */ + if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & + (LIM_SHORT_PREAMBLE_BIT_MASK))) { + caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK); + limLog(pMac, LOG1, FL("Clearing short preamble:no AP support")); + } + + /* Clear immediate block ack bit if AP does not support it */ + if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & + (LIM_IMMEDIATE_BLOCK_ACK_MASK))) { + caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK); + limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support")); + } + + pMlmAssocReq->capabilityInfo = caps; + PELOG3(limLog(pMac, LOG3, + FL("Capabilities to be used in AssocReq=0x%X, " + "privacy bit=%x shortSlotTime %x"), + caps, + ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy, + ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);) + + /* + * If telescopic beaconing is enabled, set listen interval to + * WNI_CFG_TELE_BCN_MAX_LI + */ + if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) != + eSIR_SUCCESS) + limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN")); + + val = WNI_CFG_LISTEN_INTERVAL_STADEF; + + if(teleBcnEn) + { + if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != + eSIR_SUCCESS) + { + /** + * Could not get ListenInterval value + * from CFG. Log error. + */ + limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); + } + } else { + if (wlan_cfgGetInt(pMac, + WNI_CFG_LISTEN_INTERVAL, + &val) != eSIR_SUCCESS) { + /* + * Could not get ListenInterval value + * from CFG. Log error. + */ + limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); + } + } + + pMlmAssocReq->listenInterval = (tANI_U16)val; + /* Update PE session ID*/ + pMlmAssocReq->sessionId = psessionEntry->peSessionId; + psessionEntry->limPrevSmeState = psessionEntry->limSmeState; + psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE; + MTRACE(macTrace(pMac, + TRACE_CODE_SME_STATE, + psessionEntry->peSessionId, + psessionEntry->limSmeState)); + limPostMlmMessage(pMac, + LIM_MLM_ASSOC_REQ, + (tANI_U32 *) pMlmAssocReq); +} + +#ifdef WLAN_FEATURE_11W +void limPmfComebackTimerCallback(void *context) +{ + tComebackTimerInfo *pInfo = (tComebackTimerInfo *)context; + tpAniSirGlobal pMac = pInfo->pMac; + tpPESession psessionEntry = &pMac->lim.gpSession[pInfo->sessionID]; + + PELOGE(limLog(pMac, LOGE, + FL("comeback later timer expired. sending MLM ASSOC req"));) + /* set MLM state such that ASSOC REQ packet will be sent out */ + psessionEntry->limPrevMlmState = pInfo->limPrevMlmState; + psessionEntry->limMlmState = pInfo->limMlmState; + limSendMlmAssocReq(pMac, psessionEntry); +} +#endif /* WLAN_FEATURE_11W */ + /** * limProcessMlmAuthCnf() * @@ -526,14 +684,10 @@ limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) void limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) { - tANI_U16 caps; - tANI_U32 val; tAniAuthType cfgAuthType, authMode; tLimMlmAuthReq *pMlmAuthReq; - tLimMlmAssocReq *pMlmAssocReq; tLimMlmAuthCnf *pMlmAuthCnf; tpPESession psessionEntry; - tANI_U32 teleBcnEn = 0; if(pMsgBuf == NULL) { @@ -600,7 +754,6 @@ limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) return; } vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0); - val = sizeof(tSirMacAddr); if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) { sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId); @@ -661,132 +814,16 @@ limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) { if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) { - /** - * Successful MAC based authentication - * Trigger Association with BSS - */ - PELOG1(limLog(pMac, LOG1, - FL("SessionId:%d Authenticated with BSS"), - psessionEntry->peSessionId);) - pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq)); - if ( NULL == pMlmAssocReq ) - { - // Log error - limLog(pMac, LOGP, - FL("call to AllocateMemory failed for mlmAssocReq")); - return; - } - val = sizeof(tSirMacAddr); - sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId); - if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, - (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout) - != eSIR_SUCCESS) - { - /** - * Could not get AssocFailureTimeout value - * from CFG. Log error. - */ - limLog(pMac, LOGP, - FL("could not retrieve AssocFailureTimeout value")); - } - if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS) - { - /** - * Could not get Capabilities value - * from CFG. Log error. - */ - limLog(pMac, LOGP, - FL("could not retrieve Capabilities value")); - } - /*Clear spectrum management bit if AP doesn't support it*/ - if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) - { - /*AP doesn't support spectrum management clear spectrum management bit*/ - caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK); - } - - /* Clear rrm bit if AP doesn't support it */ - if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo - & LIM_RRM_BIT_MASK)) - { - caps &= (~LIM_RRM_BIT_MASK); - } - - /* Clear short preamble bit if AP does not support it */ - if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & - (LIM_SHORT_PREAMBLE_BIT_MASK))) - { - caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK); - limLog(pMac, LOG1, FL("Clearing short preamble:no AP support")); - } - - /* Clear immediate block ack bit if AP does not support it */ - if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & - (LIM_IMMEDIATE_BLOCK_ACK_MASK))) - { - caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK); - limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support")); - } - - pMlmAssocReq->capabilityInfo = caps; - PELOG3(limLog(pMac, LOG3, - FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"), - caps, - ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy, - ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);) - - /* If telescopic beaconing is enabled, set listen interval to - WNI_CFG_TELE_BCN_MAX_LI */ - if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) != - eSIR_SUCCESS) - limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN")); - - val = WNI_CFG_LISTEN_INTERVAL_STADEF; - - if(teleBcnEn) - { - if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != - eSIR_SUCCESS) - { - /** - * Could not get ListenInterval value - * from CFG. Log error. - */ - limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); - } - } - else - { - if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS) - { - /** - * Could not get ListenInterval value - * from CFG. Log error. - */ - limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); - } - } - - pMlmAssocReq->listenInterval = (tANI_U16)val; - /* Update PE session ID*/ - pMlmAssocReq->sessionId = psessionEntry->peSessionId; - psessionEntry->limPrevSmeState = psessionEntry->limSmeState; - psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE; - MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); - limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ", - psessionEntry->peSessionId); - limPostMlmMessage(pMac, - LIM_MLM_ASSOC_REQ, - (tANI_U32 *) pMlmAssocReq); + limSendMlmAssocReq(pMac, psessionEntry); } else { - /** - * Successful Pre-authentication. - * Send Pre-auth response to host - */ + /* Successful Pre-authentication. Send Pre-auth response to host */ psessionEntry->limSmeState = psessionEntry->limPrevSmeState; - MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); + MTRACE(macTrace(pMac, + TRACE_CODE_SME_STATE, + psessionEntry->peSessionId, + psessionEntry->limSmeState)); } } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ... } /*** end limProcessMlmAuthCnf() ***/ diff --git a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c index deef6ebd266b..6ff9c30f57b7 100644 --- a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c +++ b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c @@ -1945,7 +1945,24 @@ __limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) #ifdef WLAN_FEATURE_11W if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType) { + VOS_STATUS vosStatus; psessionEntry->limRmfEnabled = 1; + /* + * For STA profile only: + * init pmf comeback timer and info struct only if PMF connection + */ + psessionEntry->pmfComebackTimerInfo.pMac = pMac; + psessionEntry->pmfComebackTimerInfo.sessionID = sessionId; + vosStatus = vos_timer_init(&psessionEntry->pmfComebackTimer, + VOS_TIMER_TYPE_SW, + limPmfComebackTimerCallback, + (void*)&psessionEntry->pmfComebackTimerInfo); + if (VOS_STATUS_SUCCESS != vosStatus) { + limLog(pMac, LOGP, + FL("cannot init pmf comeback timer.")); + retCode = eSIR_LOGP_EXCEPTION; + goto end; + } } else { diff --git a/CORE/MAC/src/pe/lim/limSession.c b/CORE/MAC/src/pe/lim/limSession.c index 0001940df792..26a0acbe7119 100644 --- a/CORE/MAC/src/pe/lim/limSession.c +++ b/CORE/MAC/src/pe/lim/limSession.c @@ -582,6 +582,13 @@ void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry) psessionEntry->addIeParams.probeRespBCNDataLen = 0; } +#ifdef WLAN_FEATURE_11W + /* if PMF connection */ + if (psessionEntry->limRmfEnabled) { + vos_timer_destroy(&psessionEntry->pmfComebackTimer); + } +#endif + psessionEntry->valid = FALSE; return; } diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h index 94b821e9fd7a..af5f251f4aa5 100644 --- a/CORE/MAC/src/pe/lim/limUtils.h +++ b/CORE/MAC/src/pe/lim/limUtils.h @@ -585,4 +585,7 @@ void limSetProtectedBit(tpAniSirGlobal pMac, tANI_U8* lim_get_ie_ptr(tANI_U8 *pIes, int length, tANI_U8 eid); +#ifdef WLAN_FEATURE_11W +void limPmfComebackTimerCallback(void *context); +#endif /* WLAN_FEATURE_11W */ #endif /* __LIM_UTILS_H */ diff --git a/CORE/SERVICES/BMI/ol_fw.c b/CORE/SERVICES/BMI/ol_fw.c index 2a4e7a10aa88..ccd974f5853b 100644 --- a/CORE/SERVICES/BMI/ol_fw.c +++ b/CORE/SERVICES/BMI/ol_fw.c @@ -2194,7 +2194,6 @@ static int ol_diag_read_reg_loc(struct ol_softc *scn, u_int8_t *buffer, out: return result; } -#endif void ol_dump_target_memory(HIF_DEVICE *hif_device, void *memoryBlock) { @@ -2220,6 +2219,7 @@ void ol_dump_target_memory(HIF_DEVICE *hif_device, void *memoryBlock) bufferLoc += size; } } +#endif /**--------------------------------------------------------------------------- * \brief ol_target_coredump diff --git a/CORE/SERVICES/HIF/PCIe/if_pci.c b/CORE/SERVICES/HIF/PCIe/if_pci.c index 129240688bf5..e7455fa75251 100644 --- a/CORE/SERVICES/HIF/PCIe/if_pci.c +++ b/CORE/SERVICES/HIF/PCIe/if_pci.c @@ -52,10 +52,6 @@ #endif #include "epping_main.h" -#ifdef WLAN_BTAMP_FEATURE -#include "wlan_btc_svc.h" -#include "wlan_nlink_common.h" -#endif #ifndef REMOVE_PKT_LOG #include "ol_txrx_types.h" @@ -967,10 +963,6 @@ again: } #endif -#ifdef WLAN_BTAMP_FEATURE - /* Send WLAN UP indication to Nlink Service */ - send_btc_nlink_msg(WLAN_MODULE_UP_IND, 0); -#endif return 0; @@ -1312,10 +1304,6 @@ again: } #endif -#ifdef WLAN_BTAMP_FEATURE - /* Send WLAN UP indication to Nlink Service */ - send_btc_nlink_msg(WLAN_MODULE_UP_IND, 0); -#endif printk("%s: WLAN host driver reinitiation completed!\n", __func__); return 0; diff --git a/CORE/SERVICES/HIF/USB/if_usb.c b/CORE/SERVICES/HIF/USB/if_usb.c index e747850ed02b..927e6c0139f2 100644 --- a/CORE/SERVICES/HIF/USB/if_usb.c +++ b/CORE/SERVICES/HIF/USB/if_usb.c @@ -40,10 +40,6 @@ #include "wlan_hdd_main.h" #include "epping_main.h" -#ifdef WLAN_BTAMP_FEATURE -#include "wlan_btc_svc.h" -#include "wlan_nlink_common.h" -#endif #ifndef REMOVE_PKT_LOG #include "ol_txrx_types.h" @@ -200,10 +196,6 @@ hif_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) } #endif -#ifdef WLAN_BTAMP_FEATURE - /* Send WLAN UP indication to Nlink Service */ - send_btc_nlink_msg(WLAN_MODULE_UP_IND, 0); -#endif sc->interface = interface; sc->reboot_notifier.notifier_call = hif_usb_reboot; diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 07ad0932d040..c011f01589dc 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -6787,7 +6787,8 @@ VOS_STATUS wma_get_buf_start_scan_cmd(tp_wma_handle wma_handle, cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; if (scan_req->scanType == eSIR_PASSIVE_SCAN) cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; - cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; + cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ | + WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; /* * Decide burst_duration and dwell_time_active based on * what type of devices are active. @@ -21121,7 +21122,8 @@ static VOS_STATUS wma_process_ll_stats_getReq cmd->burst_duration = WMA_EXTSCAN_BURST_DURATION; cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | WMI_SCAN_ADD_CCK_RATES | - WMI_SCAN_ADD_OFDM_RATES ; + WMI_SCAN_ADD_OFDM_RATES | + WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; cmd->scan_priority = WMI_SCAN_PRIORITY_HIGH; cmd->notify_extscan_events = WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | WMI_EXTSCAN_BUCKET_OVERRUN_EVENT; diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 836570cda011..169cce06057b 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -261,7 +261,6 @@ void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); void csrRoamJoinRetryTimerHandler(void *pv); #endif extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); -extern void btampEstablishLogLinkHdlr(void* pMsg); static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); void csrInitOperatingClasses(tHalHandle hHal); @@ -7013,12 +7012,6 @@ eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi csrScanCancelIdleScan(pMac); //Only abort the scan if it is not used for other roam/connect purpose csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT); - if (!vos_concurrent_open_sessions_running() && - (VOS_STA_SAP_MODE == pProfile->csrPersona)) - { - /* In case of AP mode we do not want idle mode scan */ - csrScanDisable(pMac); - } csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); //Check whether ssid changes if(csrIsConnStateConnected(pMac, sessionId)) @@ -10741,7 +10734,6 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) case eWNI_SME_BTAMP_LOG_LINK_IND: smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread")); - btampEstablishLogLinkHdlr( pSirMsg ); break; case eWNI_SME_RSSI_IND: smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); diff --git a/CORE/SVC/external/wlan_nlink_common.h b/CORE/SVC/external/wlan_nlink_common.h index b604adb29a85..3adac4e33b15 100644 --- a/CORE/SVC/external/wlan_nlink_common.h +++ b/CORE/SVC/external/wlan_nlink_common.h @@ -93,6 +93,7 @@ #define WLAN_SVC_WLAN_STATUS_IND 0x106 #define WLAN_SVC_WLAN_VERSION_IND 0x107 #define WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND 0x108 +#define WLAN_SVC_WLAN_TP_IND 0x109 #define WLAN_SVC_MAX_SSID_LEN 32 #define WLAN_SVC_MAX_BSSID_LEN 6 diff --git a/CORE/SYS/legacy/src/utils/src/parserApi.c b/CORE/SYS/legacy/src/utils/src/parserApi.c index ddc3e6c90f10..becc404ec9fd 100644 --- a/CORE/SYS/legacy/src/utils/src/parserApi.c +++ b/CORE/SYS/legacy/src/utils/src/parserApi.c @@ -2446,6 +2446,16 @@ sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac, pAssocRsp->statusCode = ar.Status.status; pAssocRsp->aid = ar.AID.associd; +#ifdef WLAN_FEATURE_11W + if (ar.TimeoutInterval.present) { + pAssocRsp->TimeoutInterval.present = 1; + pAssocRsp->TimeoutInterval.timeoutType = + ar.TimeoutInterval.timeoutType; + pAssocRsp->TimeoutInterval.timeoutValue = + ar.TimeoutInterval.timeoutValue; + } +#endif + if ( ! ar.SuppRates.present ) { pAssocRsp->suppRatesPresent = 0; diff --git a/CORE/TL/inc/wlan_qct_tl.h b/CORE/TL/inc/wlan_qct_tl.h index 186fc8f86dc3..2baf0ef4ea22 100644 --- a/CORE/TL/inc/wlan_qct_tl.h +++ b/CORE/TL/inc/wlan_qct_tl.h @@ -159,48 +159,19 @@ typedef enum /* AD-hoc link*/ WLAN_STA_IBSS, - /* BT-AMP link*/ - WLAN_STA_BT_AMP, - /* SoftAP station */ WLAN_STA_SOFTAP, #ifdef FEATURE_WLAN_TDLS /* TDLS direct link */ - WLAN_STA_TDLS, /* 4 */ + WLAN_STA_TDLS, #endif - /* Invalid link*/ WLAN_STA_MAX }WLAN_STAType; -/*--------------------------------------------------------------------------- - BAP Management frame type ----------------------------------------------------------------------------*/ -typedef enum -{ - /* BT-AMP packet of type data */ - WLANTL_BT_AMP_TYPE_DATA = 0x0001, - - /* BT-AMP packet of type activity report */ - WLANTL_BT_AMP_TYPE_AR = 0x0002, - - /* BT-AMP packet of type security frame */ - WLANTL_BT_AMP_TYPE_SEC = 0x0003, - - /* BT-AMP packet of type Link Supervision request frame */ - WLANTL_BT_AMP_TYPE_LS_REQ = 0x0004, - - /* BT-AMP packet of type Link Supervision reply frame */ - WLANTL_BT_AMP_TYPE_LS_REP = 0x0005, - - /* Invalid Frame */ - WLANTL_BAP_INVALID_FRAME - -} WLANTL_BAPFrameEnumType; - /* Type used to specify LWM threshold unit */ typedef enum { WLAN_LWM_THRESHOLD_BYTE = 0, @@ -509,7 +480,7 @@ typedef tSap_SoftapStats WLANTL_TRANSFER_STA_TYPE; IN pvosGCtx: pointer to the global vos context; a handle to - TL/HAL/PE/BAP/HDD control block can be extracted from + TL/HAL/PE/HDD control block can be extracted from its context vosDataBuff: pointer to the VOSS data buffer that was transmitted wTxSTAtus: status of the transmission @@ -623,60 +594,6 @@ typedef void (*WLANTL_TxFlowControlCBType)(void *adapterCtxt, #endif /* QCA_LL_TX_FLOW_CT */ /*---------------------------------------------------------------------------- - INTERACTION WITH BAP - ---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - - DESCRIPTION - Type of the receive callback registered with TL for BAP. - - The registered reception callback is being triggered by TL whenever a - frame was received and it was filtered as a non-data BT AMP packet. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - vosDataBuff: pointer to the vOSS buffer containing the received packet; - no chaining will be done on this path - frameType: type of the frame to be indicated to BAP. - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -typedef VOS_STATUS (*WLANTL_BAPRxCBType)( v_PVOID_t pvosGCtx, - vos_pkt_t* vosDataBuff, - WLANTL_BAPFrameEnumType frameType); - -/*---------------------------------------------------------------------------- - - DESCRIPTION - Callback registered with TL for BAP, this is required inorder for - TL to inform BAP, that the flush operation requested has been completed. - - The registered reception callback is being triggered by TL whenever a - frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - vosDataBuff: pointer to the vOSS buffer containing the received packet; - no chaining will be done on this path - - RETURN VALUE - The result code associated with performing the operation - -----------------------------------------------------------------------------*/ -typedef VOS_STATUS (*WLANTL_FlushOpCompCBType)( v_PVOID_t pvosGCtx, - v_U8_t ucStaId, - v_U8_t ucTID, - v_U8_t status); -/*---------------------------------------------------------------------------- INTERACTION WITH PE ---------------------------------------------------------------------------*/ @@ -1361,107 +1278,6 @@ WLANTL_SetSTAPriority ); /*---------------------------------------------------------------------------- - INTERACTION WITH BAP - ---------------------------------------------------------------------------*/ - -/*========================================================================== - - FUNCTION WLANTL_RegisterBAPClient - - DESCRIPTION - Called by SME to register itself as client for non-data BT-AMP packets. - - DEPENDENCIES - TL must be initialized before this function can be called. - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - pfnTlBAPRxFrm: pointer to the receive processing routine for non-data - BT-AMP packets - pfnFlushOpCompleteCb: - pointer to the function that will inform BAP that the - flush operation is complete. - - RETURN VALUE - - The result code associated with performing the operation - - VOS_STATUS_E_INVAL: Input parameters are invalid - VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer - to TL cb is NULL ; access would cause a page fault - VOS_STATUS_E_EXISTS: BAL client was already registered - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANTL_RegisterBAPClient -( - v_PVOID_t pvosGCtx, - WLANTL_BAPRxCBType pfnTlBAPRx, - WLANTL_FlushOpCompCBType pfnFlushOpCompleteCb -); - - -/*========================================================================== - - FUNCTION WLANTL_TxBAPFrm - - DESCRIPTION - BAP calls this when it wants to send a frame to the module - - DEPENDENCIES - BAP must be registered with TL before this function can be called. - - RESTRICTION: BAP CANNOT push any packets to TL until it did not receive - a tx complete from the previous packet, that means BAP - sends one packet, wait for tx complete and then - sends another one - - If BAP sends another packet before TL manages to process the - previously sent packet call will end in failure - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or BAP's control block can be extracted from its context - vosDataBuff: pointer to the vOSS buffer containing the packet to be - transmitted - pMetaInfo: meta information about the packet - pfnTlBAPTxComp: pointer to a transmit complete routine for notifying - the result of the operation over the bus - - RETURN VALUE - The result code associated with performing the operation - - VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a - page fault - VOS_STATUS_E_EXISTS: BAL client was not yet registered - VOS_STATUS_E_BUSY: The previous BT-AMP packet was not yet transmitted - VOS_STATUS_SUCCESS: Everything is good :) - - Other failure messages may be returned from the BD header handling - routines, please check apropriate API for more info. - - SIDE EFFECTS - -============================================================================*/ -VOS_STATUS -WLANTL_TxBAPFrm -( - v_PVOID_t pvosGCtx, - vos_pkt_t* vosDataBuff, - WLANTL_MetaInfoType* pMetaInfo, - WLANTL_TxCompCBType pfnTlBAPTxComp -); - - -/*---------------------------------------------------------------------------- INTERACTION WITH SME ---------------------------------------------------------------------------*/ @@ -1603,42 +1419,6 @@ WLANTL_GetLinkQuality v_U32_t* puLinkQuality ); -/*========================================================================== - - FUNCTION WLANTL_FlushStaTID - - DESCRIPTION - TL provides this API as an interface to SME (BAP) layer. TL inturn posts a - message to HAL. This API is called by the SME inorder to perform a flush - operation. - - DEPENDENCIES - - PARAMETERS - - IN - pvosGCtx: pointer to the global vos context; a handle to TL's - or SME's control block can be extracted from its context - ucSTAId: station identifier for the requested value - ucTid: Tspec ID for the new BA session - - OUT - The response for this post is received in the main thread, via a response - message from HAL to TL. - - RETURN VALUE - VOS_STATUS_SUCCESS: Everything is good :) - - SIDE EFFECTS -============================================================================*/ -VOS_STATUS -WLANTL_FlushStaTID -( - v_PVOID_t pvosGCtx, - v_U8_t ucSTAId, - v_U8_t ucTid -); - /*---------------------------------------------------------------------------- INTERACTION WITH PE ---------------------------------------------------------------------------*/ diff --git a/CORE/VOSS/inc/vos_packet.h b/CORE/VOSS/inc/vos_packet.h index a6121429fce6..f6422a82056f 100644 --- a/CORE/VOSS/inc/vos_packet.h +++ b/CORE/VOSS/inc/vos_packet.h @@ -184,7 +184,6 @@ typedef enum VOS_PKT_USER_DATA_ID_BAL, VOS_PKT_USER_DATA_ID_WDA, VOS_PKT_USER_DATA_ID_HDD, - VOS_PKT_USER_DATA_ID_BAP, VOS_PKT_USER_DATA_ID_BSL, VOS_PKT_USER_DATA_ID_MAX diff --git a/CORE/VOSS/inc/vos_types.h b/CORE/VOSS/inc/vos_types.h index 3ba85554936e..8082bb09b7b8 100644 --- a/CORE/VOSS/inc/vos_types.h +++ b/CORE/VOSS/inc/vos_types.h @@ -101,7 +101,7 @@ /// in the software system. typedef enum { - VOS_MODULE_ID_BAP = 0, + /* 0 is unused for historical purposes */ VOS_MODULE_ID_TL = 1, VOS_MODULE_ID_WDI = 2, // 3 & 4 are unused for historical purposes diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c index f1a58af0c450..66dc8f4b41e2 100644 --- a/CORE/VOSS/src/vos_api.c +++ b/CORE/VOSS/src/vos_api.c @@ -77,11 +77,6 @@ #include "vos_trace.h" -#ifdef WLAN_BTAMP_FEATURE -#include "bapApi.h" -#include "bapInternal.h" -#include "bap_hdd_main.h" -#endif //WLAN_BTAMP_FEATURE #include "bmi.h" #include "ol_fw.h" @@ -954,15 +949,6 @@ VOS_STATUS vos_close( v_CONTEXT_t vosContext ) { VOS_STATUS vosStatus; -#ifdef WLAN_BTAMP_FEATURE - vosStatus = WLANBAP_Close(vosContext); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to close BAP", __func__); - VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); - } -#endif // WLAN_BTAMP_FEATURE if (gpVosContext->htc_ctx) { @@ -1107,13 +1093,6 @@ v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId, break; } -#ifdef WLAN_BTAMP_FEATURE - case VOS_MODULE_ID_BAP: - { - pModContext = gpVosContext->pBAPContext; - break; - } -#endif //WLAN_BTAMP_FEATURE #ifndef WLAN_FEATURE_MBSSID case VOS_MODULE_ID_SAP: @@ -1396,13 +1375,6 @@ VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, break; } -#ifdef WLAN_BTAMP_FEATURE - case VOS_MODULE_ID_BAP: - { - pGpModContext = &(gpVosContext->pBAPContext); - break; - } -#endif //WLAN_BTAMP_FEATURE #ifndef WLAN_FEATURE_MBSSID case VOS_MODULE_ID_SAP: @@ -1523,13 +1495,6 @@ VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, break; } -#ifdef WLAN_BTAMP_FEATURE - case VOS_MODULE_ID_BAP: - { - pGpModContext = &(gpVosContext->pBAPContext); - break; - } -#endif //WLAN_BTAMP_FEATURE #ifndef WLAN_FEATURE_MBSSID case VOS_MODULE_ID_SAP: @@ -2095,15 +2060,6 @@ VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext) { VOS_STATUS vosStatus; -#ifdef WLAN_BTAMP_FEATURE - vosStatus = WLANBAP_Close(vosContext); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) - { - VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, - "%s: Failed to close BAP", __func__); - VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); - } -#endif // WLAN_BTAMP_FEATURE vosStatus = WLANTL_Close(vosContext); if (!VOS_IS_STATUS_SUCCESS(vosStatus)) diff --git a/CORE/VOSS/src/vos_sched.h b/CORE/VOSS/src/vos_sched.h index 6ec0ebf161c1..a67aef2f1a59 100644 --- a/CORE/VOSS/src/vos_sched.h +++ b/CORE/VOSS/src/vos_sched.h @@ -365,9 +365,6 @@ typedef struct _VosContextType /* MAC Module Context */ v_VOID_t *pMACContext; - /* BAP Context */ - v_VOID_t *pBAPContext; - #ifndef WLAN_FEATURE_MBSSID /* SAP Context */ v_VOID_t *pSAPContext; diff --git a/CORE/VOSS/src/vos_trace.c b/CORE/VOSS/src/vos_trace.c index 3f8057ec64c9..43ecfac8a160 100644 --- a/CORE/VOSS/src/vos_trace.c +++ b/CORE/VOSS/src/vos_trace.c @@ -96,7 +96,6 @@ typedef struct // the 3 character 'name' of the module for marking the trace logs. moduleTraceInfo gVosTraceInfo[ VOS_MODULE_ID_MAX ] = { - [VOS_MODULE_ID_BAP] = { VOS_DEFAULT_TRACE_LEVEL, "BAP" }, [VOS_MODULE_ID_TL] = { VOS_DEFAULT_TRACE_LEVEL, "TL " }, [VOS_MODULE_ID_WDI] = { VOS_DEFAULT_TRACE_LEVEL, "WDI" }, [VOS_MODULE_ID_HDD] = { VOS_DEFAULT_TRACE_LEVEL, "HDD" }, @@ -33,9 +33,6 @@ ifeq ($(KERNEL_BUILD), 0) # These are configurable via Kconfig for kernel-based builds # Need to explicitly configure for Android-based builds - #Flag to enable BlueTooth AMP feature - CONFIG_PRIMA_WLAN_BTAMP := n - #Flag to enable Legacy Fast Roaming3(LFR3) CONFIG_QCACLD_WLAN_LFR3 := y @@ -258,35 +255,6 @@ ADF_OBJS := $(ADF_DIR)/adf_nbuf.o \ $(ADF_DIR)/linux/adf_os_defer_pvt.o \ $(ADF_DIR)/linux/adf_os_lock_pvt.o -############ BAP ############ -BAP_DIR := CORE/BAP -BAP_INC_DIR := $(BAP_DIR)/inc -BAP_SRC_DIR := $(BAP_DIR)/src - -BAP_INC := -I$(WLAN_ROOT)/$(BAP_INC_DIR) \ - -I$(WLAN_ROOT)/$(BAP_SRC_DIR) - -BAP_OBJS := $(BAP_SRC_DIR)/bapApiData.o \ - $(BAP_SRC_DIR)/bapApiDebug.o \ - $(BAP_SRC_DIR)/bapApiExt.o \ - $(BAP_SRC_DIR)/bapApiHCBB.o \ - $(BAP_SRC_DIR)/bapApiInfo.o \ - $(BAP_SRC_DIR)/bapApiLinkCntl.o \ - $(BAP_SRC_DIR)/bapApiLinkSupervision.o \ - $(BAP_SRC_DIR)/bapApiStatus.o \ - $(BAP_SRC_DIR)/bapApiTimer.o \ - $(BAP_SRC_DIR)/bapModule.o \ - $(BAP_SRC_DIR)/bapRsn8021xAuthFsm.o \ - $(BAP_SRC_DIR)/bapRsn8021xPrf.o \ - $(BAP_SRC_DIR)/bapRsn8021xSuppRsnFsm.o \ - $(BAP_SRC_DIR)/bapRsnAsfPacket.o \ - $(BAP_SRC_DIR)/bapRsnSsmAesKeyWrap.o \ - $(BAP_SRC_DIR)/bapRsnSsmEapol.o \ - $(BAP_SRC_DIR)/bapRsnSsmReplayCtr.o \ - $(BAP_SRC_DIR)/bapRsnTxRx.o \ - $(BAP_SRC_DIR)/btampFsm.o \ - $(BAP_SRC_DIR)/btampHCI.o - ifeq ($(CONFIG_QCA_WIFI_SDIO), 1) ############ HIF ############ HIF_DIR := CORE/SERVICES/HIF @@ -335,8 +303,7 @@ HDD_SRC_DIR := $(HDD_DIR)/src HDD_INC := -I$(WLAN_ROOT)/$(HDD_INC_DIR) \ -I$(WLAN_ROOT)/$(HDD_SRC_DIR) -HDD_OBJS := $(HDD_SRC_DIR)/bap_hdd_main.o \ - $(HDD_SRC_DIR)/wlan_hdd_assoc.o \ +HDD_OBJS := $(HDD_SRC_DIR)/wlan_hdd_assoc.o \ $(HDD_SRC_DIR)/wlan_hdd_cfg.o \ $(HDD_SRC_DIR)/wlan_hdd_debugfs.o \ $(HDD_SRC_DIR)/wlan_hdd_dev_pwr.o \ @@ -806,8 +773,7 @@ WCNSS_INC := -I$(WLAN_ROOT)/wcnss/inc LINUX_INC := -Iinclude/linux -INCS := $(BAP_INC) \ - $(HDD_INC) \ +INCS := $(HDD_INC) \ $(EPPING_INC) \ $(LINUX_INC) \ $(MAC_INC) \ @@ -841,8 +807,7 @@ ifeq ($(CONFIG_REMOVE_PKT_LOG), 0) INCS += $(PKTLOG_INC) endif -OBJS := $(BAP_OBJS) \ - $(HDD_OBJS) \ +OBJS := $(HDD_OBJS) \ $(EPPING_OBJS) \ $(MAC_OBJS) \ $(SAP_OBJS) \ @@ -1004,10 +969,6 @@ CDEFINES += -DCONFIG_TDLS_IMPLICIT #CDEFINES += -DFEATURE_WLAN_TDLS_INTERNAL endif -ifeq ($(CONFIG_PRIMA_WLAN_BTAMP),y) -CDEFINES += -DWLAN_BTAMP_FEATURE -endif - ifeq ($(CONFIG_QCACLD_WLAN_LFR3),y) CDEFINES += -DWLAN_FEATURE_ROAM_OFFLOAD endif diff --git a/firmware_bin/WCNSS_qcom_cfg.ini b/firmware_bin/WCNSS_qcom_cfg.ini index ba2f35a0029e..83e6de6c18f5 100755 --- a/firmware_bin/WCNSS_qcom_cfg.ini +++ b/firmware_bin/WCNSS_qcom_cfg.ini @@ -554,7 +554,7 @@ gBusBandwidthMediumThreshold=10000 gBusBandwidthLowThreshold=3000 # Bus bandwidth compute timeout value in ms -gBusBandwidthComputeInterval=3000 +gBusBandwidthComputeInterval=2000 # Regulatory Setting; 0=STRICT; 1=CUSTOM gRegulatoryChangeCountry=1 |
