Forum Discussion
Altera_Forum
Honored Contributor
22 years agoNios Semaphore?
I need a good semaphore to make a fifo IRQ safe. On the PC it's easy with the assembly instruction BTS which Bit Tests and Sets. So you can try to set a bit and know if you did it in a single c...
Altera_Forum
Honored Contributor
22 years agoIt depends on what sort of concurrent access you're concerned about.
If you're just worried about preventing simultaneous access from different threads/tasks in a multitasking OS (Linux, uCos, or homegrown) running on a single processor, then you just need to disable interrupts for the section requiring atomic access (since code can't be pre-empted except via an interrupt). On the other hand, if you're worried about simultaneous access from different processors accessing common shared memory, then some sort of hardware solution will be required.