using in main() chSemResetI and so on

Discussions and support about ChibiOS/NIL, the almost nil RTOS.
Alex
Posts: 28
Joined: Sat Feb 22, 2014 2:40 pm

using in main() chSemResetI and so on

Postby Alex » Tue Mar 15, 2016 12:52 pm

Can i use functions chSemResetI(), chSemGetCounterI() and so on after chSysInit() ?

User avatar
RoccoMarco
Posts: 597
Joined: Wed Apr 24, 2013 4:11 pm
Location: Salerno (Italy)
Has thanked: 73 times
Been thanked: 53 times
Contact:

Re: using in main() chSemResetI and so on

Postby RoccoMarco » Tue Mar 15, 2016 1:19 pm

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

User avatar
Giovanni
Site Admin
Posts: 11220
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 399 times
Been thanked: 333 times
Contact:

Re: using in main() chSemResetI and so on

Postby Giovanni » Tue Mar 15, 2016 1:56 pm

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


Return to “ChibiOS/NIL”

Who is online

Users browsing this forum: No registered users and 2 guests