From a7267241a9ace0f8c1c1c9a9ee1721e04313aa91 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 26 Nov 2018 15:44:25 +0100 Subject: bsps/sparc: Add and use Reduce copy and paste. --- bsps/sparc/headers.am | 1 + bsps/sparc/include/grlib_impl.h | 70 +++++++++++++++++++++++++++++ bsps/sparc/shared/1553/gr1553bc.c | 35 +-------------- bsps/sparc/shared/1553/gr1553bm.c | 36 +-------------- bsps/sparc/shared/1553/gr1553rt.c | 13 +----- bsps/sparc/shared/amba/ahbstat.c | 24 ++++------ bsps/sparc/shared/can/grcan.c | 26 +---------- bsps/sparc/shared/can/occan.c | 12 +---- bsps/sparc/shared/net/greth.c | 10 +---- bsps/sparc/shared/pci/gr_701.c | 11 +---- bsps/sparc/shared/pci/gr_cpci_gr740.c | 11 +---- bsps/sparc/shared/pci/gr_leon4_n2x.c | 11 +---- bsps/sparc/shared/pci/gr_rasta_adcdac.c | 11 +---- bsps/sparc/shared/pci/gr_rasta_io.c | 11 +---- bsps/sparc/shared/pci/gr_rasta_spw_router.c | 11 +---- bsps/sparc/shared/pci/gr_rasta_tmtc.c | 11 +---- bsps/sparc/shared/pci/gr_tmtc_1553.c | 11 +---- bsps/sparc/shared/pci/grpci2.c | 32 +------------ bsps/sparc/shared/pci/grpci2dma.c | 34 +------------- bsps/sparc/shared/spw/grspw_pkt.c | 35 +-------------- bsps/sparc/shared/spw/grspw_router.c | 53 +--------------------- bsps/sparc/shared/spw/spwtdp.c | 33 +------------- bsps/sparc/shared/tmtc/grtc.c | 15 +------ bsps/sparc/shared/tmtc/grtm.c | 10 +---- 24 files changed, 105 insertions(+), 422 deletions(-) create mode 100644 bsps/sparc/include/grlib_impl.h diff --git a/bsps/sparc/headers.am b/bsps/sparc/headers.am index 4c6efb86ce..14d92f741c 100644 --- a/bsps/sparc/headers.am +++ b/bsps/sparc/headers.am @@ -4,6 +4,7 @@ include_HEADERS = include_HEADERS += ../../../../../bsps/sparc/include/ambapp.h include_HEADERS += ../../../../../bsps/sparc/include/ambapp_ids.h include_HEADERS += ../../../../../bsps/sparc/include/grlib.h +include_HEADERS += ../../../../../bsps/sparc/include/grlib_impl.h include_bspdir = $(includedir)/bsp include_bsp_HEADERS = diff --git a/bsps/sparc/include/grlib_impl.h b/bsps/sparc/include/grlib_impl.h new file mode 100644 index 0000000000..2760c68626 --- /dev/null +++ b/bsps/sparc/include/grlib_impl.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2017 Cobham Gaisler AB + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef GRLIB_IMPL_H +#define GRLIB_IMPL_H + +#include + +/* + * Use interrupt lock primitives compatible with SMP defined in RTEMS 4.11.99 + * and higher. + */ +#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) + +#include + +/* map via rtems_interrupt_lock_* API: */ +#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) +#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) +#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) +#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) +#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) +#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) +#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k +#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock) + +/* turn on/off local CPU's interrupt to ensure HW timing - not SMP safe. */ +#define IRQ_LOCAL_DECLARE(_level) rtems_interrupt_level _level +#define IRQ_LOCAL_DISABLE(_level) rtems_interrupt_local_disable(_level) +#define IRQ_LOCAL_ENABLE(_level) rtems_interrupt_local_enable(_level) + +#else + +#ifdef RTEMS_SMP +#error SMP mode not compatible with these interrupt lock primitives +#endif + +/* maintain single-core compatibility with older versions of RTEMS: */ +#define SPIN_DECLARE(name) +#define SPIN_INIT(lock, name) +#define SPIN_LOCK(lock, level) +#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) +#define SPIN_UNLOCK(lock, level) +#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) +#define SPIN_IRQFLAGS(k) rtems_interrupt_level k +#define SPIN_ISR_IRQFLAGS(k) +#define SPIN_FREE(lock) + +/* turn on/off local CPU's interrupt to ensure HW timing - not SMP safe. */ +#define IRQ_LOCAL_DECLARE(_level) rtems_interrupt_level _level +#define IRQ_LOCAL_DISABLE(_level) rtems_interrupt_disable(_level) +#define IRQ_LOCAL_ENABLE(_level) rtems_interrupt_enable(_level) + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* GRLIB_IMPL_H */ diff --git a/bsps/sparc/shared/1553/gr1553bc.c b/bsps/sparc/shared/1553/gr1553bc.c index 3b967d0f37..099976f958 100644 --- a/bsps/sparc/shared/1553/gr1553bc.c +++ b/bsps/sparc/shared/1553/gr1553bc.c @@ -17,40 +17,7 @@ #include #include -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) -#define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) -#define SPIN_FREE(lock) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif +#include #define GR1553BC_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553BC_READ_MEM(adr) (*(volatile uint32_t *)(adr)) diff --git a/bsps/sparc/shared/1553/gr1553bm.c b/bsps/sparc/shared/1553/gr1553bm.c index d63983bda9..040dbf0d92 100644 --- a/bsps/sparc/shared/1553/gr1553bm.c +++ b/bsps/sparc/shared/1553/gr1553bm.c @@ -16,6 +16,7 @@ #include #include +#include #define GR1553BM_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553BM_READ_MEM(adr) (*(volatile uint32_t *)(adr)) @@ -23,41 +24,6 @@ #define GR1553BM_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553BM_READ_REG(adr) (*(volatile uint32_t *)(adr)) -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) -#define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) -#define SPIN_FREE(lock) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif - struct gr1553bm_priv { struct drvmgr_dev **pdev; struct gr1553b_regs *regs; diff --git a/bsps/sparc/shared/1553/gr1553rt.c b/bsps/sparc/shared/1553/gr1553rt.c index 932e8494f1..7f2e75af3e 100644 --- a/bsps/sparc/shared/1553/gr1553rt.c +++ b/bsps/sparc/shared/1553/gr1553rt.c @@ -19,23 +19,14 @@ #include #include +#include + #define GR1553RT_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553RT_READ_MEM(adr) (*(volatile uint32_t *)(adr)) #define GR1553RT_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553RT_READ_REG(adr) (*(volatile uint32_t *)(adr)) -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) -#define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock) - /* Software representation of one hardware descriptor */ struct gr1553rt_sw_bd { unsigned short this_next;/* Next entry or this entry. 0xffff: no next */ diff --git a/bsps/sparc/shared/amba/ahbstat.c b/bsps/sparc/shared/amba/ahbstat.c index e624301975..f57d6430c9 100644 --- a/bsps/sparc/shared/amba/ahbstat.c +++ b/bsps/sparc/shared/amba/ahbstat.c @@ -17,13 +17,7 @@ #include -#define SPIN_IRQ_DECLARE(name) RTEMS_INTERRUPT_LOCK_DECLARE(, name) -#define SPIN_IRQ_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_IRQ_LOCK(lock, ctx) rtems_interrupt_lock_acquire(lock, &(ctx)) -#define SPIN_IRQ_UNLOCK(lock, ctx) rtems_interrupt_lock_release(lock, &(ctx)) -#define SPIN_IRQ_LOCK_ISR(lock, ctx) rtems_interrupt_lock_acquire_isr(lock, &(ctx)) -#define SPIN_IRQ_UNLOCK_ISR(lock, ctx) rtems_interrupt_lock_release_isr(lock, &(ctx)) -#define SPIN_IRQ_CTX rtems_interrupt_lock_context +#include #define REG_WRITE(addr, val) (*(volatile uint32_t *)(addr) = (uint32_t)(val)) #define REG_READ(addr) (*(volatile uint32_t *)(addr)) @@ -74,7 +68,7 @@ struct ahbstat_priv { uint32_t last_status; uint32_t last_address; /* Spin-lock ISR protection */ - SPIN_IRQ_DECLARE(devlock); + SPIN_DECLARE(devlock); }; static int ahbstat_init2(struct drvmgr_dev *dev); @@ -137,7 +131,7 @@ static int ahbstat_init2(struct drvmgr_dev *dev) * Initialize spinlock for AHBSTAT Device. It is used to protect user * API calls involivng priv structure from updates in ISR. */ - SPIN_IRQ_INIT(&priv->devlock, priv->devname); + SPIN_INIT(&priv->devlock, priv->devname); /* Initialize hardware */ REG_WRITE(&priv->regs->status, 0); @@ -153,7 +147,7 @@ void ahbstat_isr(void *arg) struct ahbstat_priv *priv = arg; uint32_t fadr, status; int rc; - SPIN_IRQ_CTX lock_context; + SPIN_ISR_IRQFLAGS(lock_context); /* Get hardware status */ status = REG_READ(&priv->regs->status); @@ -165,10 +159,10 @@ void ahbstat_isr(void *arg) /* Get Failing address */ fadr = REG_READ(&priv->regs->failing); - SPIN_IRQ_LOCK_ISR(&priv->devlock, lock_context); + SPIN_LOCK(&priv->devlock, lock_context); priv->last_status = status; priv->last_address = fadr; - SPIN_IRQ_UNLOCK_ISR(&priv->devlock, lock_context); + SPIN_UNLOCK(&priv->devlock, lock_context); /* Let user handle error, default to print the error and reenable HW * @@ -211,7 +205,7 @@ int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address) struct ahbstat_priv *priv; uint32_t last_status; uint32_t last_address; - SPIN_IRQ_CTX lock_context; + SPIN_IRQFLAGS(lock_context); if (drvmgr_get_dev(&ahbstat_drv_info.general, minor, &dev)) { return -1; @@ -219,10 +213,10 @@ int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address) priv = (struct ahbstat_priv *)dev->priv; /* Read information cached by ISR */ - SPIN_IRQ_LOCK(&priv->devlock, lock_context); + SPIN_LOCK_IRQ(&priv->devlock, lock_context); last_status = REG_READ(&priv->last_status); last_address = REG_READ(&priv->last_address); - SPIN_IRQ_UNLOCK(&priv->devlock, lock_context); + SPIN_UNLOCK_IRQ(&priv->devlock, lock_context); *status = last_status; *address = last_address; diff --git a/bsps/sparc/shared/can/grcan.c b/bsps/sparc/shared/can/grcan.c index da236ef7cc..6762c96b44 100644 --- a/bsps/sparc/shared/can/grcan.c +++ b/bsps/sparc/shared/can/grcan.c @@ -22,31 +22,7 @@ #include #include -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* Spin locks mapped via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -#else - -/* maintain compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) - -#endif +#include /* Maximum number of GRCAN devices supported by driver */ #define GRCAN_COUNT_MAX 8 diff --git a/bsps/sparc/shared/can/occan.c b/bsps/sparc/shared/can/occan.c index 2c0e49a2d5..b45b11dc72 100644 --- a/bsps/sparc/shared/can/occan.c +++ b/bsps/sparc/shared/can/occan.c @@ -20,6 +20,8 @@ #include #include +#include + /* RTEMS -> ERRNO decoding table rtems_assoc_t errno_assoc[] = { @@ -71,16 +73,6 @@ rtems_assoc_t errno_assoc[] = { #define DBG(fmt, vargs...) #endif -/* Spin locks mapped via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - /* fifo interface */ typedef struct { int cnt; diff --git a/bsps/sparc/shared/net/greth.c b/bsps/sparc/shared/net/greth.c index 649ae9df24..830d6b2475 100644 --- a/bsps/sparc/shared/net/greth.c +++ b/bsps/sparc/shared/net/greth.c @@ -43,15 +43,7 @@ #include #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include #ifdef malloc #undef malloc diff --git a/bsps/sparc/shared/pci/gr_701.c b/bsps/sparc/shared/pci/gr_701.c index 2350e58b51..3e2109fbf5 100644 --- a/bsps/sparc/shared/pci/gr_701.c +++ b/bsps/sparc/shared/pci/gr_701.c @@ -23,7 +23,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -38,15 +37,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Offset from 0x80000000 (dual bus version) */ #define AHB1_BASE_ADDR 0x80000000 diff --git a/bsps/sparc/shared/pci/gr_cpci_gr740.c b/bsps/sparc/shared/pci/gr_cpci_gr740.c index 9b4fbfa3b2..dbb094744d 100644 --- a/bsps/sparc/shared/pci/gr_cpci_gr740.c +++ b/bsps/sparc/shared/pci/gr_cpci_gr740.c @@ -33,7 +33,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -46,15 +45,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Determines which PCI address the AHB masters on the GR740 board will * access when accessing the AHB to PCI window, it should be set so that the diff --git a/bsps/sparc/shared/pci/gr_leon4_n2x.c b/bsps/sparc/shared/pci/gr_leon4_n2x.c index c97c0b8cf5..76e2bb0b28 100644 --- a/bsps/sparc/shared/pci/gr_leon4_n2x.c +++ b/bsps/sparc/shared/pci/gr_leon4_n2x.c @@ -32,7 +32,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -45,15 +44,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Determines which PCI address the AHB masters on the LEON-N2X board will * access when accessing the AHB to PCI window, it should be set so that the diff --git a/bsps/sparc/shared/pci/gr_rasta_adcdac.c b/bsps/sparc/shared/pci/gr_rasta_adcdac.c index 4bd00730e1..8a58438287 100644 --- a/bsps/sparc/shared/pci/gr_rasta_adcdac.c +++ b/bsps/sparc/shared/pci/gr_rasta_adcdac.c @@ -23,7 +23,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -36,15 +35,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /*#define DEBUG 1*/ diff --git a/bsps/sparc/shared/pci/gr_rasta_io.c b/bsps/sparc/shared/pci/gr_rasta_io.c index 02c8b5b572..78f6eefa20 100644 --- a/bsps/sparc/shared/pci/gr_rasta_io.c +++ b/bsps/sparc/shared/pci/gr_rasta_io.c @@ -23,7 +23,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -36,15 +35,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Determines which PCI address the AHB masters will access, it should be * set so that the masters can access the CPU RAM. Default is base of CPU RAM, diff --git a/bsps/sparc/shared/pci/gr_rasta_spw_router.c b/bsps/sparc/shared/pci/gr_rasta_spw_router.c index 194d0a9b99..dede9a8190 100644 --- a/bsps/sparc/shared/pci/gr_rasta_spw_router.c +++ b/bsps/sparc/shared/pci/gr_rasta_spw_router.c @@ -21,7 +21,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -33,15 +32,7 @@ #include #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Determines which PCI address the AHB masters will access, it should be * set so that the masters can access the CPU RAM. Default is base of CPU RAM, diff --git a/bsps/sparc/shared/pci/gr_rasta_tmtc.c b/bsps/sparc/shared/pci/gr_rasta_tmtc.c index 7f49d1de1d..f615958c84 100644 --- a/bsps/sparc/shared/pci/gr_rasta_tmtc.c +++ b/bsps/sparc/shared/pci/gr_rasta_tmtc.c @@ -23,7 +23,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -36,15 +35,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* Determines which PCI address the AHB masters will access, it should be * set so that the masters can access the CPU RAM. Default is base of CPU RAM, diff --git a/bsps/sparc/shared/pci/gr_tmtc_1553.c b/bsps/sparc/shared/pci/gr_tmtc_1553.c index 4bbdaffb84..f68188bc9e 100644 --- a/bsps/sparc/shared/pci/gr_tmtc_1553.c +++ b/bsps/sparc/shared/pci/gr_tmtc_1553.c @@ -23,7 +23,6 @@ #include #include -#include /* spin-lock */ #include #include @@ -37,15 +36,7 @@ #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /*#define DEBUG 1 */ diff --git a/bsps/sparc/shared/pci/grpci2.c b/bsps/sparc/shared/pci/grpci2.c index 69aa938d97..9bb479c110 100644 --- a/bsps/sparc/shared/pci/grpci2.c +++ b/bsps/sparc/shared/pci/grpci2.c @@ -43,37 +43,7 @@ #include #include -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif -#endif +#include /* If defined to 1 - byte twisting is enabled by default */ #define DEFAULT_BT_ENABLED 0 diff --git a/bsps/sparc/shared/pci/grpci2dma.c b/bsps/sparc/shared/pci/grpci2dma.c index d5f1f9942f..92c2038de0 100644 --- a/bsps/sparc/shared/pci/grpci2dma.c +++ b/bsps/sparc/shared/pci/grpci2dma.c @@ -18,40 +18,10 @@ #include #include +#include + /* This driver has been prepared for SMP operation */ -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif /*#define STATIC*/ #define STATIC static diff --git a/bsps/sparc/shared/spw/grspw_pkt.c b/bsps/sparc/shared/spw/grspw_pkt.c index c109a25a6b..113684b1fe 100644 --- a/bsps/sparc/shared/spw/grspw_pkt.c +++ b/bsps/sparc/shared/spw/grspw_pkt.c @@ -28,40 +28,7 @@ #include #include -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -#include /* spin-lock */ - -/* map via ISR lock: */ -#define SPIN_DECLARE(lock) ISR_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) _ISR_lock_Initialize(lock, name) -#define SPIN_LOCK(lock, level) _ISR_lock_Acquire_inline(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) _ISR_lock_ISR_disable_and_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) _ISR_lock_Release_inline(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) _ISR_lock_Release_and_ISR_enable(lock, &level) -#define SPIN_IRQFLAGS(k) ISR_lock_Context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif +#include /*#define STATIC*/ #define STATIC static diff --git a/bsps/sparc/shared/spw/grspw_router.c b/bsps/sparc/shared/spw/grspw_router.c index d95c351443..41ecfb823a 100644 --- a/bsps/sparc/shared/spw/grspw_router.c +++ b/bsps/sparc/shared/spw/grspw_router.c @@ -13,12 +13,13 @@ #include #include #include -#include /* printk */ #include #include #include +#include + //#define STATIC #define STATIC static @@ -34,56 +35,6 @@ #define THREAD_SAFE 1 -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -#ifdef THREAD_SAFE -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) -#define SPIN_FREE(lock) rtems_interrupt_lock_destroy(lock) -#else -#define SPIN_DECLARE(lock) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) -#define SPIN_IRQFLAGS(k) -#define SPIN_ISR_IRQFLAGS(k) -#define SPIN_FREE(lock) -#endif - -#else - -#ifdef THREAD_SAFE -#error THREAD SAFE operation not supported on this RTEMS version -#else -#define SPIN_DECLARE(lock) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) -#define SPIN_IRQFLAGS(k) -#define SPIN_ISR_IRQFLAGS(k) -#define SPIN_FREE(lock) -#endif - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif - #define REG_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val)) #define REG_READ(addr) (*(volatile unsigned int *)(addr)) diff --git a/bsps/sparc/shared/spw/spwtdp.c b/bsps/sparc/shared/spw/spwtdp.c index cf5b3af946..679a5b79c5 100644 --- a/bsps/sparc/shared/spw/spwtdp.c +++ b/bsps/sparc/shared/spw/spwtdp.c @@ -21,38 +21,7 @@ #include #include -/* Use interrupt lock privmitives compatible with SMP defined in - * RTEMS 4.11.99 and higher. - */ -#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) - -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -#else - -/* maintain single-core compatibility with older versions of RTEMS: */ -#define SPIN_DECLARE(name) -#define SPIN_INIT(lock, name) -#define SPIN_LOCK(lock, level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_disable(level) -#define SPIN_UNLOCK(lock, level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_enable(level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_level k -#define SPIN_ISR_IRQFLAGS(k) - -#ifdef RTEMS_SMP -#error SMP mode not compatible with these interrupt lock primitives -#endif - -#endif +#include /*#define STATIC*/ #define STATIC static diff --git a/bsps/sparc/shared/tmtc/grtc.c b/bsps/sparc/shared/tmtc/grtc.c index c01d7d8391..4e877465ab 100644 --- a/bsps/sparc/shared/tmtc/grtc.c +++ b/bsps/sparc/shared/tmtc/grtc.c @@ -23,20 +23,7 @@ #include #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) - -/* turn on/off local CPU's interrupt to ensure HW timing - not SMP safe. */ -#define IRQ_LOCAL_DECLARE(_level) rtems_interrupt_level _level -#define IRQ_LOCAL_DISABLE(_level) rtems_interrupt_local_disable(_level) -#define IRQ_LOCAL_ENABLE(_level) rtems_interrupt_local_enable(_level) +#include /* #define DEBUG diff --git a/bsps/sparc/shared/tmtc/grtm.c b/bsps/sparc/shared/tmtc/grtm.c index bd7d98f972..10a4f6eb00 100644 --- a/bsps/sparc/shared/tmtc/grtm.c +++ b/bsps/sparc/shared/tmtc/grtm.c @@ -23,15 +23,7 @@ #include #include -/* map via rtems_interrupt_lock_* API: */ -#define SPIN_DECLARE(lock) RTEMS_INTERRUPT_LOCK_MEMBER(lock) -#define SPIN_INIT(lock, name) rtems_interrupt_lock_initialize(lock, name) -#define SPIN_LOCK(lock, level) rtems_interrupt_lock_acquire_isr(lock, &level) -#define SPIN_LOCK_IRQ(lock, level) rtems_interrupt_lock_acquire(lock, &level) -#define SPIN_UNLOCK(lock, level) rtems_interrupt_lock_release_isr(lock, &level) -#define SPIN_UNLOCK_IRQ(lock, level) rtems_interrupt_lock_release(lock, &level) -#define SPIN_IRQFLAGS(k) rtems_interrupt_lock_context k -#define SPIN_ISR_IRQFLAGS(k) SPIN_IRQFLAGS(k) +#include /* #define DEBUG -- cgit v1.2.3