summaryrefslogtreecommitdiff
path: root/net/nimble/controller/src/ble_ll_sched.c
diff options
context:
space:
mode:
authorChristopher Collins <ccollins@apache.org>2016-08-23 17:35:28 -0700
committerChristopher Collins <ccollins@apache.org>2016-08-23 17:35:28 -0700
commit70987f7d2e3c791132509f08566fe77de34142ac (patch)
tree269ca9b857f65c22b8f2b93560466984f96091e5 /net/nimble/controller/src/ble_ll_sched.c
parent0d9c8f30efbe2dba00b21d9185e9db8e36cd579e (diff)
parent665e22f5722d6348c1b260192e27f69d855b58fd (diff)
Merge branch 'develop' - in preparation for
backwards-compatibility-breaking changes to develop. * develop: (290 commits) sim compiler - replace objsize with size Fix warnings reported by clang. MYNEWT-329 MYNEWT-354 STM32f407 discovery board BSP mbedtls; use smaller version of SHA256. boot; boot loader does not need to call os_init() anymore, as bsp_init() has been exported. boot; app does not need the dependency to mbedtls slinky; time-based waits must use OS_TICKS_PER_SEC. bootutil; adjust unit tests to work with status upkeep outside sys/config. bootutil; was returning wrong image header in response when swithing images. Add boot_set_req() routine for unit test use. boot/bootutil; remove debug console use from bootloader. bootutil/imgmgr; output of boot now shows the fallback image. imgmgr; automatically confirm image as good for now. bootutil; add 'confirm' step, telling that image was confirmed as good. Otherwise next restart we'll go back to old image. bootutil; make status element size depend on flash alignment restrictions. boot, imgmgr; return the slot number for test image. bootutil; move routines reading boot-copy-status from loader.c to bootutil_misc.c. boot; return full flash location of status bytes, instead of just offset. boot; don't use NFFS or FCB for keeping status. Interim commit. ...
Diffstat (limited to 'net/nimble/controller/src/ble_ll_sched.c')
-rw-r--r--net/nimble/controller/src/ble_ll_sched.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/nimble/controller/src/ble_ll_sched.c b/net/nimble/controller/src/ble_ll_sched.c
index 5b792176..90cb510e 100644
--- a/net/nimble/controller/src/ble_ll_sched.c
+++ b/net/nimble/controller/src/ble_ll_sched.c
@@ -32,6 +32,10 @@
/* XXX: this is temporary. Not sure what I want to do here */
struct cpu_timer g_ble_ll_sched_timer;
+#if (BLE_LL_SCHED_DEBUG == 1)
+int32_t g_ble_ll_sched_max_late;
+#endif
+
/* XXX: TODO:
* 1) Add some accounting to the schedule code to see how late we are
* (min/max?)
@@ -645,6 +649,7 @@ ble_ll_sched_execute_item(struct ble_ll_sched_item *sch)
} else {
STATS_INC(ble_ll_stats, sched_state_conn_errs);
ble_ll_conn_event_halt();
+ return -1;
}
}
@@ -663,12 +668,19 @@ ble_ll_sched_execute_item(struct ble_ll_sched_item *sch)
void
ble_ll_sched_run(void *arg)
{
+ int32_t dt;
struct ble_ll_sched_item *sch;
/* Look through schedule queue */
while ((sch = TAILQ_FIRST(&g_ble_ll_sched_q)) != NULL) {
/* Make sure we have passed the start time of the first event */
- if ((int32_t)(cputime_get32() - sch->start_time) >= 0) {
+ dt = (int32_t)(cputime_get32() - sch->start_time);
+ if (dt >= 0) {
+#if (BLE_LL_SCHED_DEBUG == 1)
+ if (dt > g_ble_ll_sched_max_late) {
+ g_ble_ll_sched_max_late = dt;
+ }
+#endif
/* Remove schedule item and execute the callback */
TAILQ_REMOVE(&g_ble_ll_sched_q, sch, link);
sch->enqueued = 0;