Changeset a7267241 in rtems


Ignore:
Timestamp:
Nov 26, 2018, 2:44:25 PM (8 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
06331e4
Parents:
c1864a0a
git-author:
Sebastian Huber <sebastian.huber@…> (11/26/18 14:44:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/27/18 07:06:53)
Message:

bsps/sparc: Add and use <grlib_impl.h>

Reduce copy and paste.

Location:
bsps/sparc
Files:
1 added
23 edited

Legend:

Unmodified
Added
Removed
  • bsps/sparc/headers.am

    rc1864a0a ra7267241  
    55include_HEADERS += ../../../../../bsps/sparc/include/ambapp_ids.h
    66include_HEADERS += ../../../../../bsps/sparc/include/grlib.h
     7include_HEADERS += ../../../../../bsps/sparc/include/grlib_impl.h
    78
    89include_bspdir = $(includedir)/bsp
  • bsps/sparc/shared/1553/gr1553bc.c

    rc1864a0a ra7267241  
    1818#include <bsp/gr1553bc.h>
    1919
    20 /* Use interrupt lock privmitives compatible with SMP defined in
    21  * RTEMS 4.11.99 and higher.
    22  */
    23 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    24 
    25 /* map via rtems_interrupt_lock_* API: */
    26 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    27 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    28 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    29 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    30 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    31 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    32 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    33 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    34 #define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock)
    35 
    36 #else
    37 
    38 /* maintain single-core compatibility with older versions of RTEMS: */
    39 #define SPIN_DECLARE(name)
    40 #define SPIN_INIT(lock, name)
    41 #define SPIN_LOCK(lock, level)
    42 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    43 #define SPIN_UNLOCK(lock, level)
    44 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    45 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    46 #define SPIN_ISR_IRQFLAGS(k)
    47 #define SPIN_FREE(lock)
    48 
    49 #ifdef RTEMS_SMP
    50 #error SMP mode not compatible with these interrupt lock primitives
    51 #endif
    52 
    53 #endif
     20#include <grlib_impl.h>
    5421
    5522#define GR1553BC_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
  • bsps/sparc/shared/1553/gr1553bm.c

    rc1864a0a ra7267241  
    1717#include <bsp/gr1553bm.h>
    1818
     19#include <grlib_impl.h>
    1920
    2021#define GR1553BM_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
     
    2324#define GR1553BM_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
    2425#define GR1553BM_READ_REG(adr) (*(volatile uint32_t *)(adr))
    25 
    26 /* Use interrupt lock privmitives compatible with SMP defined in
    27  * RTEMS 4.11.99 and higher.
    28  */
    29 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    30 
    31 /* map via rtems_interrupt_lock_* API: */
    32 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    33 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    34 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    35 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    36 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    37 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    38 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    39 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    40 #define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock)
    41 
    42 #else
    43 
    44 /* maintain single-core compatibility with older versions of RTEMS: */
    45 #define SPIN_DECLARE(name)
    46 #define SPIN_INIT(lock, name)
    47 #define SPIN_LOCK(lock, level)
    48 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    49 #define SPIN_UNLOCK(lock, level)
    50 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    51 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    52 #define SPIN_ISR_IRQFLAGS(k)
    53 #define SPIN_FREE(lock)
    54 
    55 #ifdef RTEMS_SMP
    56 #error SMP mode not compatible with these interrupt lock primitives
    57 #endif
    58 
    59 #endif
    6026
    6127struct gr1553bm_priv {
  • bsps/sparc/shared/1553/gr1553rt.c

    rc1864a0a ra7267241  
    2020#include <drvmgr/ambapp_bus.h>
    2121
     22#include <grlib_impl.h>
     23
    2224#define GR1553RT_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
    2325#define GR1553RT_READ_MEM(adr) (*(volatile uint32_t *)(adr))
     
    2527#define GR1553RT_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
    2628#define GR1553RT_READ_REG(adr) (*(volatile uint32_t *)(adr))
    27 
    28 /* map via rtems_interrupt_lock_* API: */
    29 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    30 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    31 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    32 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    33 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    34 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    35 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    36 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    37 #define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock)
    3829
    3930/* Software representation of one hardware descriptor */
  • bsps/sparc/shared/amba/ahbstat.c

    rc1864a0a ra7267241  
    1818#include <bsp/ahbstat.h>
    1919
    20 #define SPIN_IRQ_DECLARE(name)          RTEMS_INTERRUPT_LOCK_DECLARE(, name)
    21 #define SPIN_IRQ_INIT(lock, name)       rtems_interrupt_lock_initialize(lock, name)
    22 #define SPIN_IRQ_LOCK(lock, ctx)        rtems_interrupt_lock_acquire(lock, &(ctx))
    23 #define SPIN_IRQ_UNLOCK(lock, ctx)      rtems_interrupt_lock_release(lock, &(ctx))
    24 #define SPIN_IRQ_LOCK_ISR(lock, ctx)    rtems_interrupt_lock_acquire_isr(lock, &(ctx))
    25 #define SPIN_IRQ_UNLOCK_ISR(lock, ctx)  rtems_interrupt_lock_release_isr(lock, &(ctx))
    26 #define SPIN_IRQ_CTX                    rtems_interrupt_lock_context
     20#include <grlib_impl.h>
    2721
    2822#define REG_WRITE(addr, val) (*(volatile uint32_t *)(addr) = (uint32_t)(val))
     
    7569        uint32_t last_address;
    7670        /* Spin-lock ISR protection */
    77         SPIN_IRQ_DECLARE(devlock);
     71        SPIN_DECLARE(devlock);
    7872};
    7973
     
    138132         * API calls involivng priv structure from updates in ISR.
    139133         */
    140         SPIN_IRQ_INIT(&priv->devlock, priv->devname);
     134        SPIN_INIT(&priv->devlock, priv->devname);
    141135
    142136        /* Initialize hardware */
     
    154148        uint32_t fadr, status;
    155149        int rc;
    156         SPIN_IRQ_CTX lock_context;
     150        SPIN_ISR_IRQFLAGS(lock_context);
    157151
    158152        /* Get hardware status */
     
    166160        fadr = REG_READ(&priv->regs->failing);
    167161
    168         SPIN_IRQ_LOCK_ISR(&priv->devlock, lock_context);
     162        SPIN_LOCK(&priv->devlock, lock_context);
    169163        priv->last_status = status;
    170164        priv->last_address = fadr;
    171         SPIN_IRQ_UNLOCK_ISR(&priv->devlock, lock_context);
     165        SPIN_UNLOCK(&priv->devlock, lock_context);
    172166
    173167        /* Let user handle error, default to print the error and reenable HW
     
    212206        uint32_t last_status;
    213207        uint32_t last_address;
    214         SPIN_IRQ_CTX lock_context;
     208        SPIN_IRQFLAGS(lock_context);
    215209
    216210        if (drvmgr_get_dev(&ahbstat_drv_info.general, minor, &dev)) {
     
    220214
    221215        /* Read information cached by ISR */
    222         SPIN_IRQ_LOCK(&priv->devlock, lock_context);
     216        SPIN_LOCK_IRQ(&priv->devlock, lock_context);
    223217        last_status = REG_READ(&priv->last_status);
    224218        last_address = REG_READ(&priv->last_address);
    225         SPIN_IRQ_UNLOCK(&priv->devlock, lock_context);
     219        SPIN_UNLOCK_IRQ(&priv->devlock, lock_context);
    226220
    227221        *status = last_status;
  • bsps/sparc/shared/can/grcan.c

    rc1864a0a ra7267241  
    2323#include <ambapp.h>
    2424
    25 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    26 
    27 /* Spin locks mapped via rtems_interrupt_lock_* API: */
    28 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    29 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    30 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    31 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    32 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    33 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    34 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    35 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    36 
    37 #else
    38 
    39 /* maintain compatibility with older versions of RTEMS: */
    40 #define SPIN_DECLARE(name)
    41 #define SPIN_INIT(lock, name)
    42 #define SPIN_LOCK(lock, level)
    43 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    44 #define SPIN_UNLOCK(lock, level)
    45 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    46 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    47 #define SPIN_ISR_IRQFLAGS(k)
    48 
    49 #endif
     25#include <grlib_impl.h>
    5026
    5127/* Maximum number of GRCAN devices supported by driver */
  • bsps/sparc/shared/can/occan.c

    rc1864a0a ra7267241  
    2020#include <drvmgr/ambapp_bus.h>
    2121#include <bsp/occan.h>
     22
     23#include <grlib_impl.h>
    2224
    2325/* RTEMS -> ERRNO decoding table
     
    7173        #define DBG(fmt, vargs...)
    7274#endif
    73 
    74 /* Spin locks mapped via rtems_interrupt_lock_* API: */
    75 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    76 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    77 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    78 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    79 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    80 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    81 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    82 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    8375
    8476/* fifo interface */
  • bsps/sparc/shared/net/greth.c

    rc1864a0a ra7267241  
    4444#include <netinet/if_ether.h>
    4545
    46 /* map via rtems_interrupt_lock_* API: */
    47 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    48 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    49 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    50 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    51 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    52 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    53 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    54 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     46#include <grlib_impl.h>
    5547
    5648#ifdef malloc
  • bsps/sparc/shared/pci/gr_701.c

    rc1864a0a ra7267241  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
    26 #include <rtems/score/isrlock.h> /* spin-lock */
    2726#include <pci.h>
    2827#include <pci/access.h>
     
    3938#include <bsp/gr_701.h>
    4039
    41 /* map via rtems_interrupt_lock_* API: */
    42 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    43 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    44 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    45 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    46 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    47 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    48 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    49 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     40#include <grlib_impl.h>
    5041
    5142/* Offset from 0x80000000 (dual bus version) */
  • bsps/sparc/shared/pci/gr_cpci_gr740.c

    rc1864a0a ra7267241  
    3434#include <bsp.h>
    3535#include <rtems/bspIo.h>
    36 #include <rtems/score/isrlock.h> /* spin-lock */
    3736#include <pci.h>
    3837
     
    4746#include <bsp/gr_cpci_gr740.h>
    4847
    49 /* map via rtems_interrupt_lock_* API: */
    50 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    51 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    52 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    53 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    54 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    55 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    56 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    57 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     48#include <grlib_impl.h>
    5849
    5950/* Determines which PCI address the AHB masters on the GR740 board will
  • bsps/sparc/shared/pci/gr_leon4_n2x.c

    rc1864a0a ra7267241  
    3333#include <bsp.h>
    3434#include <rtems/bspIo.h>
    35 #include <rtems/score/isrlock.h> /* spin-lock */
    3635#include <pci.h>
    3736
     
    4645#include <bsp/gr_leon4_n2x.h>
    4746
    48 /* map via rtems_interrupt_lock_* API: */
    49 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    50 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    51 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    52 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    53 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    54 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    55 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    56 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     47#include <grlib_impl.h>
    5748
    5849/* Determines which PCI address the AHB masters on the LEON-N2X board will
  • bsps/sparc/shared/pci/gr_rasta_adcdac.c

    rc1864a0a ra7267241  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
    26 #include <rtems/score/isrlock.h> /* spin-lock */
    2726#include <pci.h>
    2827
     
    3736#include <bsp/gr_rasta_adcdac.h>
    3837
    39 /* map via rtems_interrupt_lock_* API: */
    40 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    41 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    42 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    43 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    44 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    45 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    46 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    47 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     38#include <grlib_impl.h>
    4839
    4940/*#define DEBUG 1*/
  • bsps/sparc/shared/pci/gr_rasta_io.c

    rc1864a0a ra7267241  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
    26 #include <rtems/score/isrlock.h> /* spin-lock */
    2726#include <pci.h>
    2827
     
    3736#include <bsp/gr_rasta_io.h>
    3837
    39 /* map via rtems_interrupt_lock_* API: */
    40 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    41 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    42 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    43 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    44 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    45 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    46 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    47 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     38#include <grlib_impl.h>
    4839
    4940/* Determines which PCI address the AHB masters will access, it should be
  • bsps/sparc/shared/pci/gr_rasta_spw_router.c

    rc1864a0a ra7267241  
    2222#include <bsp.h>
    2323#include <rtems/bspIo.h>
    24 #include <rtems/score/isrlock.h> /* spin-lock */
    2524#include <pci.h>
    2625
     
    3433#include <bsp/gr_rasta_spw_router.h>
    3534
    36 /* map via rtems_interrupt_lock_* API: */
    37 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    38 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    39 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    40 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    41 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    42 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    43 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    44 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     35#include <grlib_impl.h>
    4536
    4637/* Determines which PCI address the AHB masters will access, it should be
  • bsps/sparc/shared/pci/gr_rasta_tmtc.c

    rc1864a0a ra7267241  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
    26 #include <rtems/score/isrlock.h> /* spin-lock */
    2726#include <pci.h>
    2827
     
    3736#include <bsp/gr_rasta_tmtc.h>
    3837
    39 /* map via rtems_interrupt_lock_* API: */
    40 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    41 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    42 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    43 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    44 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    45 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    46 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    47 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     38#include <grlib_impl.h>
    4839
    4940/* Determines which PCI address the AHB masters will access, it should be
  • bsps/sparc/shared/pci/gr_tmtc_1553.c

    rc1864a0a ra7267241  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
    26 #include <rtems/score/isrlock.h> /* spin-lock */
    2726#include <pci.h>
    2827#include <pci/access.h>
     
    3837#include <bsp/gr_tmtc_1553.h>
    3938
    40 /* map via rtems_interrupt_lock_* API: */
    41 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    42 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    43 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    44 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    45 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    46 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    47 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    48 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     39#include <grlib_impl.h>
    4940
    5041/*#define DEBUG 1 */
  • bsps/sparc/shared/pci/grpci2.c

    rc1864a0a ra7267241  
    4444#include <bsp/grpci2.h>
    4545
    46 /* Use interrupt lock privmitives compatible with SMP defined in
    47  * RTEMS 4.11.99 and higher.
    48  */
    49 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    50 
    51 /* map via rtems_interrupt_lock_* API: */
    52 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    53 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    54 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    55 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    56 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    57 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    58 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    59 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    60 
    61 #else
    62 
    63 /* maintain single-core compatibility with older versions of RTEMS: */
    64 #define SPIN_DECLARE(name)
    65 #define SPIN_INIT(lock, name)
    66 #define SPIN_LOCK(lock, level)
    67 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    68 #define SPIN_UNLOCK(lock, level)
    69 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    70 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    71 #define SPIN_ISR_IRQFLAGS(k)
    72 
    73 #ifdef RTEMS_SMP
    74 #error SMP mode not compatible with these interrupt lock primitives
    75 #endif
    76 #endif
     46#include <grlib_impl.h>
    7747
    7848/* If defined to 1 - byte twisting is enabled by default */
  • bsps/sparc/shared/pci/grpci2dma.c

    rc1864a0a ra7267241  
    1919#include <bsp/grpci2dma.h>
    2020
     21#include <grlib_impl.h>
     22
    2123/* This driver has been prepared for SMP operation
    2224 */
    23 /* Use interrupt lock privmitives compatible with SMP defined in
    24  * RTEMS 4.11.99 and higher.
    25  */
    26 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    27 
    28 /* map via rtems_interrupt_lock_* API: */
    29 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    30 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    31 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    32 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    33 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    34 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    35 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    36 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    37 
    38 #else
    39 
    40 /* maintain single-core compatibility with older versions of RTEMS: */
    41 #define SPIN_DECLARE(name)
    42 #define SPIN_INIT(lock, name)
    43 #define SPIN_LOCK(lock, level)
    44 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    45 #define SPIN_UNLOCK(lock, level)
    46 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    47 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    48 #define SPIN_ISR_IRQFLAGS(k)
    49 
    50 #ifdef RTEMS_SMP
    51 #error SMP mode not compatible with these interrupt lock primitives
    52 #endif
    53 
    54 #endif
    5525
    5626/*#define STATIC*/
  • bsps/sparc/shared/spw/grspw_pkt.c

    rc1864a0a ra7267241  
    2929#include <bsp/grspw_pkt.h>
    3030
    31 /* Use interrupt lock privmitives compatible with SMP defined in
    32  * RTEMS 4.11.99 and higher.
    33  */
    34 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    35 
    36 #include <rtems/score/isrlock.h> /* spin-lock */
    37 
    38 /* map via ISR lock: */
    39 #define SPIN_DECLARE(lock) ISR_LOCK_MEMBER(lock)
    40 #define SPIN_INIT(lock, name) _ISR_lock_Initialize(lock, name)
    41 #define SPIN_LOCK(lock, level) _ISR_lock_Acquire_inline(lock, &level)
    42 #define SPIN_LOCK_IRQ(lock, level) _ISR_lock_ISR_disable_and_acquire(lock, &level)
    43 #define SPIN_UNLOCK(lock, level) _ISR_lock_Release_inline(lock, &level)
    44 #define SPIN_UNLOCK_IRQ(lock, level) _ISR_lock_Release_and_ISR_enable(lock, &level)
    45 #define SPIN_IRQFLAGS(k) ISR_lock_Context k
    46 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    47 
    48 #else
    49 
    50 /* maintain single-core compatibility with older versions of RTEMS: */
    51 #define SPIN_DECLARE(name)
    52 #define SPIN_INIT(lock, name)
    53 #define SPIN_LOCK(lock, level)
    54 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    55 #define SPIN_UNLOCK(lock, level)
    56 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    57 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    58 #define SPIN_ISR_IRQFLAGS(k)
    59 
    60 #ifdef RTEMS_SMP
    61 #error SMP mode not compatible with these interrupt lock primitives
    62 #endif
    63 
    64 #endif
     31#include <grlib_impl.h>
    6532
    6633/*#define STATIC*/
  • bsps/sparc/shared/spw/grspw_router.c

    rc1864a0a ra7267241  
    1414#include <stdio.h>
    1515#include <bsp.h>
    16 #include <rtems/bspIo.h> /* printk */
    1716
    1817#include <drvmgr/drvmgr.h>
    1918#include <drvmgr/ambapp_bus.h>
    2019#include <bsp/grspw_router.h>
     20
     21#include <grlib_impl.h>
    2122
    2223//#define STATIC
     
    3435
    3536#define THREAD_SAFE 1
    36 
    37 /* Use interrupt lock privmitives compatible with SMP defined in
    38  * RTEMS 4.11.99 and higher.
    39  */
    40 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    41 
    42 #ifdef THREAD_SAFE
    43 /* map via rtems_interrupt_lock_* API: */
    44 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    45 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    46 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    47 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    48 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    49 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    50 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    51 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    52 #define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock)
    53 #else
    54 #define SPIN_DECLARE(lock)
    55 #define SPIN_INIT(lock, name)
    56 #define SPIN_LOCK(lock, level)
    57 #define SPIN_LOCK_IRQ(lock, level)
    58 #define SPIN_UNLOCK(lock, level)
    59 #define SPIN_UNLOCK_IRQ(lock, level)
    60 #define SPIN_IRQFLAGS(k)
    61 #define SPIN_ISR_IRQFLAGS(k)
    62 #define SPIN_FREE(lock)
    63 #endif
    64 
    65 #else
    66 
    67 #ifdef THREAD_SAFE
    68 #error THREAD SAFE operation not supported on this RTEMS version
    69 #else
    70 #define SPIN_DECLARE(lock)
    71 #define SPIN_INIT(lock, name)
    72 #define SPIN_LOCK(lock, level)
    73 #define SPIN_LOCK_IRQ(lock, level)
    74 #define SPIN_UNLOCK(lock, level)
    75 #define SPIN_UNLOCK_IRQ(lock, level)
    76 #define SPIN_IRQFLAGS(k)
    77 #define SPIN_ISR_IRQFLAGS(k)
    78 #define SPIN_FREE(lock)
    79 #endif
    80 
    81 #ifdef RTEMS_SMP
    82 #error SMP mode not compatible with these interrupt lock primitives
    83 #endif
    84 
    85 #endif
    8637
    8738#define REG_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
  • bsps/sparc/shared/spw/spwtdp.c

    rc1864a0a ra7267241  
    2222#include <bsp/spwtdp.h>
    2323
    24 /* Use interrupt lock privmitives compatible with SMP defined in
    25  * RTEMS 4.11.99 and higher.
    26  */
    27 #if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
    28 
    29 /* map via rtems_interrupt_lock_* API: */
    30 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    31 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    32 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    33 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    34 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    35 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    36 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    37 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    38 
    39 #else
    40 
    41 /* maintain single-core compatibility with older versions of RTEMS: */
    42 #define SPIN_DECLARE(name)
    43 #define SPIN_INIT(lock, name)
    44 #define SPIN_LOCK(lock, level)
    45 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level)
    46 #define SPIN_UNLOCK(lock, level)
    47 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level)
    48 #define SPIN_IRQFLAGS(k) rtems_interrupt_level k
    49 #define SPIN_ISR_IRQFLAGS(k)
    50 
    51 #ifdef RTEMS_SMP
    52 #error SMP mode not compatible with these interrupt lock primitives
    53 #endif
    54 
    55 #endif
     24#include <grlib_impl.h>
    5625
    5726/*#define STATIC*/
  • bsps/sparc/shared/tmtc/grtc.c

    rc1864a0a ra7267241  
    2424#include <bsp/grtc.h>
    2525
    26 /* map via rtems_interrupt_lock_* API: */
    27 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    28 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    29 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    30 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    31 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    32 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    33 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    34 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
    35 
    36 /* turn on/off local CPU's interrupt to ensure HW timing - not SMP safe. */
    37 #define IRQ_LOCAL_DECLARE(_level) rtems_interrupt_level _level
    38 #define IRQ_LOCAL_DISABLE(_level) rtems_interrupt_local_disable(_level)
    39 #define IRQ_LOCAL_ENABLE(_level) rtems_interrupt_local_enable(_level)
     26#include <grlib_impl.h>
    4027
    4128/*
  • bsps/sparc/shared/tmtc/grtm.c

    rc1864a0a ra7267241  
    2424#include <bsp/grtm.h>
    2525
    26 /* map via rtems_interrupt_lock_* API: */
    27 #define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock)
    28 #define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name)
    29 #define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level)
    30 #define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level)
    31 #define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level)
    32 #define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level)
    33 #define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k
    34 #define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k)
     26#include <grlib_impl.h>
    3527
    3628/*
Note: See TracChangeset for help on using the changeset viewer.