• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BT_VENDOR_QCOM_H
18 #define BT_VENDOR_QCOM_H
19 
20 #include <stdbool.h>
21 #include "bt_vendor_lib.h"
22 
23 #ifndef FALSE
24 #define FALSE  0
25 #endif
26 
27 #ifndef TRUE
28 #define TRUE   (!FALSE)
29 #endif
30 
31 #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;}
32 #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);}
33 #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);}
34 
35 typedef enum {
36     BT_SOC_DEFAULT = 0,
37     BT_SOC_SMD = BT_SOC_DEFAULT,
38     BT_SOC_AR3K,
39     BT_SOC_ROME,
40     BT_SOC_CHEROKEE,
41     /* Add chipset type here */
42     BT_SOC_RESERVED
43 }bt_soc_type;
44 
45 typedef enum {
46     FM_VND_OP_POWER_CTRL = (unsigned int)BT_VND_OP_A2DP_OFFLOAD_STOP + 1,
47     BT_VND_OP_FM_USERIAL_OPEN,
48     BT_VND_OP_FM_USERIAL_CLOSE,
49 }bt_fm_serial;
50 
51 typedef enum {
52     BT_VND_OP_ANT_USERIAL_OPEN = 254,
53     BT_VND_OP_ANT_USERIAL_CLOSE
54 }ant_serial;
55 
56 /* HW_NEED_END_WITH_HCI_RESET
57 
58     code implementation of sending a HCI_RESET command during the epilog
59     process. It calls back to the callers after command complete of HCI_RESET
60     is received.
61 
62     Default TRUE .
63 */
64 #ifndef HW_NEED_END_WITH_HCI_RESET
65 #define HW_NEED_END_WITH_HCI_RESET TRUE
66 #endif
67 
68 #define HCI_RESET  0x0C03
69 #define HCI_CMD_PREAMBLE_SIZE 3
70 #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE   5
71 #define HCI_EVT_CMD_CMPL_OPCODE        3
72 #define BT_PWR_CNTRL_DEVICE    "/dev/btpower"
73 
74 enum {
75     BT_STATUS_SUCCESS = 0,
76     BT_STATUS_FAIL,
77     BT_STATUS_INVAL,
78     BT_STATUS_NOMEM,
79     BT_STATUS_PROP_FAILURE,
80 };
81 #define BT_CMD_PWR_CTRL         0xbfad
82 struct bt_qcom_struct {
83     int fd[2];
84     int ant_fd;
85     int fm_fd;
86     bt_vendor_callbacks_t *cb;
87     uint8_t bdaddr[6];
88     int soc_type;
89     int rfkill_id;
90     char *rfkill_state;
91     bool enable_extldo;
92 };
93 extern struct bt_qcom_struct *q;
94 extern pthread_mutex_t q_lock;
95 
96 #endif /* BT_VENDOR_QCOM_H */
97 
98