-
Notifications
You must be signed in to change notification settings - Fork 46
nOS_Start
Jim Tremblay edited this page Nov 19, 2016
·
5 revisions
nOS_Error nOS_Init (nOS_Callback callback);
Unlock context switching, call user callback and do first scheduling.
Parameter | Description | |
---|---|---|
callback | Function pointer to call between context switching unlocking and first scheduling. Can give NULL if not needed. |
Return | Description | |
---|---|---|
NOS_OK | Kernel started successfully. | |
NOS_E_RUNNING | Kernel already started. |
- It is suggested to start your systick timer in callback.
- User callback is called outside of critical section, then interrupts can be re-enabled in callback.
#include "nOS.h"
void Systick_Start(void)
{
// Initialise timer that will be used as system tick at *NOS_CONFIG_TICKS_PER_SECOND* frequency
// Start timer
}
void main(void)
{
disable_interrupts();
nOS_Init();
// Application specific init
// nOS objects creation
nOS_Start(Systick_Start);
enable_interrupts();
// ...
while (1) {
// Idle
// ...
}
}