Skip to content
Jim Tremblay edited this page Nov 19, 2016 · 5 revisions

Home

nOS_Start

Definition

nOS_Error nOS_Init (nOS_Callback callback);

Description

Unlock context switching, call user callback and do first scheduling.

Parameters

Parameter Description
callback Function pointer to call between context switching unlocking and first scheduling. Can give NULL if not needed.

Return

Return Description
NOS_OK Kernel started successfully.
NOS_E_RUNNING Kernel already started.

Notes

  1. It is suggested to start your systick timer in callback.
  2. User callback is called outside of critical section, then interrupts can be re-enabled in callback.

Example

#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

        // ...
    }
}
Clone this wiki locally