Code: Select all
static thread_reference_t* PWaitingThread;
/*
* Threads
*/
static THD_WORKING_AREA(waThd,512);
static THD_FUNCTION(Thd, arg){
//chSysLock();
chThdSuspendS(PWaitingThread);
//chSysUnlock();
while(TRUE) {
palSetPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(MS2ST(100));
palClearPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(MS2ST(100));
}
}
int main(void) {
halInit();
chSysInit();
chThdCreateStatic(waThd, sizeof(waThd), NORMALPRIO+5, Thd, NULL);
while (true) {
chThdSleepMilliseconds(MS2ST(500));
chSysLockFromISR();
thread_t *tp= *PWaitingThread;
chSchReadyI(tp);
chSysUnlockFromISR();
}
}
SV#8 error on "chThdSuspendS(PWaitingThread);" in thread. I would be grateful for any help.
Thank you!