xiaoxiang781216 commented on code in PR #10262:
URL: https://github.com/apache/nuttx/pull/10262#discussion_r1304550360


##########
drivers/serial/uart_bth5.c:
##########
@@ -0,0 +1,1279 @@
+/****************************************************************************
+ * drivers/serial/uart_bth5.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/fs/fs.h>
+#include <nuttx/kmalloc.h>
+#include <nuttx/mm/circbuf.h>
+#include <nuttx/mutex.h>
+#include <nuttx/semaphore.h>
+
+#include <debug.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <string.h>
+
+#include <nuttx/wireless/bluetooth/bt_driver.h>
+#include <nuttx/wireless/bluetooth/bt_hci.h>
+#include <nuttx/wireless/bluetooth/bt_uart.h>
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+#define MAX_OPENCNT          (255) /* Limit of uint8_t */
+
+#define HCI_3WIRE_ACK_PKT    0x00
+#define HCI_COMMAND_PKT      0x01
+#define HCI_ACLDATA_PKT      0x02
+#define HCI_SCODATA_PKT      0x03
+#define HCI_EVENT_PKT        0x04
+#define HCI_ISODATA_PKT      0x05
+#define HCI_3WIRE_LINK_PKT   0x0f
+#define HCI_VENDOR_PKT       0xff
+
+#define SLIP_DELIMITER       0xc0
+#define SLIP_ESC             0xdb
+#define SLIP_ESC_DELIM       0xdc
+#define SLIP_ESC_ESC         0xdd
+
+#define H5_BIT_RX_ESC        (0x00000001 << 0)
+#define H5_BIT_RX_CRC        (0x00000001 << 1)
+
+#define H5_HDR_SEQ(hdr)      ((hdr)[0] & 0x07)
+#define H5_HDR_ACK(hdr)      (((hdr)[0] >> 3) & 0x07)
+#define H5_HDR_CRC(hdr)      (((hdr)[0] >> 6) & 0x01)
+#define H5_HDR_RELIABLE(hdr) (((hdr)[0] >> 7) & 0x01)
+#define H5_HDR_PKT_TYPE(hdr) ((hdr)[1] & 0x0f)
+#define H5_HDR_LEN(hdr)      ((((hdr)[1] >> 4) & 0x0f) + ((hdr)[2] << 4))
+
+#define H5_SET_SEQ(hdr, seq)    ((hdr)[0] |= (seq))
+#define H5_SET_ACK(hdr, ack)    ((hdr)[0] |= (ack) << 3)
+#define H5_SET_RELIABLE(hdr)    ((hdr)[0] |= 1 << 7)
+#define H5_SET_TYPE(hdr, type)  ((hdr)[1] |= type)

Review Comment:
   @chengkai15 fix this too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to