tzh
2024-08-15 d4a1bd480003f3e1a0590bc46fbcb24f05652ca7
android/hardware/aic/libbt/include/userial_vendor.h
....@@ -1,6 +1,6 @@
11 /******************************************************************************
22 *
3
- * Copyright (C) 2019-2027 AIC Corporation
3
+ * Copyright (C) 2019-2021 Aicsemi Corporation
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
....@@ -28,50 +28,61 @@
2828 #ifndef USERIAL_VENDOR_H
2929 #define USERIAL_VENDOR_H
3030
31
-#include "bt_vendor_aicbt.h"
31
+#include "bt_vendor_aic.h"
3232 #include "userial.h"
33
+#include "hci_h5_int.h"
34
+#include <sys/poll.h>
35
+#include <assert.h>
36
+#include "aic_parse.h"
37
+#include "bt_skbuff.h"
38
+#include "aic_common.h"
3339
3440 /******************************************************************************
3541 ** Constants & Macros
3642 ******************************************************************************/
43
+#define AIC_NO_INTR(fn) do {} while ((fn) == -1 && errno == EINTR)
3744
3845 /**** baud rates ****/
39
-#define USERIAL_BAUD_300 0
40
-#define USERIAL_BAUD_600 1
41
-#define USERIAL_BAUD_1200 2
42
-#define USERIAL_BAUD_2400 3
43
-#define USERIAL_BAUD_9600 4
44
-#define USERIAL_BAUD_19200 5
45
-#define USERIAL_BAUD_57600 6
46
-#define USERIAL_BAUD_115200 7
47
-#define USERIAL_BAUD_230400 8
48
-#define USERIAL_BAUD_460800 9
49
-#define USERIAL_BAUD_921600 10
50
-#define USERIAL_BAUD_1M 11
51
-#define USERIAL_BAUD_1_5M 12
52
-#define USERIAL_BAUD_2M 13
53
-#define USERIAL_BAUD_3M 14
54
-#define USERIAL_BAUD_4M 15
55
-#define USERIAL_BAUD_AUTO 16
56
-#define USERIAL_BAUD_2_5M 17
57
-#define USERIAL_BAUD_3_5M 18
46
+#define USERIAL_BAUD_300 0
47
+#define USERIAL_BAUD_600 1
48
+#define USERIAL_BAUD_1200 2
49
+#define USERIAL_BAUD_2400 3
50
+#define USERIAL_BAUD_9600 4
51
+#define USERIAL_BAUD_19200 5
52
+#define USERIAL_BAUD_57600 6
53
+#define USERIAL_BAUD_115200 7
54
+#define USERIAL_BAUD_230400 8
55
+#define USERIAL_BAUD_460800 9
56
+#define USERIAL_BAUD_921600 10
57
+#define USERIAL_BAUD_1M 11
58
+#define USERIAL_BAUD_1_5M 12
59
+#define USERIAL_BAUD_2M 13
60
+#define USERIAL_BAUD_3M 14
61
+#define USERIAL_BAUD_4M 15
62
+#define USERIAL_BAUD_AUTO 16
63
+#define USERIAL_BAUD_2_5M 17
64
+#define USERIAL_BAUD_3_5M 18
5865
5966 /**** Data Format ****/
6067 /* Stop Bits */
61
-#define USERIAL_STOPBITS_1 1
62
-#define USERIAL_STOPBITS_1_5 (1<<1)
63
-#define USERIAL_STOPBITS_2 (1<<2)
68
+#define USERIAL_STOPBITS_1 1
69
+#define USERIAL_STOPBITS_1_5 (1<<1)
70
+#define USERIAL_STOPBITS_2 (1<<2)
6471
6572 /* Parity Bits */
66
-#define USERIAL_PARITY_NONE (1<<3)
67
-#define USERIAL_PARITY_EVEN (1<<4)
68
-#define USERIAL_PARITY_ODD (1<<5)
73
+#define USERIAL_PARITY_NONE (1<<3)
74
+#define USERIAL_PARITY_EVEN (1<<4)
75
+#define USERIAL_PARITY_ODD (1<<5)
6976
7077 /* Data Bits */
71
-#define USERIAL_DATABITS_5 (1<<6)
72
-#define USERIAL_DATABITS_6 (1<<7)
73
-#define USERIAL_DATABITS_7 (1<<8)
74
-#define USERIAL_DATABITS_8 (1<<9)
78
+#define USERIAL_DATABITS_5 (1<<6)
79
+#define USERIAL_DATABITS_6 (1<<7)
80
+#define USERIAL_DATABITS_7 (1<<8)
81
+#define USERIAL_DATABITS_8 (1<<9)
82
+
83
+
84
+#define USERIAL_HW_FLOW_CTRL_OFF 0
85
+#define USERIAL_HW_FLOW_CTRL_ON 1
7586
7687
7788 #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
....@@ -93,12 +104,11 @@
93104 /******************************************************************************
94105 ** Type definitions
95106 ******************************************************************************/
96
-
97107 /* Structure used to configure serial port during open */
98
-typedef struct
99
-{
108
+typedef struct {
100109 uint16_t fmt; /* Data format */
101110 uint8_t baud; /* Baud rate */
111
+ uint8_t hw_fctrl; /*hardware flowcontrol*/
102112 } tUSERIAL_CFG;
103113
104114 typedef enum {
....@@ -109,6 +119,14 @@
109119 #endif
110120 USERIAL_OP_NOP,
111121 } userial_vendor_ioctl_op_t;
122
+
123
+enum {
124
+ AICBT_PACKET_IDLE,
125
+ AICBT_PACKET_TYPE,
126
+ AICBT_PACKET_HEADER,
127
+ AICBT_PACKET_CONTENT,
128
+ AICBT_PACKET_END
129
+};
112130
113131 /******************************************************************************
114132 ** Extern variables and functions
....@@ -127,7 +145,7 @@
127145 ** Returns None
128146 **
129147 *******************************************************************************/
130
-void userial_vendor_init(void);
148
+void userial_vendor_init(char *bt_device_node);
131149
132150 /*******************************************************************************
133151 **
....@@ -173,5 +191,16 @@
173191 *******************************************************************************/
174192 void userial_vendor_ioctl(userial_vendor_ioctl_op_t op, void *p_data);
175193
176
-#endif /* USERIAL_VENDOR_H */
194
+void userial_vendor_set_hw_fctrl(uint8_t hw_fctrl);
195
+int userial_socket_open(void);
196
+int userial_vendor_usb_ioctl(int operation, void* param);
197
+int userial_vendor_usb_open(void);
198
+void userial_recv_rawdata_hook(unsigned char *buffer, unsigned int total_length);
199
+void userial_set_bt_interface_state(int bt_on);
177200
201
+#define AIC_HANDLE_EVENT
202
+#define AIC_HANDLE_CMD
203
+#define CONFIG_SCO_OVER_HCI
204
+//#define CONFIG_SCO_MSBC_PLC
205
+
206
+#endif /* USERIAL_VENDOR_H */