You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/05/21 04:40:41 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

anchao opened a new pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754


   ## Summary
   
   wireless/bluetooth: decoupling bt_driver_s and bt_buf_s
   serial/uart/h4: add bt h4 uart serial driver
   arch/sim: remove BT uart implement
   wirelss/bluetooth/bt_buf: add ISO buffer type
   
   Feature request by : https://github.com/apache/incubator-nuttx/pull/3543
   
   ## Impact
   
   bluetooth uart driver module
   
   ## Testing
   
   bluetooth uart h4 devcie with 3rd stack running on userspace 
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r637024510



##########
File path: wireless/bluetooth/bt_hcicore.c
##########
@@ -1622,24 +1616,35 @@ void bt_driver_unregister(FAR const struct bt_driver_s *btdev)
 
 /* TODO: rename to bt_receive? */

Review comment:
       can yo do this rename? there's an asymmetry in the naming of functions in this file




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638792283



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -147,61 +148,42 @@ static int bt_open(FAR const struct bt_driver_s *btdev)
  * Name: bt_open
  ****************************************************************************/
 
-static int bt_hci_send(FAR const struct bt_driver_s *btdev,
-                       FAR struct bt_buf_s *buf)
+static int bt_hci_send(FAR struct bt_driver_s *btdev,
+                       enum bt_buf_type_e type,
+                       FAR void *data, size_t len)
 {
-  int ret = OK;
+  int ret = -EIO;
 
   /* Pass HCI CMD/DATA to SDC */
 
-  if (buf->type == BT_CMD)
+  if (type == BT_CMD || type == BT_ACL_OUT)
     {
-      struct bt_hci_cmd_hdr_s *cmd = (struct bt_hci_cmd_hdr_s *)buf->data;
-
-      wlinfo("passing CMD %d to softdevice\n", cmd->opcode);
+      wlinfo("passing type %d to softdevice\n", type);

Review comment:
       ```suggestion
         wlinfo("passing type %s to softdevice\n", type == BT_CMD ? "CMD" : "ACL");
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#issuecomment-851469362


   Sure, my comment about the bluetooth stack is unrelated to this PR. 


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638449209



##########
File path: wireless/bluetooth/bt_hcicore.c
##########
@@ -1622,24 +1616,35 @@ void bt_driver_unregister(FAR const struct bt_driver_s *btdev)
 
 /* TODO: rename to bt_receive? */
 
-void bt_hci_receive(FAR struct bt_buf_s *buf)
+int bt_hci_receive(FAR struct bt_driver_s *btdev,
+                   enum bt_buf_type_e type,
+                   FAR void *data, size_t len)
 {
   FAR struct bt_hci_evt_hdr_s *hdr;
+  struct bt_buf_s *buf;
   int ret;
 
-  wlinfo("buf %p len %u\n", buf, buf->len);
+  wlinfo("data %p len %zu\n", data, len);
 
   /* Critical command complete/status events use the high priority work
    * queue.
    */
 
-  if (buf->type != BT_ACL_IN)
+  buf = bt_buf_alloc(type, NULL, 0);

Review comment:
       In the original implementation of the bt_driver, we keep the semantics of head_reserve, every implementer of the driver needs to consider the reserved data here:
   
   https://github.com/apache/incubator-nuttx/pull/3754/files#diff-bafaf660e053e10be22390e6b4e0d76d2a60143c99508c845e21ece5999b5c2aR67




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638448054



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -321,21 +279,14 @@ static void on_hci(void)
           struct bt_hci_acl_hdr_s *hdr =
               (struct bt_hci_acl_hdr_s *)g_sdc_dev.msg_buffer;
 
-          wlinfo("received HCI ACL from softdevice (handle: %d)\n",
-                 hdr->handle);
-

Review comment:
       Oops, I restore the debug info here




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d merged pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d merged pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#issuecomment-847991049


   > > Looks good. Only small change requested.
   > > BTW, have you tested with nimBLE (sim:nimble)? You mention third party stack but don't know which do you refer?
   > 
   > we are using the zephyr(BLE+MESH) and bluedroid(BT) dual-mode host stack solution, and test case include BLE(peripheral/central),MESH(provisioner),BT(a2dp/avrcp/spp/etc)
   > 
   > ```
   >     7       100 FIFO     Task    --- Waiting  Signal    00000000 065504 004084   6.2%  fluorided
   >     9       100 FIFO     pthread --- Waiting  Semaphore 00000000 065536 007700  11.7%  bt_stack_manager_thread 0x58c33ee0
   >    10       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 001232   1.8%  alarm_deprecated 0
   >    11       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003760   5.7%  alarm_default_ca 0x58c537f8
   >    12       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003312   5.0%  alarm_dispatcher 0x58c537c8
   >    13       100 FIFO     pthread --- Waiting  Semaphore 00000000 065536 004208   6.4%  bt_jni_thread 0x58c371e0
   >    14       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003172   4.8%  bt_hci_thread 0x58c385c0
   >    15       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 002720   4.1%  bt_rx_thread 0
   >    16       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 010032  15.3%  bt_main_thread 0x58c3c220
   >    17       246 FIFO     pthread --- Waiting  MQ empty  00000000 065536 003172   4.8%  bt_a2dp_sink_worker_thread 0x58c429c0
   >    18       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 001648   2.5%  uipc-main 0x58c435e0
   >    21       227 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001136  14.0%  BT TX  0x58c34270
   >    22       228 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001216  15.0%  BT RX  0x58c34270
   >    23       230 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 000992  12.2%  BT ECC  0x58c34270
   >    24       228 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001488  18.3%  BT Driver  0x58c34270
   > ```
   
   Great! Any chance support for these stacks can be upstreamed into NuttX? I think this relates to the discussion about which would be a good stack to adopt.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638534042



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -287,8 +269,8 @@ static void on_hci(void)
           if (hdr->evt == BT_HCI_EVT_CMD_COMPLETE)
             {
               struct hci_evt_cmd_complete_s *cmd_complete =
-                  (struct hci_evt_cmd_complete_s *)
-                      (g_sdc_dev.msg_buffer + sizeof(*hdr));
+                (struct hci_evt_cmd_complete_s *)
+                (g_sdc_dev.msg_buffer + sizeof(*hdr));

Review comment:
       Done




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#issuecomment-847979260


   > Looks good. Only small change requested.
   > BTW, have you tested with nimBLE (sim:nimble)? You mention third party stack but don't know which do you refer?
   
   we are using the zephyr(BLE+MESH) and bluedroid(BT) dual-mode host stack solution, and test case include BLE(peripheral/central),MESH(provisioner),BT(a2dp/avrcp/spp/etc)
   
   ```
       7       100 FIFO     Task    --- Waiting  Signal    00000000 065504 004084   6.2%  fluorided
       9       100 FIFO     pthread --- Waiting  Semaphore 00000000 065536 007700  11.7%  bt_stack_manager_thread 0x58c33ee0
      10       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 001232   1.8%  alarm_deprecated 0
      11       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003760   5.7%  alarm_default_ca 0x58c537f8
      12       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003312   5.0%  alarm_dispatcher 0x58c537c8
      13       100 FIFO     pthread --- Waiting  Semaphore 00000000 065536 004208   6.4%  bt_jni_thread 0x58c371e0
      14       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 003172   4.8%  bt_hci_thread 0x58c385c0
      15       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 002720   4.1%  bt_rx_thread 0
      16       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 010032  15.3%  bt_main_thread 0x58c3c220
      17       246 FIFO     pthread --- Waiting  MQ empty  00000000 065536 003172   4.8%  bt_a2dp_sink_worker_thread 0x58c429c0
      18       246 FIFO     pthread --- Waiting  Semaphore 00000000 065536 001648   2.5%  uipc-main 0x58c435e0
      21       227 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001136  14.0%  BT TX  0x58c34270
      22       228 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001216  15.0%  BT RX  0x58c34270
      23       230 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 000992  12.2%  BT ECC  0x58c34270
      24       228 FIFO     Kthread --- Waiting  Semaphore 00000000 008096 001488  18.3%  BT Driver  0x58c34270
   
   ```


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#issuecomment-851230666


   @v01d can we merge this patch first? Other bluetooth stack can be upstreamed later.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
v01d commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r636995026



##########
File path: wireless/bluetooth/bt_hcicore.c
##########
@@ -1622,24 +1616,35 @@ void bt_driver_unregister(FAR const struct bt_driver_s *btdev)
 
 /* TODO: rename to bt_receive? */
 
-void bt_hci_receive(FAR struct bt_buf_s *buf)
+int bt_hci_receive(FAR struct bt_driver_s *btdev,
+                   enum bt_buf_type_e type,
+                   FAR void *data, size_t len)
 {
   FAR struct bt_hci_evt_hdr_s *hdr;
+  struct bt_buf_s *buf;
   int ret;
 
-  wlinfo("buf %p len %u\n", buf, buf->len);
+  wlinfo("data %p len %zu\n", data, len);
 
   /* Critical command complete/status events use the high priority work
    * queue.
    */
 
-  if (buf->type != BT_ACL_IN)
+  buf = bt_buf_alloc(type, NULL, 0);

Review comment:
       I see a potential issue here. The buffer is typically allocated with required H4 header overhead (see code being removed in https://github.com/apache/incubator-nuttx/pull/3754/files#diff-5e9ec1dda4ad80ba37d99bf264be24a9eb50516a76bb2b0f029e59e637f2e0f4L305
   This overhead is considered when consuming the bt_buf_s in netdev. Is this being accounted elsewhere?

##########
File path: drivers/serial/Kconfig
##########
@@ -617,4 +617,27 @@ config PSEUDOTERM_TXBUFSIZE
 
 endif # PSEUDOTERM
 
+menuconfig UART_BTH4
+	bool "BT H4 uart pseudo device"
+	default n
+	select MM_CIRCBUF
+	---help---
+		Enable Bluetooth H4 UART Pseudo Device(eg. /dev/ttyHCI)

Review comment:
       This description is a bit obscure. Until we get proper documentation for BLE we should make it clear what this really does:
   ```suggestion
   		Enable support for Bluetooth H4 UART Pseudo Device(eg. /dev/ttyHCI). This instantiates a serial-like
   		interface over an existing bluetooth controller via HCI interface. Useful for external Bluetooth
   		stacks working this way instead of the socket based interface.
   		
   ```

##########
File path: boards/sim/sim/sim/configs/btuart/defconfig
##########
@@ -1,73 +0,0 @@
-#

Review comment:
       Please provide a config which excercises the new interface instead of just removing the previous one.

##########
File path: drivers/serial/uart_bth4.c
##########
@@ -25,25 +25,21 @@
 #include <nuttx/fs/fs.h>
 #include <nuttx/kmalloc.h>
 #include <nuttx/semaphore.h>
-#include <nuttx/nuttx.h>
+#include <nuttx/mm/circbuf.h>
 
+#include <fcntl.h>
 #include <string.h>
 #include <poll.h>
-#include <queue.h>
 
-#include <nuttx/wireless/bluetooth/bt_uart.h>
 #include <nuttx/wireless/bluetooth/bt_hci.h>
-
-#include "up_internal.h"
-#include "up_hcisocket_host.h"
+#include <nuttx/wireless/bluetooth/bt_uart.h>
+#include <nuttx/wireless/bluetooth/bt_driver.h>
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define CONFIG_HCI_RECVBUF_SIZE    1024
-#define CONFIG_HCI_SENDBUF_SIZE    1024
-#define CONFIG_HCI_NPOLLWAITERS    2
+#define CONFIG_UART_BTH4_NPOLLWAITERS    2

Review comment:
       Can you make this a Kconfig symbol?

##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -321,21 +279,14 @@ static void on_hci(void)
           struct bt_hci_acl_hdr_s *hdr =
               (struct bt_hci_acl_hdr_s *)g_sdc_dev.msg_buffer;
 
-          wlinfo("received HCI ACL from softdevice (handle: %d)\n",
-                 hdr->handle);
-

Review comment:
       why remove this? it is useful for debugging

##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -147,61 +147,44 @@ static int bt_open(FAR const struct bt_driver_s *btdev)
  * Name: bt_open
  ****************************************************************************/
 
-static int bt_hci_send(FAR const struct bt_driver_s *btdev,
-                       FAR struct bt_buf_s *buf)
+static int bt_hci_send(FAR struct bt_driver_s *btdev,
+                       enum bt_buf_type_e type,
+                       FAR void *data, size_t len)
 {
-  int ret = OK;
+  int ret = -EIO;
 
   /* Pass HCI CMD/DATA to SDC */
 
-  if (buf->type == BT_CMD)
+  if (type == BT_CMD || type == BT_ACL_OUT)
     {
-      struct bt_hci_cmd_hdr_s *cmd = (struct bt_hci_cmd_hdr_s *)buf->data;
-
-      wlinfo("passing CMD %d to softdevice\n", cmd->opcode);
-
       /* Ensure non-concurrent access to SDC operations */
 
       nxsem_wait_uninterruptible(&g_sdc_dev.exclsem);
 
-      if (sdc_hci_cmd_put(buf->data) < 0)
+      if (type == BT_CMD)
         {
-          wlerr("sdc_hci_cmd_put() failed\n");
-          ret = -EIO;
-        }
-
-      nxsem_post(&g_sdc_dev.exclsem);
+          wlinfo("passing CMD to softdevice\n");

Review comment:
       this should not be done while semaphore is held, the print should be outside.

##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -283,32 +265,8 @@ static void on_hci(void)
 
           len = sizeof(*hdr) + hdr->len;
 
-#ifdef CONFIG_DEBUG_WIRELESS_INFO
-          if (hdr->evt == BT_HCI_EVT_CMD_COMPLETE)
-            {
-              struct hci_evt_cmd_complete_s *cmd_complete =
-                  (struct hci_evt_cmd_complete_s *)
-                      (g_sdc_dev.msg_buffer + sizeof(*hdr));
-              uint8_t *status = (uint8_t *)cmd_complete + 1;
-
-              wlinfo("received CMD_COMPLETE from softdevice "
-                     "(opcode: %d, status: 0x%x)\n",
-                     cmd_complete->opcode, *status);
-            }
-          else
-            {
-              wlinfo("received HCI EVT from softdevice "
-                     "(evt: %d, len: %zu)\n", hdr->evt, len);
-            }
-#endif

Review comment:
       Please do not remove debugging helpers




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638476323



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -287,8 +269,8 @@ static void on_hci(void)
           if (hdr->evt == BT_HCI_EVT_CMD_COMPLETE)
             {
               struct hci_evt_cmd_complete_s *cmd_complete =
-                  (struct hci_evt_cmd_complete_s *)
-                      (g_sdc_dev.msg_buffer + sizeof(*hdr));
+                (struct hci_evt_cmd_complete_s *)
+                (g_sdc_dev.msg_buffer + sizeof(*hdr));

Review comment:
       revert the change




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#issuecomment-845661728


   ```
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/arch/arm/src/nrf52/nrf52_sdc.c:309:2: error: Mixed case identifier found
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/arch/arm/src/nrf52/nrf52_sdc.c:318:2: error: Mixed case identifier found
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/arch/arm/src/nrf52/nrf52_sdc.c:329:2: error: Mixed case identifier found
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/arch/arm/src/nrf52/nrf52_sdc.c:338:2: error: Mixed case identifier found
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/arch/arm/src/nrf52/nrf52_sdc.c:347:2: error: Mixed case identifier found
   Error: Process completed with exit code 1.
   ```
   
   Mixed case found by style check, ignore


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638447356



##########
File path: boards/sim/sim/sim/configs/btuart/defconfig
##########
@@ -1,73 +0,0 @@
-#

Review comment:
       https://github.com/apache/incubator-nuttx/pull/3754/commits/5ef77384fd30936070f45bfb710861aa3089db96




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638446950



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -283,32 +265,8 @@ static void on_hci(void)
 
           len = sizeof(*hdr) + hdr->len;
 
-#ifdef CONFIG_DEBUG_WIRELESS_INFO
-          if (hdr->evt == BT_HCI_EVT_CMD_COMPLETE)
-            {
-              struct hci_evt_cmd_complete_s *cmd_complete =
-                  (struct hci_evt_cmd_complete_s *)
-                      (g_sdc_dev.msg_buffer + sizeof(*hdr));
-              uint8_t *status = (uint8_t *)cmd_complete + 1;
-
-              wlinfo("received CMD_COMPLETE from softdevice "
-                     "(opcode: %d, status: 0x%x)\n",
-                     cmd_complete->opcode, *status);
-            }
-          else
-            {
-              wlinfo("received HCI EVT from softdevice "
-                     "(evt: %d, len: %zu)\n", hdr->evt, len);
-            }
-#endif
-
-          outbuf = bt_buf_alloc(BT_EVT, NULL, BLUETOOTH_H4_HDRLEN);
-          bt_buf_extend(outbuf, len);
-
-          memcpy(outbuf->data, g_sdc_dev.msg_buffer, len);
-
-          bt_hci_receive(outbuf);
-
+          g_bt_driver->receive(&g_bt_driver, BT_EVT,

Review comment:
       Done, I add a symbol define to instead of driver details,
   https://github.com/apache/incubator-nuttx/pull/3754/files#diff-bafaf660e053e10be22390e6b4e0d76d2a60143c99508c845e21ece5999b5c2aR56-R57




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] donghengqaz commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
donghengqaz commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r636674946



##########
File path: arch/arm/src/nrf52/nrf52_sdc.c
##########
@@ -283,32 +265,8 @@ static void on_hci(void)
 
           len = sizeof(*hdr) + hdr->len;
 
-#ifdef CONFIG_DEBUG_WIRELESS_INFO
-          if (hdr->evt == BT_HCI_EVT_CMD_COMPLETE)
-            {
-              struct hci_evt_cmd_complete_s *cmd_complete =
-                  (struct hci_evt_cmd_complete_s *)
-                      (g_sdc_dev.msg_buffer + sizeof(*hdr));
-              uint8_t *status = (uint8_t *)cmd_complete + 1;
-
-              wlinfo("received CMD_COMPLETE from softdevice "
-                     "(opcode: %d, status: 0x%x)\n",
-                     cmd_complete->opcode, *status);
-            }
-          else
-            {
-              wlinfo("received HCI EVT from softdevice "
-                     "(evt: %d, len: %zu)\n", hdr->evt, len);
-            }
-#endif
-
-          outbuf = bt_buf_alloc(BT_EVT, NULL, BLUETOOTH_H4_HDRLEN);
-          bt_buf_extend(outbuf, len);
-
-          memcpy(outbuf->data, g_sdc_dev.msg_buffer, len);
-
-          bt_hci_receive(outbuf);
-
+          g_bt_driver->receive(&g_bt_driver, BT_EVT,

Review comment:
       Maybe we can add function like `bt_msg_reveive(&g_bt_driver, BT_EVT, g_sdc_dev.msg_buffer, len)` instead of directly calling callback function which is set by BT kernel driver.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #3754: wireless/bluetooth: decoupling bt_driver_s and bt_buf_s

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #3754:
URL: https://github.com/apache/incubator-nuttx/pull/3754#discussion_r638448100



##########
File path: wireless/bluetooth/bt_hcicore.c
##########
@@ -1622,24 +1616,35 @@ void bt_driver_unregister(FAR const struct bt_driver_s *btdev)
 
 /* TODO: rename to bt_receive? */

Review comment:
       Done




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org