You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2017/11/10 20:08:50 UTC
[GitHub] wes3 closed pull request #647: net/nimble: MYNEWT-862 HFXO not always turning off
wes3 closed pull request #647: net/nimble: MYNEWT-862 HFXO not always turning off
URL: https://github.com/apache/mynewt-core/pull/647
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/net/nimble/controller/src/ble_ll_adv.c b/net/nimble/controller/src/ble_ll_adv.c
index 99bb24704..e51a322cf 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -1314,9 +1314,6 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
ble_ll_state_set(BLE_LL_STATE_STANDBY);
g_ble_ll_cur_adv_sm = NULL;
ble_ll_scan_chk_resume();
-#ifdef BLE_XCVR_RFCLK
- ble_ll_sched_rfclk_chk_restart();
-#endif
}
#else
if (ble_ll_state_get() == BLE_LL_STATE_ADV) {
@@ -1325,11 +1322,11 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
ble_ll_state_set(BLE_LL_STATE_STANDBY);
g_ble_ll_cur_adv_sm = NULL;
ble_ll_scan_chk_resume();
-#ifdef BLE_XCVR_RFCLK
- ble_ll_sched_rfclk_chk_restart();
-#endif
}
#endif
+#ifdef BLE_XCVR_RFCLK
+ ble_ll_sched_rfclk_chk_restart();
+#endif
OS_EXIT_CRITICAL(sr);
os_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
diff --git a/net/nimble/controller/src/ble_ll_sched.c b/net/nimble/controller/src/ble_ll_sched.c
index 5ec3a9dee..8db9ced02 100644
--- a/net/nimble/controller/src/ble_ll_sched.c
+++ b/net/nimble/controller/src/ble_ll_sched.c
@@ -1240,13 +1240,11 @@ ble_ll_sched_next_time(uint32_t *next_event_time)
void
ble_ll_sched_rfclk_chk_restart(void)
{
- int stop;
os_sr_t sr;
uint8_t ll_state;
int32_t time_till_next;
uint32_t next_time;
- stop = 0;
OS_ENTER_CRITICAL(sr);
ll_state = ble_ll_state_get();
if (ble_ll_sched_next_time(&next_time)) {
@@ -1256,19 +1254,24 @@ ble_ll_sched_rfclk_chk_restart(void)
*/
time_till_next = (int32_t)(next_time - os_cputime_get32());
if (time_till_next > g_ble_ll_data.ll_xtal_ticks) {
- /* Stop the clock */
- stop = 1;
+ /* Restart the rfclk timer based on the next scheduled time */
ble_ll_xcvr_rfclk_timer_start(next_time);
+
+ /* Only disable the rfclk if doing nothing */
+ if (ll_state == BLE_LL_STATE_STANDBY) {
+ ble_ll_log(BLE_LL_LOG_ID_RFCLK_SCHED_DIS, g_ble_ll_data.ll_rfclk_state,
+ 0, 0);
+ ble_ll_xcvr_rfclk_disable();
+ }
}
} else {
- stop = 1;
- }
-
- /* Only disable the rfclk if doing nothing */
- if (stop && (ll_state == BLE_LL_STATE_STANDBY)) {
- ble_ll_log(BLE_LL_LOG_ID_RFCLK_SCHED_DIS, g_ble_ll_data.ll_rfclk_state,
- 0, 0);
- ble_ll_xcvr_rfclk_disable();
+ /*
+ * Only stop the timer and rfclk if doing nothing currently. If
+ * in some other state, that state will handle the timer and rfclk
+ */
+ if (ll_state == BLE_LL_STATE_STANDBY) {
+ ble_ll_xcvr_rfclk_stop();
+ }
}
OS_EXIT_CRITICAL(sr);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
With regards,
Apache Git Services