aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Ismirlian <dismirlian@gmail.com>2019-09-30 16:39:41 -0300
committerDiego Ismirlian <dismirlian@gmail.com>2019-09-30 16:39:41 -0300
commit8fab074cde693395237771f5c931c50193381260 (patch)
tree25b2d57e129e42708eb29ddca12997008c385015
parent162a61257e511d3db4d23249f1d0b1e7271c45e4 (diff)
downloadChibiOS-Contrib-8fab074cde693395237771f5c931c50193381260.tar.gz
ChibiOS-Contrib-8fab074cde693395237771f5c931c50193381260.tar.bz2
ChibiOS-Contrib-8fab074cde693395237771f5c931c50193381260.zip
Use I-class functions for registry
-rw-r--r--os/various/segger_bindings/SYSTEMVIEW/SEGGER_SYSVIEW_ChibiOS.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/os/various/segger_bindings/SYSTEMVIEW/SEGGER_SYSVIEW_ChibiOS.c b/os/various/segger_bindings/SYSTEMVIEW/SEGGER_SYSVIEW_ChibiOS.c
index 08d2e73..ba1d403 100644
--- a/os/various/segger_bindings/SYSTEMVIEW/SEGGER_SYSVIEW_ChibiOS.c
+++ b/os/various/segger_bindings/SYSTEMVIEW/SEGGER_SYSVIEW_ChibiOS.c
@@ -22,13 +22,54 @@
static systime_t start;
static const char *isr_desc;
+thread_t *chRegFirstThreadI(void) {
+ thread_t *tp;
+
+ chDbgCheckClassI();
+
+ tp = ch.rlist.newer;
+#if CH_CFG_USE_DYNAMIC == TRUE
+ tp->refs++;
+#endif
+
+ return tp;
+}
+
+thread_t *chRegNextThreadI(thread_t *tp) {
+ thread_t *ntp;
+
+ chDbgCheckClassI();
+
+ ntp = tp->newer;
+ /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
+ if (ntp == (thread_t *)&ch.rlist) {
+ /*lint -restore*/
+ ntp = NULL;
+ }
+#if CH_CFG_USE_DYNAMIC == TRUE
+ else {
+ chDbgAssert(ntp->refs < (trefs_t)255, "too many references");
+ ntp->refs++;
+ }
+#endif
+
+#if CH_CFG_USE_DYNAMIC == TRUE
+ chDbgAssert(tp->refs > (trefs_t)0, "not referenced");
+ tp->refs--;
+#endif
+
+ return ntp;
+}
+
static void _cbSendTaskList(void) {
thread_t *tp;
- tp = chRegFirstThread();
+ syssts_t sts = chSysGetStatusAndLockX();
+ tp = chRegFirstThreadI();
do {
SYSVIEW_ChibiOS_SendTaskInfo(tp);
- tp = chRegNextThread(tp);
+ tp = chRegNextThreadI(tp);
} while (tp != NULL);
+ chSysRestoreStatusX(sts);
}
static U64 _cbGetTime(void) {