Closed
Description
Hardware
Hardware: n.a.
Core Version: 2.2.0
Description
Is there any good reason why we are using xt_rsil(15)/xt_rsil(0) for noInterrupts()/interrupts() ???
Doesn't ets_intr_lock()/ets_intr_unlock() do the same job without the need for storing the result of xt_rsil(...) and calling xt_wsr_ps(..) ???
i use the following class to disable interrupts for some time now without any problems:
class disableInterrupts //Locks all maskable interrupts while any instance exists...
{
protected:
static uint32_t _count;
public:
disableInterrupts()
{
ets_intr_lock();
_count++;
if (_count == 0) //Overrun ??
{
//Over 4 billion locks ??
//Something is going terribly wrong !!
//Lock up... (and trigger the watchdog ?)
ets_intr_unlock();
while(1);
}
}
~disableInterrupts()
{
if (--_count == 0)
{
ets_intr_unlock();
}
else if (_count == 0xFFFFFFFF) //Overrun ??
{
//Fatal error !!
//destructor called more often than constructor ????, _count must be corrupted !
//Lock up... (and trigger the watchdog ?)
ets_intr_unlock();
while(1);
}
}
};