gustavonihei commented on a change in pull request #4509: URL: https://github.com/apache/incubator-nuttx/pull/4509#discussion_r719680379
########## File path: arch/xtensa/src/esp32/esp32_ble.c ########## @@ -0,0 +1,346 @@ +/**************************************************************************** + * arch/xtensa/src/esp32/esp32_ble.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 <sys/types.h> + +#include <sys/socket.h> + +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <queue.h> +#include <debug.h> + +#include <nuttx/nuttx.h> +#include <nuttx/kmalloc.h> +#include <nuttx/wqueue.h> +#include <nuttx/net/bluetooth.h> +#include <nuttx/wireless/bluetooth/bt_driver.h> +#include <nuttx/wireless/bluetooth/bt_uart.h> + +#if defined(CONFIG_UART_BTH4) + #include <nuttx/serial/uart_bth4.h> +#endif + +#include "esp32_ble_adapter.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* BLE packet buffer max number */ + +#define BLE_BUF_NUM CONFIG_ESP32_BLE_PKTBUF_NUM + +/* BLE packet buffer max size */ + +#define BLE_BUF_SIZE 1024 + +/* Low-priority work queue process RX/TX */ + +#define BLE_WORK LPWORK + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct esp32_ble_priv_s +{ + struct bt_driver_s drv; /* NuttX BT/BLE driver data */ +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int esp32_ble_open(struct bt_driver_s *drv); +static int esp32_ble_send(struct bt_driver_s *drv, + enum bt_buf_type_e type, + void *data, size_t len); +static void esp32_ble_close(struct bt_driver_s *drv); + +static void esp32_ble_send_ready(void); +static int esp32_ble_recv_cb(uint8_t *data, uint16_t len); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct esp32_ble_priv_s g_ble_priv = +{ + .drv = + { + .head_reserve = H4_HEADER_SIZE, + .open = esp32_ble_open, + .send = esp32_ble_send, + .close = esp32_ble_close + } +}; + +static esp_vhci_host_callback_t vhci_host_cb = +{ + .notify_host_send_available = esp32_ble_send_ready, Review comment: ```suggestion ``` `esp32_ble_send_ready` is an empty function, so no need to neither define it or attribute it 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. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org