Page 1 of 1

using in main() chSemResetI and so on  Topic is solved

Posted: Tue Mar 15, 2016 12:52 pm
by Alex
Can i use functions chSemResetI(), chSemGetCounterI() and so on after chSysInit() ?

Re: using in main() chSemResetI and so on

Posted: Tue Mar 15, 2016 1:19 pm
by RoccoMarco
Yes you can do this. Take a look to os\nil\include\nil.h: all the functions and macros available in NIL are declared here. Otherwise you can look the documentation here under the voice Modules/NIL Kernel/API

Ciao,
RM

Re: using in main() chSemResetI and so on

Posted: Tue Mar 15, 2016 1:56 pm
by Giovanni
The main is the idle thread in NIL. You can use any I-class function as follow:

Code: Select all

chSysLock();
chSemResetI(...);
chSchRescheduleS();
chSysUnlock();


Of course you could just do:

Code: Select all

chSemReset(...);


You cannot call there those functions that can case the thread to sleep, for example: chThdSleep(), chSemWait() etc.

Giovanni