?? hci.h
字號:
/*
This file mainly define the structs of command parameters and return parameters
we often use and some operation for these structs.
*/
/*
**********************************************************************************************************
*
* hci DRIVERS FOR NUCLEUS
*
* (c) Copyright 2003-2015, cn
* All Rights Reserved
*
* hci DRIVERS Program for 1.0
*
* File Name : hci.h
* By Write : chenna
* First Write : 2004-08-25 13:36
* Last Write : 2004-08-25 13:36
* where Write : Room B201 Shenzhen International Tech-innovation Academy, Kejinan 10 Road,
* High-Tech Industrial Park,Shenzhen,China.
* Function : packet the hci command and analyze the event packet
* 1.
* 2.
* 3.
***********************************************************************************************************
*/
#ifndef __HCI_H
#define __HCI_H
#include "sd_extr.h"
/*
***********************************************************************************************************
* 基本數(shù)據(jù)定義(原ption.h)
*
***********************************************************************************************************
*/
#ifndef __DATA_TYPE_DEF_H__
#define VOID void
typedef signed char INT8;
//#define UINT8 char
//#define INT16 short
//#define UINT16 short
//typedef signed int INT32;
#define INT32 int
#define NULL 0
#endif
#define HCI_COMMAND_PKT 0x01
#define HCI_ACLDATA_PKT 0x02
#define HCI_SCODATA_PKT 0x03
#define HCI_EVENT_PKT 0x04
#define HCI_UNKNOWN_PKT 0xff
/* This section define the status of operation.It is used to debug.
//hdev->flags
#define HCI_INIT 0x0010
#define HCI_UP 0x0020
#define HCI_RUNNING 0x0040
*/
#define HCI_PSCAN 0x0100 //page scan flags
#define HCI_ISCAN 0x0200 //inquiry scan flags
#define HCI_AUTH 0x0400 //authen flags
//link type
#define SCO_LINK 0x00
#define ACL_LINK 0x01
//packet type
#define HCI_DM1 0x0008
#define HCI_DM3 0x0400
#define HCI_DM5 0x4000
#define HCI_DH1 0x0010
#define HCI_DH3 0x0800
#define HCI_DH5 0x8000
//time slot
#define LMP_3SLOT 0x01
#define LMP_5SLOT 0x02
#define LMP_ENCRYPT 0x04
#define LMP_SOFFSET 0x08
#define LMP_TACCURACY 0x10
#define LMP_RSWITCH 0x20
#define LMP_HOLD 0x40
#define LMP_SNIF 0x80
#define LMP_PARK 0x01
#define LMP_RSSI 0x02
#define LMP_QUALITY 0x04
#define LMP_SCO 0x08
#define LMP_HV2 0x10
#define LMP_HV3 0x20
#define LMP_ULAW 0x40
#define LMP_ALAW 0x80
#define LMP_CVSD 0x01
#define LMP_PSCHEME 0x02
#define LMP_PCONTROL 0x04
/*******************************************************/
/*************** HCI Commands 命令定義 ************/
/*********************OGF & OCF values******************/
/*
***********************************************************************************************************
* Link Control
*
***********************************************************************************************************
*/
#define OGF_LINK_CTL 0x01
#define OCF_INQUIRY 0x0001
typedef __packed struct{
char lap[3];
char length;
char num_rsp;
}inquiry_cp;
#define INQUIRY_CP_SIZE 5
#define DEFAULT_INQUIRY_LENGTH 0xa
#define INQUIRY_CANCEL 0x0002
#define OCF_CREATE_CONN 0x0005
typedef __packed struct {
UINT8 bdaddr[6];
UINT16 pkt_type;
UINT8 pscan_rep_mode;
UINT8 pscan_mode;
UINT16 clock_offset;
UINT8 role_switch;
}create_conn_cp;
#define CREATE_CONN_CP_SIZE 13
#define OCF_DISCONNECT 0x0006
typedef __packed struct {
UINT16 handle;
UINT8 reason;
}disconnect_cp;
#define DISCONNECT_CP_SIZE 3
#define OCF_ADD_SCO_CONN 0x0007
typedef __packed struct{
UINT16 handle;
UINT16 pkt_type;
}add_sco_con_cp;
#define ADD_SCO_CONN_SIZE 4
#define OCF_ACCEPT_CONN_REQ 0x0009
typedef __packed struct {
UINT8 bdaddr[6];
UINT8 role;
}accept_conn_req_cp;
#define ACCEPT_CONN_REQ_CP_SIZE 7
#define OCF_REJECT_CONN_REQ 0x000A
typedef __packed struct{
UINT8 bdaddr[6];
UINT8 reason;
}reject_conn_cp;
#define REJECT_CONN_REQ_CP_SIZE 7
#define OCF_REMOTE_NAME_REQ 0x0019
typedef __packed struct{
UINT8 bdaddr[6];
UINT8 pscan_rep_mode;
UINT8 pscan_mode;
UINT8 clock_offset;
}remote_name_req_cp;
#define REMOTE_NAME_REQ_CP_SIZE 10
#define OCF_READ_CLK_OFFSET 0x001F
/*
***********************************************************************************************************
* Link Policy
*
***********************************************************************************************************
*/
#define OGF_LINK_POLICY 0x02
/*
***********************************************************************************************************
* Host Controller and Baseband
*
***********************************************************************************************************
*/
#define OGF_HOST_CTL 0x03
#define OCF_EVT_MSK 0x0001
#define OCF_RESET 0x0003
#define OCF_SET_EVENT_FLT 0x0005
typedef __packed struct{
UINT8 flt_type;
UINT8 cond_type;
UINT8 condition;
}set_event_flt_cp;
/* Filter types */
#define FLT_CLEAR_ALL 0x00
#define FLT_INQ_RESULT 0x01
#define FLT_CONN_SETUP 0x02
/* CONN_SETUP Condition types */
#define CONN_SETUP_ALLOW_ALL 0x00
#define CONN_SETUP_ALLOW_CLASS 0x01
#define CONN_SETUP_ALLOW_BDADDR 0x02
/* CONN_SETUP Conditions */
#define CONN_SETUP_AUTO_OFF 0x01
#define CONN_SETUP_AUTO_ON 0x02
#define OCF_FLUSH 0x0008
#define OCF_CHANGE_LOCAL_NAME 0x0013
#define OCF_READ_LOCAL_NAME 0x0014
typedef __packed struct {
UINT8 status;
UINT8 name[248];
}read_local_name_rp;
#define READ_LOCAL_NAME_RP_SIZE 249
#define OCF_WRITE_CA_TIMEOUT 0x0016
#define OCF_WRITE_PG_TIMEOUT 0x0018
#define OCF_WRITE_SCAN_ENABLE 0x001A
#define SCANS_DISABLED 0x00
#define IS_ENA_PS_DIS 0x01
#define IS_DIS_PS_ENA 0x02
#define IS_ENA_PS_ENA 0x03
#define OCF_READ_PAGE_SCAN_ACTIVITY 0x001B
typedef __packed struct{
UINT8 status;
UINT16 page_scan_interval;
UINT16 page_scan_window;
}read_page_scan_act_rp;
#define OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001C
typedef __packed struct{
UINT16 page_scan_interval;
UINT16 page_scan_window;
}write_page_scan_act_cp;
#define OCF_WRITE_AUTH_ENABLE 0x0020
#define AUTH_DISABLED 0x00
#define AUTH_ENABLED 0x01
#define OCF_READ_CLASS_OF_DEV 0x0023
typedef __packed struct {
UINT8 status;
UINT8 dev_class[3];
}read_class_of_dev_rp;
#define READ_CLASS_OF_DEV_RP_SIZE 4
#define OCF_WRITE_CLASS_OF_DEV 0x0024
typedef __packed struct {
UINT8 dev_class[3];
} write_class_of_dev_cp;
#define WRITE_CLASS_OF_DEV_CP_SIZE 3
#define OCF_WRITE_VOICE_SETTING 0x0026
#define IN_CODING_LINEAR 0<<8
#define IN_CODING_U 1<<8
#define IN_CODING_A 2<<8
#define IN_CODING 11<<8
#define IN_DATA_FORMAT_1_S 0<<6
#define IN_DATA_FORMAT_2_S 1<<6
#define IN_DATA_FORMAT_S_M 2<<6
#define IN_DATA_FORMAT 3<<6
#define IN_SAMPLE_SIZE_8 0<<5
#define IN_SAMPLE_SIZE_16 1<<5
#define IN_SAMPLE_SIZE 1<<5
#define LINEAR_PCM_BIT_POS 7<<2
#define AIR_CODE_FORMAT_CVSD 0
#define AIR_CODE_FORMAT_U 1
#define AIR_CODE_FORMAT_A 2
#define AIR_CODE_FORMAT 3
/*
***********************************************************************************************************
* Informational Parameters
*
***********************************************************************************************************
*/
#define OGF_INFO_PARAM 0x04
#define OCF_READ_LOCAL_VERSION 0x0001
typedef __packed struct{
UINT8 status;
UINT8 hci_ver;
UINT16 hci_rev;
UINT8 lmp_ver;
UINT16 man_name;
UINT16 lmp_sub;
}read_local_version_rp;
#define OCF_READ_LOCAL_VER_RP_SIZE 0x09
#define OCF_READ_LOCAL_FEATURES 0x0003
typedef __packed struct{
UINT8 status;
UINT8 features[8];
}read_local_features_rp;
#define READ_LOCAL_FEATURES_RP_SIZE 0x09
#define OCF_READ_BUFFER_SIZE 0x0005
typedef __packed struct{
UINT8 status;
UINT16 acl_mtu;
UINT8 sco_mtu;
UINT16 acl_max_pkt;
UINT16 sco_max_pkt;
}read_buffer_size_rp;
#define READ_BUFFER_SIZE_RP_SIZE 0x08
#define OCF_READ_BD_ADDR 0x0009
typedef __packed struct{
UINT8 status;
UINT8 bdaddr[6];
}read_bd_addr_rp;
#define READ_BD_ADDR_RP_SIZE 0x07
/*
***********************************************************************************************************
* status parameter
*
***********************************************************************************************************
*/
#define OGF_STATUS_PARAM 0x05
/*
***********************************************************************************************************
* testing commands
*
***********************************************************************************************************
*/
#define OGF_TEST_CMD 0x06
#define OCF_READ_LOOPBACK_MODE 0x0001
typedef __packed struct{
UINT8 status;
UINT8 loopback_mode;
}read_loopback_mode_rp;
#define OCF_WRITE_LOOOPBACK_MODE 0x0002
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -