Exemplo n.º 1
0
void nOS_SwitchContext(void)
{
#if (NOS_CONFIG_MAX_UNSAFE_ISR_PRIO > 0)
    nOS_StatusReg   sr = _GetBASEPRI();
#endif

    /* Request context switch */
    *(volatile uint32_t *)0xE000ED04UL = 0x10000000UL;

    /* Leave critical section */
#if (NOS_CONFIG_MAX_UNSAFE_ISR_PRIO > 0)
    _SetBASEPRI(0);
#else
    _EI();
#endif
    _DSB();
    _ISB();

    _NOP();

    /* Enter critical section */
#if (NOS_CONFIG_MAX_UNSAFE_ISR_PRIO > 0)
    _SetBASEPRI(sr);
#else
    _DI();
#endif
    _DSB();
    _ISB();
}
Exemplo n.º 2
0
void nOS_SwitchContext(void)
{
    nOS_StatusReg   sr = _GetBASEPRI();

    /* Request context switch */
    *(volatile uint32_t *)0xE000ED04UL = 0x10000000UL;

    /* Leave critical section */
    _SetBASEPRI(0);
    _DSB();
    _ISB();

    _NOP();

    /* Enter critical section */
    _SetBASEPRI(sr);
    _DSB();
    _ISB();
}