]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Synchronization added to LPC17xx disable_irq and enable_irq functions.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 23 Jan 2011 17:54:17 +0000 (18:54 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 23 Jan 2011 17:54:17 +0000 (18:54 +0100)
If the synchronization is not there, compiler or CPU
can freely reorder execution in request_irq and free_irq.
This caused broken build optimized by

 -Os -ffunction-sections -fdata-sections -Wl,--gc-section

The IRQ source has been enabled before handler has
target been set into irq_handler_table.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
arch/arm/mach-lpc17xx/libs/hal/hal.c

index 7f7124116b0bbe2afdcedfb272f14ff51ae07c14..facf4226e0e2748bb1cbdded5b2991888e9c43b6 100644 (file)
@@ -15,9 +15,11 @@ unsigned int irq_table_size = IRQ_TABLE_SIZE;
 void disable_irq(unsigned int irqnum)
 {
   NVIC_DisableIRQ(irqnum);
+  __memory_barrier();
 }
 void enable_irq(unsigned int irqnum)
 {
+  __memory_barrier();
   NVIC_EnableIRQ(irqnum);
 }