Changeset 2cb0877 in rtems


Ignore:
Timestamp:
Feb 18, 2014, 11:42:58 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
52eecba
Parents:
8a65a960
git-author:
Sebastian Huber <sebastian.huber@…> (02/18/14 11:42:58)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/19/14 09:25:47)
Message:

bsp/leon3: Add and use LEON3_IrqCtrl_Lock

Disabling of interrupts is not enough to ensure mutual exclusion on SMP
configurations.

Location:
c/src/lib/libbsp/sparc/leon3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    r8a65a960 r2cb0877  
    2323 */
    2424struct ambapp_bus ambapp_plb;
     25
     26rtems_interrupt_lock LEON3_IrqCtrl_Lock = RTEMS_INTERRUPT_LOCK_INITIALIZER;
    2527
    2628/* Pointers to Interrupt Controller configuration registers */
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    r8a65a960 r2cb0877  
    2424#define _INCLUDE_LEON_h
    2525
    26 #include <rtems/score/sparc.h>
     26#include <rtems.h>
    2727#include <amba.h>
    2828
     
    168168 */
    169169
     170extern rtems_interrupt_lock LEON3_IrqCtrl_Lock;
     171
     172#define LEON3_IRQCTRL_ACQUIRE(_level ) \
     173  rtems_interrupt_lock_acquire( &LEON3_IrqCtrl_Lock, _level )
     174
     175#define LEON3_IRQCTRL_RELEASE(_level ) \
     176  rtems_interrupt_lock_release( &LEON3_IrqCtrl_Lock, _level )
     177
    170178#define LEON_Clear_interrupt( _source ) \
    171179  do { \
     
    188196#define LEON_Mask_interrupt( _source ) \
    189197  do { \
    190     uint32_t _level; \
    191     _level = sparc_disable_interrupts(); \
     198    rtems_interrupt_level _level; \
     199    LEON3_IRQCTRL_ACQUIRE( _level ); \
    192200     LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index]  &= ~(1 << (_source)); \
    193     sparc_enable_interrupts( _level ); \
     201    LEON3_IRQCTRL_RELEASE( _level ); \
    194202  } while (0)
    195203
    196204#define LEON_Unmask_interrupt( _source ) \
    197205  do { \
    198     uint32_t _level; \
    199     _level = sparc_disable_interrupts(); \
     206    rtems_interrupt_level _level; \
     207    LEON3_IRQCTRL_ACQUIRE( _level ); \
    200208    LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index]  |= (1 << (_source)); \
    201     sparc_enable_interrupts( _level ); \
     209    LEON3_IRQCTRL_RELEASE( _level ); \
    202210  } while (0)
    203211
    204212#define LEON_Disable_interrupt( _source, _previous ) \
    205213  do { \
    206     uint32_t _level; \
     214    rtems_interrupt_level _level; \
    207215    uint32_t _mask = 1 << (_source); \
    208     _level = sparc_disable_interrupts(); \
     216    LEON3_IRQCTRL_ACQUIRE( _level ); \
    209217     (_previous) = LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index]; \
    210218     LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = _previous & ~_mask; \
    211     sparc_enable_interrupts( _level ); \
     219    LEON3_IRQCTRL_RELEASE( _level ); \
    212220    (_previous) &= _mask; \
    213221  } while (0)
     
    215223#define LEON_Restore_interrupt( _source, _previous ) \
    216224  do { \
    217     uint32_t _level; \
     225    rtems_interrupt_level _level; \
    218226    uint32_t _mask = 1 << (_source); \
    219     _level = sparc_disable_interrupts(); \
     227    LEON3_IRQCTRL_ACQUIRE( _level ); \
    220228      LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = \
    221229        (LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] & ~_mask) | (_previous); \
    222     sparc_enable_interrupts( _level ); \
     230    LEON3_IRQCTRL_RELEASE( _level ); \
    223231  } while (0)
    224232
Note: See TracChangeset for help on using the changeset viewer.