You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/10/05 11:45:46 UTC

[incubator-nuttx] 01/02: risc-v/esp32c3: Make BLE adapter code compliant to nxstyle

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 47e804b167f00769140bee8a082d60c74fa7d5cd
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Fri Oct 1 15:53:48 2021 -0300

    risc-v/esp32c3: Make BLE adapter code compliant to nxstyle
    
    Signed-off-by: Gustavo Henrique Nihei <gu...@espressif.com>
---
 arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c      | 12 ++++-----
 .../esp32c3-devkit/scripts/esp32c3.template.ld     |  2 ++
 .../esp32c3-devkit/scripts/esp32c3_aliases.ld      | 29 ++++++++++++++++++++++
 boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile  |  2 +-
 4 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c b/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c
index 62f9dc0..a2be855 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c
@@ -330,9 +330,9 @@ extern int btdm_hci_tl_io_event_post(int event);
 
 /* VHCI */
 
-extern bool API_vhci_host_check_send_available(void); /* Functions in bt lib */
-extern void API_vhci_host_send_packet(uint8_t * data, uint16_t len);
-extern int API_vhci_host_register_callback(const vhci_host_callback_t
+extern bool api_vhci_host_check_send_available(void); /* Functions in bt lib */
+extern void api_vhci_host_send_packet(uint8_t * data, uint16_t len);
+extern int api_vhci_host_register_callback(const vhci_host_callback_t
                                            *callback);
 
 /* TX power */
@@ -2404,7 +2404,7 @@ bool esp32c3_vhci_host_check_send_available(void)
       return false;
     }
 
-  return API_vhci_host_check_send_available();
+  return api_vhci_host_check_send_available();
 }
 
 /****************************************************************************
@@ -2428,7 +2428,7 @@ void esp32c3_vhci_host_send_packet(uint8_t *data, uint16_t len)
       return;
     }
 
-  API_vhci_host_send_packet(data, len);
+  api_vhci_host_send_packet(data, len);
 }
 
 /****************************************************************************
@@ -2452,7 +2452,7 @@ int esp32c3_vhci_register_callback(const esp_vhci_host_callback_t *callback)
       return ret;
     }
 
-  ret = API_vhci_host_register_callback(
+  ret = api_vhci_host_register_callback(
             (const vhci_host_callback_t *)callback) == 0 ? 0 : -1;
   return ret;
 }
diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld
index 82a3398..c637f53 100644
--- a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld
+++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld
@@ -30,6 +30,8 @@
 
 #include <nuttx/config.h>
 
+#include "esp32c3_aliases.ld"
+
 #define SRAM_IRAM_START     0x4037c000
 #define SRAM_DRAM_START     0x3fc7c000
 
diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3_aliases.ld b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3_aliases.ld
new file mode 100644
index 0000000..965d592
--- /dev/null
+++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3_aliases.ld
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3_aliases.ld
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ESP32C3_BLE
+
+/* Lower-case aliases for BLE library symbols not compliant to nxstyle */
+
+api_vhci_host_check_send_available = API_vhci_host_check_send_available;
+api_vhci_host_send_packet = API_vhci_host_send_packet;
+api_vhci_host_register_callback = API_vhci_host_register_callback;
+
+#endif
diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile b/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile
index f46c6cb..61ae8cf 100644
--- a/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile
+++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile
@@ -115,7 +115,7 @@ SCRIPTOUT = $(SCRIPTDIR)$(DELIM)esp32c3_out.ld
 .PHONY = context distclean
 
 $(SCRIPTOUT): $(SCRIPTIN) $(CONFIGFILE)
-	$(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(SCRIPTIN) -o $@
+	$(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_DIR)/scripts -C -P -x c -E $(SCRIPTIN) -o $@
 
 context:: $(SCRIPTOUT)