2018-02-18 12:08:21 -05:00
|
|
|
extern "C" { // use the "C" calling convention
|
|
|
|
|
|
|
|
#ifdef QXK_ON_CONTEXT_SW
|
|
|
|
// NOTE: the context-switch callback is called with interrupts DISABLED
|
|
|
|
void QXK_onContextSw(QActive *prev, QActive *next) {
|
|
|
|
(void)prev;
|
|
|
|
if (next != (QActive *)0) { // next is not the QK idle loop?
|
|
|
|
_impure_ptr = next->thread; // switch to next TLS
|
|
|
|
}
|
|
|
|
|
|
|
|
// If you use QS software tracing, use the _NOCRIT() begin/end
|
2020-10-01 12:50:17 -04:00
|
|
|
QS_BEGIN_NOCRIT(ON_CONTEXT_SW, 0U)
|
2018-02-18 12:08:21 -05:00
|
|
|
QS_OBJ(prev);
|
|
|
|
QS_OBJ(next);
|
|
|
|
QS_END_NOCRIT()
|
|
|
|
}
|
|
|
|
#endif // QXK_ON_CONTEXT_SW
|
|
|
|
|
2020-10-01 12:50:17 -04:00
|
|
|
} // extern "C"
|