From d4a1bd480003f3e1a0590bc46fbcb24f05652ca7 Mon Sep 17 00:00:00 2001
From: tzh <tanzhtanzh@gmail.com>
Date: Thu, 15 Aug 2024 06:56:47 +0000
Subject: [PATCH] feat(wfit/bt): update aic8800 wifi/bt drive and hal

---
 android/hardware/aic/libbt/include/userial_vendor.h |  101 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 65 insertions(+), 36 deletions(-)

diff --git a/android/hardware/aic/libbt/include/userial_vendor.h b/android/hardware/aic/libbt/include/userial_vendor.h
index 081315b..552e392 100755
--- a/android/hardware/aic/libbt/include/userial_vendor.h
+++ b/android/hardware/aic/libbt/include/userial_vendor.h
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- *  Copyright (C) 2019-2027 AIC Corporation
+ *  Copyright (C) 2019-2021 Aicsemi Corporation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -28,50 +28,61 @@
 #ifndef USERIAL_VENDOR_H
 #define USERIAL_VENDOR_H
 
-#include "bt_vendor_aicbt.h"
+#include "bt_vendor_aic.h"
 #include "userial.h"
+#include "hci_h5_int.h"
+#include <sys/poll.h>
+#include <assert.h>
+#include "aic_parse.h"
+#include "bt_skbuff.h"
+#include "aic_common.h"
 
 /******************************************************************************
 **  Constants & Macros
 ******************************************************************************/
+#define AIC_NO_INTR(fn)                do {} while ((fn) == -1 && errno == EINTR)
 
 /**** baud rates ****/
-#define USERIAL_BAUD_300        0
-#define USERIAL_BAUD_600        1
-#define USERIAL_BAUD_1200       2
-#define USERIAL_BAUD_2400       3
-#define USERIAL_BAUD_9600       4
-#define USERIAL_BAUD_19200      5
-#define USERIAL_BAUD_57600      6
-#define USERIAL_BAUD_115200     7
-#define USERIAL_BAUD_230400     8
-#define USERIAL_BAUD_460800     9
-#define USERIAL_BAUD_921600     10
-#define USERIAL_BAUD_1M         11
-#define USERIAL_BAUD_1_5M       12
-#define USERIAL_BAUD_2M         13
-#define USERIAL_BAUD_3M         14
-#define USERIAL_BAUD_4M         15
-#define USERIAL_BAUD_AUTO       16
-#define USERIAL_BAUD_2_5M       17
-#define USERIAL_BAUD_3_5M       18
+#define USERIAL_BAUD_300               0
+#define USERIAL_BAUD_600               1
+#define USERIAL_BAUD_1200              2
+#define USERIAL_BAUD_2400              3
+#define USERIAL_BAUD_9600              4
+#define USERIAL_BAUD_19200             5
+#define USERIAL_BAUD_57600             6
+#define USERIAL_BAUD_115200            7
+#define USERIAL_BAUD_230400            8
+#define USERIAL_BAUD_460800            9
+#define USERIAL_BAUD_921600            10
+#define USERIAL_BAUD_1M                11
+#define USERIAL_BAUD_1_5M              12
+#define USERIAL_BAUD_2M                13
+#define USERIAL_BAUD_3M                14
+#define USERIAL_BAUD_4M                15
+#define USERIAL_BAUD_AUTO              16
+#define USERIAL_BAUD_2_5M              17
+#define USERIAL_BAUD_3_5M              18
 
 /**** Data Format ****/
 /* Stop Bits */
-#define USERIAL_STOPBITS_1      1
-#define USERIAL_STOPBITS_1_5    (1<<1)
-#define USERIAL_STOPBITS_2      (1<<2)
+#define USERIAL_STOPBITS_1             1
+#define USERIAL_STOPBITS_1_5           (1<<1)
+#define USERIAL_STOPBITS_2             (1<<2)
 
 /* Parity Bits */
-#define USERIAL_PARITY_NONE     (1<<3)
-#define USERIAL_PARITY_EVEN     (1<<4)
-#define USERIAL_PARITY_ODD      (1<<5)
+#define USERIAL_PARITY_NONE            (1<<3)
+#define USERIAL_PARITY_EVEN            (1<<4)
+#define USERIAL_PARITY_ODD             (1<<5)
 
 /* Data Bits */
-#define USERIAL_DATABITS_5      (1<<6)
-#define USERIAL_DATABITS_6      (1<<7)
-#define USERIAL_DATABITS_7      (1<<8)
-#define USERIAL_DATABITS_8      (1<<9)
+#define USERIAL_DATABITS_5             (1<<6)
+#define USERIAL_DATABITS_6             (1<<7)
+#define USERIAL_DATABITS_7             (1<<8)
+#define USERIAL_DATABITS_8             (1<<9)
+
+
+#define USERIAL_HW_FLOW_CTRL_OFF       0
+#define USERIAL_HW_FLOW_CTRL_ON        1
 
 
 #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
@@ -93,12 +104,11 @@
 /******************************************************************************
 **  Type definitions
 ******************************************************************************/
-
 /* Structure used to configure serial port during open */
-typedef struct
-{
+typedef struct {
     uint16_t fmt;       /* Data format */
     uint8_t  baud;      /* Baud rate */
+    uint8_t hw_fctrl; /*hardware flowcontrol*/
 } tUSERIAL_CFG;
 
 typedef enum {
@@ -109,6 +119,14 @@
 #endif
     USERIAL_OP_NOP,
 } userial_vendor_ioctl_op_t;
+
+enum {
+    AICBT_PACKET_IDLE,
+    AICBT_PACKET_TYPE,
+    AICBT_PACKET_HEADER,
+    AICBT_PACKET_CONTENT,
+    AICBT_PACKET_END
+};
 
 /******************************************************************************
 **  Extern variables and functions
@@ -127,7 +145,7 @@
 ** Returns         None
 **
 *******************************************************************************/
-void userial_vendor_init(void);
+void userial_vendor_init(char *bt_device_node);
 
 /*******************************************************************************
 **
@@ -173,5 +191,16 @@
 *******************************************************************************/
 void userial_vendor_ioctl(userial_vendor_ioctl_op_t op, void *p_data);
 
-#endif /* USERIAL_VENDOR_H */
+void userial_vendor_set_hw_fctrl(uint8_t hw_fctrl);
+int userial_socket_open(void);
+int userial_vendor_usb_ioctl(int operation, void* param);
+int userial_vendor_usb_open(void);
+void userial_recv_rawdata_hook(unsigned char *buffer, unsigned int total_length);
+void userial_set_bt_interface_state(int bt_on);
 
+#define AIC_HANDLE_EVENT
+#define AIC_HANDLE_CMD
+#define CONFIG_SCO_OVER_HCI
+//#define CONFIG_SCO_MSBC_PLC
+
+#endif /* USERIAL_VENDOR_H */

--
Gitblit v1.6.2