OS_IncDI() before embOS initialization

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • OS_IncDI() before embOS initialization

    Some of the examples in the embOS_Generic.pdf manual call OS_IncDI() before doing anything else in main(). But some do not.

    In none of these example snippets is there a all to either OS_DecRI() or OS_EI() - I assume this happens in one of the subsequent initialization functions (OS_InitKern(), OS_InitHW(), or OS_Start()) and that it's performed unconditionally - not by decrementing the counter and enabling if it reaches 0.

    Could I get clarification on whether or not a call to OS_IncDI() is necessary and where/how interrupts do get enabled? I'd prefer not to rely on 'it works for me'.

  • Hello Michael,

    because we cannot be sure that interrupts are disabled before main (e.g. some startup codes enables interrupts) we disable interrupts as first thing in main() with OS_IncDI().
    The interrupts are enabled in OS_Start(), so no OS_DecRI() is necessary there. The examples without OS_IncDI() in embOS generic documentation are older ones, we will have to update them.