updated example name”
This commit is contained in:
192
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_data.h
Normal file
192
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_data.h
Normal file
@@ -0,0 +1,192 @@
|
||||
/*******************************************************************************
|
||||
Filename: hci_c_data.h
|
||||
Revised: $Date: 2011-08-22 08:41:40 -0700 (Mon, 22 Aug 2011) $
|
||||
Revision: $Revision: 27235 $
|
||||
|
||||
Description: This file handles HCI data for the BLE Controller.
|
||||
|
||||
Copyright 2009-2011 Texas Instruments Incorporated. All rights reserved.
|
||||
|
||||
IMPORTANT: Your use of this Software is limited to those specific rights
|
||||
granted under the terms of a software license agreement between the user
|
||||
who downloaded the software, his/her employer (which must be your employer)
|
||||
and Texas Instruments Incorporated (the "License"). You may not use this
|
||||
Software unless you agree to abide by the terms of the License. The License
|
||||
limits your use, and you acknowledge, that the Software may not be modified,
|
||||
copied or distributed unless embedded on a Texas Instruments microcontroller
|
||||
or used solely and exclusively in conjunction with a Texas Instruments radio
|
||||
frequency transceiver, which is integrated into your product. Other than for
|
||||
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
|
||||
works of, modify, distribute, perform, display or sell this Software and/or
|
||||
its documentation for any purpose.
|
||||
|
||||
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
|
||||
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
|
||||
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
|
||||
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
|
||||
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
|
||||
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
|
||||
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
|
||||
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
|
||||
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
|
||||
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
|
||||
|
||||
Should you have any questions regarding your right to use this Software,
|
||||
contact Texas Instruments Incorporated at www.TI.com.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef HCI_C_DATA_H
|
||||
#define HCI_C_DATA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
#include "osal_bufmgr.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
|
||||
#define HCI_ResetControllerBuffers() HCI_TxDataBufferInit()
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
#define UNDEFINED_CONN_HANDLE 0xFFFF
|
||||
|
||||
// Data State
|
||||
#define DATA_BUF_FREE 0
|
||||
#define DATA_BUF_IN_USE 1
|
||||
#define DATA_BUF_PENDING 2
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 state; // DATA_BUF_FREE, DATA_BUF_IN_USE, DATA_BUF_PENDING
|
||||
uint16 connHandle; // Connection Handle
|
||||
uint8 fragFlag; // Packet Boundary Flag
|
||||
uint16 len; // Data Length
|
||||
uint8 *pData; // Pointer to Packet Payload
|
||||
} hciTxData_t;
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
/*
|
||||
** HCI Data API
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* This function will initialize the buffers for transmit data.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_TxDataBufferInit( void );
|
||||
|
||||
|
||||
#if defined(CTRL_CONFIG) && ((CTRL_CONFIG & ADV_CONN_CFG) || (CTRL_CONFIG & INIT_CFG))
|
||||
/*******************************************************************************
|
||||
* @fn HCI_TxDataBufferInsert
|
||||
*
|
||||
* @brief This function will insert a transmit data packet into the free
|
||||
* buffers.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param connHandle - Connection handle.
|
||||
* @param pbFlag - Packet Boundary Flag.
|
||||
* @param pktLen - Number of bytes of data to transmit.
|
||||
* @param *pData - Pointer to data buffer to transmit.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return HCI_SUCCESS, HCI_ERROR_CODE_MEM_CAP_EXCEEDED
|
||||
*/
|
||||
extern hciStatus_t HCI_TxDataBufferInsert( uint16 connHandle,
|
||||
uint8 pbFlag,
|
||||
uint16 pktLen,
|
||||
uint8 *pData );
|
||||
#endif // CTRL_CONFIG=(ADV_CONN_CFG | INIT_CFG)
|
||||
|
||||
|
||||
#if defined(CTRL_CONFIG) && ((CTRL_CONFIG & ADV_CONN_CFG) || (CTRL_CONFIG & INIT_CFG))
|
||||
/*******************************************************************************
|
||||
* @fn HCI_TxDataSend
|
||||
*
|
||||
* @brief This function sends an ACL transmit data packet to the LL. If
|
||||
* the packet is successfully transferred to the TX FIFO by the
|
||||
* LL, then the buffer can be freed. Otherwise, the packet is
|
||||
* still pending in the LL, so it can't be released. If any error
|
||||
* occurs (due to parametric checks), then the buffer is freed
|
||||
* and a Number of Completed Packets event is generated with the
|
||||
* number of completed packets set to zero.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param connHandle - Connection handle, or HCI_TX_DATA_ANY_CONNECTION.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_TxDataSend( uint8 connHandle );
|
||||
#endif // CTRL_CONFIG=(ADV_CONN_CFG | INIT_CFG)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_ReverseBytes
|
||||
*
|
||||
* @brief This function is used to reverse the order of the bytes in
|
||||
* an array in place.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param *buf - Pointer to buffer containing bytes to be reversed.
|
||||
* @param len - Number of bytes in buffer.
|
||||
*
|
||||
* Note: The length must be even.
|
||||
*
|
||||
* Note: The maximum length is 128 bytes.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_ReverseBytes( uint8 *buf,
|
||||
uint8 len );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HCI_C_DATA_H */
|
||||
299
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_event.h
Normal file
299
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_event.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/*******************************************************************************
|
||||
Filename: hci_c_event.h
|
||||
Revised: $Date: 2012-05-01 12:13:50 -0700 (Tue, 01 May 2012) $
|
||||
Revision: $Revision: 30418 $
|
||||
|
||||
Description: This file contains the HCI Event types, contants,
|
||||
external functions etc. for the BLE Controller.
|
||||
|
||||
Copyright 2009-2011 Texas Instruments Incorporated. All rights reserved.
|
||||
|
||||
IMPORTANT: Your use of this Software is limited to those specific rights
|
||||
granted under the terms of a software license agreement between the user
|
||||
who downloaded the software, his/her employer (which must be your employer)
|
||||
and Texas Instruments Incorporated (the "License"). You may not use this
|
||||
Software unless you agree to abide by the terms of the License. The License
|
||||
limits your use, and you acknowledge, that the Software may not be modified,
|
||||
copied or distributed unless embedded on a Texas Instruments microcontroller
|
||||
or used solely and exclusively in conjunction with a Texas Instruments radio
|
||||
frequency transceiver, which is integrated into your product. Other than for
|
||||
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
|
||||
works of, modify, distribute, perform, display or sell this Software and/or
|
||||
its documentation for any purpose.
|
||||
|
||||
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
|
||||
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
|
||||
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
|
||||
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
|
||||
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
|
||||
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
|
||||
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
|
||||
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
|
||||
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
|
||||
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
|
||||
|
||||
Should you have any questions regarding your right to use this Software,
|
||||
contact Texas Instruments Incorporated at www.TI.com.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef HCI_C_EVENT_H
|
||||
#define HCI_C_EVENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
#include "hci_tl.h"
|
||||
|
||||
extern uint8 bleEvtMask;
|
||||
extern uint8 pHciEvtMask[];
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
// Event Mask Default Values
|
||||
#define BT_EVT_MASK_BYTE0 0xFF
|
||||
#define BT_EVT_MASK_BYTE1 0xFF
|
||||
#define BT_EVT_MASK_BYTE2 0xFF
|
||||
#define BT_EVT_MASK_BYTE3 0xFF
|
||||
#define BT_EVT_MASK_BYTE4 0xFF
|
||||
#define BT_EVT_MASK_BYTE5 0x9F
|
||||
#define BT_EVT_MASK_BYTE6 0x00
|
||||
#define BT_EVT_MASK_BYTE7 0x20
|
||||
//
|
||||
#define LE_EVT_MASK_DEFAULT 0x1F
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
/*
|
||||
** Internal Functions
|
||||
*/
|
||||
|
||||
extern void hciInitEventMasks( void );
|
||||
|
||||
/*
|
||||
** HCI Controller Events
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_DataBufferOverflowEvent
|
||||
*
|
||||
* @brief This function sends the Data Buffer Overflow Event to the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param linkType - HCI_LINK_TYPE_SCO_BUFFER_OVERFLOW,
|
||||
* HCI_LINK_TYPE_ACL_BUFFER_OVERFLOW
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_DataBufferOverflowEvent( uint8 linkType );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_NumOfCompletedPacketsEvent
|
||||
*
|
||||
* @brief This function sends the Number of Completed Packets Event to
|
||||
* the Host.
|
||||
*
|
||||
* Note: Currently, the number of handles is always one.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param numHandles - Number of handles.
|
||||
* @param handlers - Array of connection handles.
|
||||
* @param numCompletedPkts - Array of number of completed packets for
|
||||
* each handle.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_NumOfCompletedPacketsEvent( uint8 numHandles,
|
||||
uint16 *handlers,
|
||||
uint16 *numCompletedPackets );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_CommandCompleteEvent
|
||||
*
|
||||
* @brief This function sends a Command Complete Event to the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param opcode - The opcode of the command that generated this event.
|
||||
* @param numParam - The number of parameters in the event.
|
||||
* @param param - The event parameters associated with the command.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_CommandCompleteEvent( uint16 opcode,
|
||||
uint8 numParam,
|
||||
uint8 *param );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_VendorSpecifcCommandCompleteEvent
|
||||
*
|
||||
* @brief This function sends a Vendor Specific Command Complete Event to
|
||||
* the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param opcode - The opcode of the command that generated this event.
|
||||
* @param numParam - The number of parameters in the event.
|
||||
* @param param - The event parameters associated with the command.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_VendorSpecifcCommandCompleteEvent( uint16 opcode,
|
||||
uint8 len,
|
||||
uint8 *param );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_CommandStatusEvent
|
||||
*
|
||||
* @brief This function sends a Command Status Event to the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param status - The resulting status of the comamnd.
|
||||
* @param opcode - The opcode of the command that generated this event.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_CommandStatusEvent( uint8 status,
|
||||
uint16 opcode );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_HardwareErrorEvent
|
||||
*
|
||||
* @brief This function sends a Hardware Error Event to the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param hwErrorCode - The hardware error code.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_HardwareErrorEvent( uint8 hwErrorCode );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_SendCommandStatusEvent
|
||||
*
|
||||
* @brief This generic function sends a Command Status event to the Host.
|
||||
* It is provided as a direct call so the Host can use it directly.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param eventCode - The event code.
|
||||
* @param status - The resulting status of the comamnd.
|
||||
* @param opcode - The opcode of the command that generated this event.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_SendCommandStatusEvent ( uint8 eventCode,
|
||||
uint16 status,
|
||||
uint16 opcode );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_SendCommandCompleteEvent
|
||||
*
|
||||
* @brief This generic function sends a Command Complete or a Vendor
|
||||
* Specific Command Complete Event to the Host.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param eventCode - The event code.
|
||||
* @param opcode - The opcode of the command that generated this event.
|
||||
* @param numParam - The number of parameters in the event.
|
||||
* @param param - The event parameters associated with the command.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_SendCommandCompleteEvent ( uint8 eventCode,
|
||||
uint16 opcode,
|
||||
uint8 numParam,
|
||||
uint8 *param );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_SendControllerToHostEvent
|
||||
*
|
||||
* @brief This generic function sends a Controller to Host Event.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param eventCode - Bluetooth event code.
|
||||
* @param dataLen - Length of dataField.
|
||||
* @param pData - Pointer to data.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_SendControllerToHostEvent( uint8 eventCode,
|
||||
uint8 dataLen,
|
||||
uint8 *pData );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HCI_C_EVENT_H */
|
||||
331
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_tl.h
Normal file
331
cc25xx-example/ti/BLE-CC254x/Components/ble/hci/hci_tl.h
Normal file
@@ -0,0 +1,331 @@
|
||||
/*******************************************************************************
|
||||
Filename: hci_tl.h
|
||||
Revised: $Date: 2012-04-20 15:24:45 -0700 (Fri, 20 Apr 2012) $
|
||||
Revision: $Revision: 30292 $
|
||||
|
||||
Description: This file contains the types, contants, external functions
|
||||
etc. for the BLE HCI Transport Layer.
|
||||
|
||||
Copyright 2009-2013 Texas Instruments Incorporated. All rights reserved.
|
||||
|
||||
IMPORTANT: Your use of this Software is limited to those specific rights
|
||||
granted under the terms of a software license agreement between the user
|
||||
who downloaded the software, his/her employer (which must be your employer)
|
||||
and Texas Instruments Incorporated (the "License"). You may not use this
|
||||
Software unless you agree to abide by the terms of the License. The License
|
||||
limits your use, and you acknowledge, that the Software may not be modified,
|
||||
copied or distributed unless embedded on a Texas Instruments microcontroller
|
||||
or used solely and exclusively in conjunction with a Texas Instruments radio
|
||||
frequency transceiver, which is integrated into your product. Other than for
|
||||
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
|
||||
works of, modify, distribute, perform, display or sell this Software and/or
|
||||
its documentation for any purpose.
|
||||
|
||||
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
|
||||
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
|
||||
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
|
||||
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
|
||||
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
|
||||
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
|
||||
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
|
||||
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
|
||||
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
|
||||
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
|
||||
|
||||
Should you have any questions regarding your right to use this Software,
|
||||
contact Texas Instruments Incorporated at www.TI.com.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef HCI_TL_H
|
||||
#define HCI_TL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
|
||||
#include "hci.h"
|
||||
#include "OSAL.h"
|
||||
#include "hal_uart.h"
|
||||
#include "hci_data.h"
|
||||
#include "hci_event.h"
|
||||
|
||||
extern uint8 hciTaskID;
|
||||
//
|
||||
extern uint8 hciTestTaskID;
|
||||
extern uint8 hciGapTaskID;
|
||||
extern uint8 hciL2capTaskID;
|
||||
extern uint8 hciSmpTaskID;
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
|
||||
#define HCI_ASSERT(condition) HAL_ASSERT(condition)
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
// OSAL Task Events
|
||||
#define HCI_TX_PROCESS_EVENT 0x0001
|
||||
#define HCI_TEST_UART_SEND_EVENT 0x0002
|
||||
#define HCI_BDADDR_UPDATED_EVENT 0x4000
|
||||
#define HCI_OSAL_MSG_EVENT SYS_EVENT_MSG
|
||||
|
||||
// OSAL Message Header Events
|
||||
#define HCI_CONTROLLER_TO_HOST_EVENT 0x01
|
||||
#define HCI_HOST_TO_CTRL_CMD_EVENT 0x02
|
||||
#define HCI_HOST_TO_CTRL_DATA_EVENT 0x03
|
||||
|
||||
#define HCI_BDADDR_LEN 6
|
||||
|
||||
// Max Buffers Supported
|
||||
#define HCI_MAX_NUM_DATA_BUFFERS 0x04
|
||||
#define HCI_MAX_NUM_CMD_BUFFERS 0x01
|
||||
|
||||
// Max Allowed HCI Packet
|
||||
#define HCI_MAX_CMD_PKT_SIZE 0xFF
|
||||
#define HCI_MAX_DATA_PKT_SIZE 0xFFFF
|
||||
|
||||
// Max Data Length in Packet
|
||||
#define HCI_DATA_MAX_DATA_LENGTH 27
|
||||
|
||||
//
|
||||
// Minimum length for CMD packet is 1+2+1
|
||||
// | Packet Type (1) | OPCode(2) | Length(1) |
|
||||
//
|
||||
#define HCI_CMD_MIN_LENGTH 4
|
||||
|
||||
//
|
||||
// Minimum length for EVENT packet is 1+1+1
|
||||
// | Packet Type (1) | Event Code(1) | Length(1) |
|
||||
//
|
||||
#define HCI_EVENT_MIN_LENGTH 3
|
||||
|
||||
//
|
||||
// Minimum length for DATA packet is 1+2+2
|
||||
// | Packet Type (1) | Handler(2) | Length(2) |
|
||||
//
|
||||
#define HCI_DATA_MIN_LENGTH 5
|
||||
|
||||
// Max Number of Connections
|
||||
#define HCI_MAX_NUM_CONNECTIONS 0x03
|
||||
//
|
||||
#define HCI_TX_DATA_ANY_CONNECTION 0xFF
|
||||
|
||||
// HCI Packet Types
|
||||
#define HCI_CMD_PACKET 0x01
|
||||
#define HCI_ACL_DATA_PACKET 0x02
|
||||
#define HCI_SCO_DATA_PACKET 0x03
|
||||
#define HCI_EVENT_PACKET 0x04
|
||||
|
||||
/*
|
||||
** HCI Command Opcodes
|
||||
*/
|
||||
|
||||
// Link Control Commands
|
||||
#define HCI_DISCONNECT 0x0406
|
||||
#define HCI_READ_REMOTE_VERSION_INFO 0x041D
|
||||
|
||||
// Controller and Baseband Commands
|
||||
#define HCI_SET_EVENT_MASK 0x0C01
|
||||
#define HCI_RESET 0x0C03
|
||||
#define HCI_READ_TRANSMIT_POWER 0x0C2D
|
||||
#define HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL 0x0C31
|
||||
#define HCI_HOST_BUFFER_SIZE 0x0C33
|
||||
#define HCI_HOST_NUM_COMPLETED_PACKETS 0x0C35
|
||||
|
||||
// Information Parameters
|
||||
#define HCI_READ_LOCAL_VERSION_INFO 0x1001
|
||||
#define HCI_READ_LOCAL_SUPPORTED_COMMANDS 0x1002
|
||||
#define HCI_READ_LOCAL_SUPPORTED_FEATURES 0x1003
|
||||
#define HCI_READ_BDADDR 0x1009
|
||||
|
||||
// Status Parameters
|
||||
#define HCI_READ_RSSI 0x1405
|
||||
|
||||
// LE Commands
|
||||
#define HCI_LE_SET_EVENT_MASK 0x2001
|
||||
#define HCI_LE_READ_BUFFER_SIZE 0x2002
|
||||
#define HCI_LE_READ_LOCAL_SUPPORTED_FEATURES 0x2003
|
||||
#define HCI_LE_SET_RANDOM_ADDR 0x2005
|
||||
#define HCI_LE_SET_ADV_PARAM 0x2006
|
||||
#define HCI_LE_READ_ADV_CHANNEL_TX_POWER 0x2007
|
||||
#define HCI_LE_SET_ADV_DATA 0x2008
|
||||
#define HCI_LE_SET_SCAN_RSP_DATA 0x2009
|
||||
#define HCI_LE_SET_ADV_ENABLE 0x200A
|
||||
#define HCI_LE_SET_SCAN_PARAM 0x200B
|
||||
#define HCI_LE_SET_SCAN_ENABLE 0x200C
|
||||
#define HCI_LE_CREATE_CONNECTION 0x200D
|
||||
#define HCI_LE_CREATE_CONNECTION_CANCEL 0x200E
|
||||
#define HCI_LE_READ_WHITE_LIST_SIZE 0x200F
|
||||
#define HCI_LE_CLEAR_WHITE_LIST 0x2010
|
||||
#define HCI_LE_ADD_WHITE_LIST 0x2011
|
||||
#define HCI_LE_REMOVE_WHITE_LIST 0x2012
|
||||
#define HCI_LE_CONNECTION_UPDATE 0x2013
|
||||
#define HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x2014
|
||||
#define HCI_LE_READ_CHANNEL_MAP 0x2015
|
||||
#define HCI_LE_READ_REMOTE_USED_FEATURES 0x2016
|
||||
#define HCI_LE_ENCRYPT 0x2017
|
||||
#define HCI_LE_RAND 0x2018
|
||||
#define HCI_LE_START_ENCRYPTION 0x2019
|
||||
#define HCI_LE_LTK_REQ_REPLY 0x201A
|
||||
#define HCI_LE_LTK_REQ_NEG_REPLY 0x201B
|
||||
#define HCI_LE_READ_SUPPORTED_STATES 0x201C
|
||||
#define HCI_LE_RECEIVER_TEST 0x201D
|
||||
#define HCI_LE_TRANSMITTER_TEST 0x201E
|
||||
#define HCI_LE_TEST_END 0x201F
|
||||
|
||||
// LE Vendor Specific LL Extension Commands
|
||||
#define HCI_EXT_SET_RX_GAIN 0xFC00
|
||||
#define HCI_EXT_SET_TX_POWER 0xFC01
|
||||
#define HCI_EXT_ONE_PKT_PER_EVT 0xFC02
|
||||
#define HCI_EXT_CLK_DIVIDE_ON_HALT 0xFC03
|
||||
#define HCI_EXT_DECLARE_NV_USAGE 0xFC04
|
||||
#define HCI_EXT_DECRYPT 0xFC05
|
||||
#define HCI_EXT_SET_LOCAL_SUPPORTED_FEATURES 0xFC06
|
||||
#define HCI_EXT_SET_FAST_TX_RESP_TIME 0xFC07
|
||||
#define HCI_EXT_MODEM_TEST_TX 0xFC08
|
||||
#define HCI_EXT_MODEM_HOP_TEST_TX 0xFC09
|
||||
#define HCI_EXT_MODEM_TEST_RX 0xFC0A
|
||||
#define HCI_EXT_END_MODEM_TEST 0xFC0B
|
||||
#define HCI_EXT_SET_BDADDR 0xFC0C
|
||||
#define HCI_EXT_SET_SCA 0xFC0D
|
||||
#define HCI_EXT_ENABLE_PTM 0xFC0E // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_SET_FREQ_TUNE 0xFC0F
|
||||
#define HCI_EXT_SAVE_FREQ_TUNE 0xFC10
|
||||
#define HCI_EXT_SET_MAX_DTM_TX_POWER 0xFC11
|
||||
#define HCI_EXT_MAP_PM_IO_PORT 0xFC12
|
||||
#define HCI_EXT_DISCONNECT_IMMED 0xFC13
|
||||
#define HCI_EXT_PER 0xFC14
|
||||
#define HCI_EXT_PER_BY_CHAN 0xFC15 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_EXTEND_RF_RANGE 0xFC16
|
||||
#define HCI_EXT_ADV_EVENT_NOTICE 0xFC17 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_CONN_EVENT_NOTICE 0xFC18 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_HALT_DURING_RF 0xFC19
|
||||
#define HCI_EXT_OVERRIDE_SL 0xFC1A
|
||||
#define HCI_EXT_BUILD_REVISION 0xFC1B
|
||||
|
||||
/*
|
||||
** HCI Event Codes
|
||||
*/
|
||||
|
||||
// BT Events
|
||||
#define HCI_DISCONNECTION_COMPLETE_EVENT_CODE 0x05
|
||||
#define HCI_ENCRYPTION_CHANGE_EVENT_CODE 0x08
|
||||
#define HCI_READ_REMOTE_INFO_COMPLETE_EVENT_CODE 0x0C
|
||||
#define HCI_COMMAND_COMPLETE_EVENT_CODE 0x0E
|
||||
#define HCI_COMMAND_STATUS_EVENT_CODE 0x0F
|
||||
#define HCI_BLE_HARDWARE_ERROR_EVENT_CODE 0x10
|
||||
#define HCI_NUM_OF_COMPLETED_PACKETS_EVENT_CODE 0x13
|
||||
#define HCI_DATA_BUFFER_OVERFLOW_EVENT 0x1A
|
||||
#define HCI_KEY_REFRESH_COMPLETE_EVENT_CODE 0x30
|
||||
|
||||
// LE Event Code (for LE Meta Events)
|
||||
#define HCI_LE_EVENT_CODE 0x3E
|
||||
|
||||
// LE Meta Event Codes
|
||||
#define HCI_BLE_CONNECTION_COMPLETE_EVENT 0x01
|
||||
#define HCI_BLE_ADV_REPORT_EVENT 0x02
|
||||
#define HCI_BLE_CONN_UPDATE_COMPLETE_EVENT 0x03
|
||||
#define HCI_BLE_READ_REMOTE_FEATURE_COMPLETE_EVENT 0x04
|
||||
#define HCI_BLE_LTK_REQUESTED_EVENT 0x05
|
||||
|
||||
// Vendor Specific Event Code
|
||||
#define HCI_VE_EVENT_CODE 0xFF
|
||||
|
||||
// LE Vendor Specific LL Extension Events
|
||||
#define HCI_EXT_SET_RX_GAIN_EVENT 0x0400
|
||||
#define HCI_EXT_SET_TX_POWER_EVENT 0x0401
|
||||
#define HCI_EXT_ONE_PKT_PER_EVT_EVENT 0x0402
|
||||
#define HCI_EXT_CLK_DIVIDE_ON_HALT_EVENT 0x0403
|
||||
#define HCI_EXT_DECLARE_NV_USAGE_EVENT 0x0404
|
||||
#define HCI_EXT_DECRYPT_EVENT 0x0405
|
||||
#define HCI_EXT_SET_LOCAL_SUPPORTED_FEATURES_EVENT 0x0406
|
||||
#define HCI_EXT_SET_FAST_TX_RESP_TIME_EVENT 0x0407
|
||||
#define HCI_EXT_MODEM_TEST_TX_EVENT 0x0408
|
||||
#define HCI_EXT_MODEM_HOP_TEST_TX_EVENT 0x0409
|
||||
#define HCI_EXT_MODEM_TEST_RX_EVENT 0x040A
|
||||
#define HCI_EXT_END_MODEM_TEST_EVENT 0x040B
|
||||
#define HCI_EXT_SET_BDADDR_EVENT 0x040C
|
||||
#define HCI_EXT_SET_SCA_EVENT 0x040D
|
||||
#define HCI_EXT_ENABLE_PTM_EVENT 0x040E // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_SET_FREQ_TUNE_EVENT 0x040F
|
||||
#define HCI_EXT_SAVE_FREQ_TUNE_EVENT 0x0410
|
||||
#define HCI_EXT_SET_MAX_DTM_TX_POWER_EVENT 0x0411
|
||||
#define HCI_EXT_MAP_PM_IO_PORT_EVENT 0x0412
|
||||
#define HCI_EXT_DISCONNECT_IMMED_EVENT 0x0413
|
||||
#define HCI_EXT_PER_EVENT 0x0414
|
||||
#define HCI_EXT_PER_BY_CHAN_EVENT 0x0415 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_EXTEND_RF_RANGE_EVENT 0x0416
|
||||
#define HCI_EXT_ADV_EVENT_NOTICE_EVENT 0x0417 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_CONN_EVENT_NOTICE_EVENT 0x0418 // Not a supported HCI command! Application only.
|
||||
#define HCI_EXT_HALT_DURING_RF_EVENT 0x0419
|
||||
#define HCI_EXT_OVERRIDE_SL_EVENT 0x041A
|
||||
#define HCI_EXT_BUILD_REVISION_EVENT 0x041B
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
/*
|
||||
** HCI OSAL API
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_Init
|
||||
*
|
||||
* @brief This is the HCI OSAL task initialization routine.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param taskID - The HCI OSAL task identifer.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
extern void HCI_Init( uint8 taskID );
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HCI_ProcessEvent
|
||||
*
|
||||
* @brief This is the HCI OSAL task process event handler.
|
||||
*
|
||||
* input parameters
|
||||
*
|
||||
* @param taskID - The HCI OSAL task identifer.
|
||||
* @param events - HCI OSAL task events.
|
||||
*
|
||||
* output parameters
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return Unprocessed events.
|
||||
*/
|
||||
extern uint16 HCI_ProcessEvent( uint8 task_id,
|
||||
uint16 events );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HCI_TL_H */
|
||||
Reference in New Issue
Block a user