Proper way to access shared data from IRQ
Posted: Thu Feb 13, 2014 9:28 pm
Hi,
If I want to write to shared data from a normal IRQ (non-"fast") what is the correct way to access it safely without using chSysLockFromIsr? I want to use a semaphore but my code keeps crashing, so maybe I am using the wrong calls. (chBSemWait & chBSemSignal use chSysLock internally instead of chSysLockFromIsr, for example). The reason I want to use a semaphore instead of chSysLock is that I am copying a chunk of data and I don't want to affect latency in other IRQs. With a semaphore the latency hit should be minimal.
To summarize: what are the correct semaphore calls ( *I vs *S vs neither) ? Should I do it differently?
Thanks,
~t
If I want to write to shared data from a normal IRQ (non-"fast") what is the correct way to access it safely without using chSysLockFromIsr? I want to use a semaphore but my code keeps crashing, so maybe I am using the wrong calls. (chBSemWait & chBSemSignal use chSysLock internally instead of chSysLockFromIsr, for example). The reason I want to use a semaphore instead of chSysLock is that I am copying a chunk of data and I don't want to affect latency in other IRQs. With a semaphore the latency hit should be minimal.
To summarize: what are the correct semaphore calls ( *I vs *S vs neither) ? Should I do it differently?
Thanks,
~t