You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/01/18 13:53:33 UTC
[mynewt-nimble] 01/03: nimble/ll: Add support for PA/LNA
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 05538bc66db58c5fb676d1f62a9ad8f99ed6cb74
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jan 11 15:35:35 2022 +0100
nimble/ll: Add support for PA/LNA
This adds some definitions for PA/LNA support. The actual support is
implemented in phy and front-end driver.
---
nimble/controller/include/controller/ble_ll_plna.h | 45 ++++++++++++++++++++++
nimble/controller/pkg.yml | 4 ++
nimble/controller/src/ble_ll.c | 9 +++++
nimble/controller/syscfg.yml | 19 +++++++++
4 files changed, 77 insertions(+)
diff --git a/nimble/controller/include/controller/ble_ll_plna.h b/nimble/controller/include/controller/ble_ll_plna.h
new file mode 100644
index 0000000..c4fb65e
--- /dev/null
+++ b/nimble/controller/include/controller/ble_ll_plna.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+#ifndef H_BLE_LL_PLNA_
+#define H_BLE_LL_PLNA_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_LL_PA)
+void ble_ll_plna_pa_init(void);
+void ble_ll_plna_pa_enable(void);
+void ble_ll_plna_pa_disable(void);
+#endif
+
+#if MYNEWT_VAL(BLE_LL_LNA)
+void ble_ll_plna_lna_init(void);
+void ble_ll_plna_lna_enable(void);
+void ble_ll_plna_lna_disable(void);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_BLE_LL_PLNA_ */
diff --git a/nimble/controller/pkg.yml b/nimble/controller/pkg.yml
index 96c6367..9661bb3 100644
--- a/nimble/controller/pkg.yml
+++ b/nimble/controller/pkg.yml
@@ -29,6 +29,10 @@ pkg.req_apis:
- ble_driver
- ble_transport
- stats
+pkg.req_apis.BLE_LL_PA:
+ - ble_ll_pa
+pkg.req_apis.BLE_LL_LNA:
+ - ble_ll_lna
pkg.deps:
- "@apache-mynewt-core/kernel/os"
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 99e8594..f21f55c 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -44,6 +44,7 @@
#include "controller/ble_ll_rfmgmt.h"
#include "controller/ble_ll_trace.h"
#include "controller/ble_ll_sync.h"
+#include "controller/ble_ll_plna.h"
#include "ble_ll_conn_priv.h"
#include "ble_ll_hci_priv.h"
#include "ble_ll_priv.h"
@@ -1656,6 +1657,14 @@ ble_ll_reset(void)
ble_ll_resolv_list_reset();
#endif
+
+#if MYNEWT_VAL(BLE_LL_PA)
+ ble_ll_plna_pa_init();
+#endif
+#if MYNEWT_VAL(BLE_LL_LNA)
+ ble_ll_plna_lna_init();
+#endif
+
/* Re-initialize the PHY */
rc = ble_phy_init();
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index 62c9c4a..41384cb 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -375,6 +375,23 @@ syscfg.defs:
line number where assertion occured.
value: 0
+ BLE_LL_PA:
+ description: Enable PA support
+ value: 0
+ BLE_LL_PA_GPIO:
+ description: >
+ GPIO pin number to control PA. Pin is set to high state when PA
+ should be enabled.
+ value: -1
+ BLE_LL_LNA:
+ description: Enable LNA support
+ value: 0
+ BLE_LL_LNA_GPIO:
+ description: >
+ GPIO pin number to control LNA. Pin is set to high state when LNA
+ should be enabled.
+ value: -1
+
BLE_LL_SYSINIT_STAGE:
description: >
Sysinit stage for the NimBLE controller.
@@ -499,3 +516,5 @@ syscfg.vals.!BLE_HOST:
syscfg.restrictions:
- OS_CPUTIME_FREQ == 32768
- BLE_LL_PUBLIC_DEV_ADDR <= 0xffffffffffff
+ - BLE_LL_PA == 0 || BLE_LL_PA_GPIO >= 0
+ - BLE_LL_LNA == 0 || BLE_LL_LNA_GPIO >= 0