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 2023/02/27 13:10:28 UTC
[mynewt-nimble] branch master updated (9bed38f9 -> d7eb050c)
This is an automated email from the ASF dual-hosted git repository.
andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
from 9bed38f9 nimble/ll: Fix missing critical section exit in PAST
new 0a08f6f4 babblesim: Fix os_arch_in_isr
new 2de66c27 babblesim: Fix invalid switch from isr to task
new 154754b5 nimble/phy/nrf5x: Fix setting RTC CC[0] value
new d7eb050c nimble/ll: Suppress compiler warning
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
babblesim/core/src/irq_handler.c | 6 ++++++
babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h | 7 ++-----
babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c | 2 +-
nimble/controller/src/ble_ll_ctrl.c | 3 +++
nimble/drivers/nrf5x/src/ble_phy.c | 2 +-
5 files changed, 13 insertions(+), 7 deletions(-)
[mynewt-nimble] 04/04: nimble/ll: Suppress compiler warning
Posted by an...@apache.org.
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 d7eb050cfe32c25b76441a15886b3e02a2d2c779
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Sat Feb 25 00:01:02 2023 +0100
nimble/ll: Suppress compiler warning
ble_error is not used in some configurations so just suppress compiler
warning (instead of #ifdef so we don't need to worry about it anymore).
---
nimble/controller/src/ble_ll_ctrl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index 7d828aeb..b7c9c01e 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -1954,6 +1954,9 @@ ble_ll_ctrl_rx_reject_ind(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
ble_error = dptr[1];
}
+ /* Suppress unused-but-set if not used by following code (due to syscfg) */
+ (void)ble_error;
+
/* XXX: should I check to make sure the rejected opcode is sane
if we receive ind ext? */
switch (connsm->cur_ctrl_proc) {
[mynewt-nimble] 02/04: babblesim: Fix invalid switch from isr to task
Posted by an...@apache.org.
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 2de66c2797ef1848930f6ee5d5cded15a8a483d9
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Feb 24 23:45:42 2023 +0100
babblesim: Fix invalid switch from isr to task
BabbleSim triggers interrupts when exiting from critical section (i.e.
interrupts are unlocked) and then we check for pending context switch.
This can lead to invalid switch from isr to task context before isr has
actually finished:
- interrupts are unlocked
- interrupt is triggered
- isr calls os_* which uses critical section and triggers context switch
(e.g. os_eventq_put)
- when exiting critical section in isr, we check for pending context
switch and immediately switch to task context before isr is completed
To fix this we should only perform context switch if exiting from
critical section in task context.
---
babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c b/babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c
index 8277ae7c..b545688c 100644
--- a/babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c
+++ b/babblesim/hw/bsp/nrf52_bsim/src/arch/bsim_arch/os_arch.c
@@ -148,7 +148,7 @@ os_arch_restore_sr(os_sr_t osr)
{
hw_irq_ctrl_change_lock(osr);
- if (!osr && bsim_pend_sv) {
+ if (!osr && bsim_pend_sv && !os_arch_in_isr()) {
do_ctx_sw();
}
}
[mynewt-nimble] 01/04: babblesim: Fix os_arch_in_isr
Posted by an...@apache.org.
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 0a08f6f449bbd95e549d8b883866422ba4cc94c8
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Feb 24 23:45:16 2023 +0100
babblesim: Fix os_arch_in_isr
---
babblesim/core/src/irq_handler.c | 6 ++++++
babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h | 7 ++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/babblesim/core/src/irq_handler.c b/babblesim/core/src/irq_handler.c
index d2979750..05eb881a 100644
--- a/babblesim/core/src/irq_handler.c
+++ b/babblesim/core/src/irq_handler.c
@@ -22,6 +22,12 @@ extern void (* const systemVectors[256])(void);
* handler and therefore its priority handling
*/
+int
+os_arch_in_isr(void)
+{
+ return currently_running_irq >= 0;
+}
+
void posix_interrupt_raised(void)
{
uint64_t irq_lock;
diff --git a/babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h b/babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h
index 32bc97bc..574f1e81 100644
--- a/babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h
+++ b/babblesim/hw/bsp/nrf52_bsim/include/os/os_arch.h
@@ -48,11 +48,8 @@ void os_arch_frame_init(struct stack_frame *sf);
#define OS_IDLE_STACK_SIZE (4000)
#endif
-static inline int
-os_arch_in_isr(void)
-{
- return hw_irq_ctrl_get_irq_status();
-}
+/* Implemented in irq_handler */
+int os_arch_in_isr(void);
/* Include common arch definitions and APIs */
#include "os/arch/common.h"
[mynewt-nimble] 03/04: nimble/phy/nrf5x: Fix setting RTC CC[0] value
Posted by an...@apache.org.
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 154754b577f7fe42b24f699de89c3efa9fb64e36
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Feb 24 23:57:40 2023 +0100
nimble/phy/nrf5x: Fix setting RTC CC[0] value
CC[0] has only 24 bits valid so we should mask target value. Not really
sure if this does matter on actual hardware (should not?), but BabbleSim
does not handle it correctly.
---
nimble/drivers/nrf5x/src/ble_phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nimble/drivers/nrf5x/src/ble_phy.c b/nimble/drivers/nrf5x/src/ble_phy.c
index c1e2df72..bf989e88 100644
--- a/nimble/drivers/nrf5x/src/ble_phy.c
+++ b/nimble/drivers/nrf5x/src/ble_phy.c
@@ -782,7 +782,7 @@ ble_phy_set_start_now(void)
*/
now = os_cputime_get32();
NRF_RTC0->EVENTS_COMPARE[0] = 0;
- nrf_rtc_cc_set(NRF_RTC0, 0, now + 3);
+ nrf_rtc_cc_set(NRF_RTC0, 0, (now + 3) & 0xffffff);
nrf_rtc_event_enable(NRF_RTC0, RTC_EVTENSET_COMPARE0_Msk);
#if PHY_USE_FEM_LNA