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

Reduce copy and paste.
This commit is contained in:
Sebastian Huber
2018-11-26 15:44:25 +01:00
parent c1864a0ad3
commit a7267241a9
24 changed files with 105 additions and 422 deletions

View File

@@ -4,6 +4,7 @@ include_HEADERS =
include_HEADERS += ../../../../../bsps/sparc/include/ambapp.h include_HEADERS += ../../../../../bsps/sparc/include/ambapp.h
include_HEADERS += ../../../../../bsps/sparc/include/ambapp_ids.h include_HEADERS += ../../../../../bsps/sparc/include/ambapp_ids.h
include_HEADERS += ../../../../../bsps/sparc/include/grlib.h include_HEADERS += ../../../../../bsps/sparc/include/grlib.h
include_HEADERS += ../../../../../bsps/sparc/include/grlib_impl.h
include_bspdir = $(includedir)/bsp include_bspdir = $(includedir)/bsp
include_bsp_HEADERS = include_bsp_HEADERS =

View File

@@ -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 <rtems/score/basedefs.h>
/*
* 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 <rtems/score/isrlock.h>
/* 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 */

View File

@@ -17,40 +17,7 @@
#include <bsp/gr1553b.h> #include <bsp/gr1553b.h>
#include <bsp/gr1553bc.h> #include <bsp/gr1553bc.h>
/* Use interrupt lock privmitives compatible with SMP defined in #include <grlib_impl.h>
* 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
#define GR1553BC_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553BC_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
#define GR1553BC_READ_MEM(adr) (*(volatile uint32_t *)(adr)) #define GR1553BC_READ_MEM(adr) (*(volatile uint32_t *)(adr))

View File

@@ -16,6 +16,7 @@
#include <bsp/gr1553b.h> #include <bsp/gr1553b.h>
#include <bsp/gr1553bm.h> #include <bsp/gr1553bm.h>
#include <grlib_impl.h>
#define GR1553BM_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553BM_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
#define GR1553BM_READ_MEM(adr) (*(volatile uint32_t *)(adr)) #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_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
#define GR1553BM_READ_REG(adr) (*(volatile uint32_t *)(adr)) #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 gr1553bm_priv {
struct drvmgr_dev **pdev; struct drvmgr_dev **pdev;
struct gr1553b_regs *regs; struct gr1553b_regs *regs;

View File

@@ -19,23 +19,14 @@
#include <drvmgr/drvmgr.h> #include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <grlib_impl.h>
#define GR1553RT_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553RT_WRITE_MEM(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
#define GR1553RT_READ_MEM(adr) (*(volatile uint32_t *)(adr)) #define GR1553RT_READ_MEM(adr) (*(volatile uint32_t *)(adr))
#define GR1553RT_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val) #define GR1553RT_WRITE_REG(adr, val) *(volatile uint32_t *)(adr) = (uint32_t)(val)
#define GR1553RT_READ_REG(adr) (*(volatile uint32_t *)(adr)) #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 */ /* Software representation of one hardware descriptor */
struct gr1553rt_sw_bd { struct gr1553rt_sw_bd {
unsigned short this_next;/* Next entry or this entry. 0xffff: no next */ unsigned short this_next;/* Next entry or this entry. 0xffff: no next */

View File

@@ -17,13 +17,7 @@
#include <bsp/ahbstat.h> #include <bsp/ahbstat.h>
#define SPIN_IRQ_DECLARE(name) RTEMS_INTERRUPT_LOCK_DECLARE(, name) #include <grlib_impl.h>
#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
#define REG_WRITE(addr, val) (*(volatile uint32_t *)(addr) = (uint32_t)(val)) #define REG_WRITE(addr, val) (*(volatile uint32_t *)(addr) = (uint32_t)(val))
#define REG_READ(addr) (*(volatile uint32_t *)(addr)) #define REG_READ(addr) (*(volatile uint32_t *)(addr))
@@ -74,7 +68,7 @@ struct ahbstat_priv {
uint32_t last_status; uint32_t last_status;
uint32_t last_address; uint32_t last_address;
/* Spin-lock ISR protection */ /* Spin-lock ISR protection */
SPIN_IRQ_DECLARE(devlock); SPIN_DECLARE(devlock);
}; };
static int ahbstat_init2(struct drvmgr_dev *dev); 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 * Initialize spinlock for AHBSTAT Device. It is used to protect user
* API calls involivng priv structure from updates in ISR. * API calls involivng priv structure from updates in ISR.
*/ */
SPIN_IRQ_INIT(&priv->devlock, priv->devname); SPIN_INIT(&priv->devlock, priv->devname);
/* Initialize hardware */ /* Initialize hardware */
REG_WRITE(&priv->regs->status, 0); REG_WRITE(&priv->regs->status, 0);
@@ -153,7 +147,7 @@ void ahbstat_isr(void *arg)
struct ahbstat_priv *priv = arg; struct ahbstat_priv *priv = arg;
uint32_t fadr, status; uint32_t fadr, status;
int rc; int rc;
SPIN_IRQ_CTX lock_context; SPIN_ISR_IRQFLAGS(lock_context);
/* Get hardware status */ /* Get hardware status */
status = REG_READ(&priv->regs->status); status = REG_READ(&priv->regs->status);
@@ -165,10 +159,10 @@ void ahbstat_isr(void *arg)
/* Get Failing address */ /* Get Failing address */
fadr = REG_READ(&priv->regs->failing); 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_status = status;
priv->last_address = fadr; 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 /* 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; struct ahbstat_priv *priv;
uint32_t last_status; uint32_t last_status;
uint32_t last_address; uint32_t last_address;
SPIN_IRQ_CTX lock_context; SPIN_IRQFLAGS(lock_context);
if (drvmgr_get_dev(&ahbstat_drv_info.general, minor, &dev)) { if (drvmgr_get_dev(&ahbstat_drv_info.general, minor, &dev)) {
return -1; return -1;
@@ -219,10 +213,10 @@ int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address)
priv = (struct ahbstat_priv *)dev->priv; priv = (struct ahbstat_priv *)dev->priv;
/* Read information cached by ISR */ /* 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_status = REG_READ(&priv->last_status);
last_address = REG_READ(&priv->last_address); last_address = REG_READ(&priv->last_address);
SPIN_IRQ_UNLOCK(&priv->devlock, lock_context); SPIN_UNLOCK_IRQ(&priv->devlock, lock_context);
*status = last_status; *status = last_status;
*address = last_address; *address = last_address;

View File

@@ -22,31 +22,7 @@
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <ambapp.h> #include <ambapp.h>
#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63) #include <grlib_impl.h>
/* 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
/* Maximum number of GRCAN devices supported by driver */ /* Maximum number of GRCAN devices supported by driver */
#define GRCAN_COUNT_MAX 8 #define GRCAN_COUNT_MAX 8

View File

@@ -20,6 +20,8 @@
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <bsp/occan.h> #include <bsp/occan.h>
#include <grlib_impl.h>
/* RTEMS -> ERRNO decoding table /* RTEMS -> ERRNO decoding table
rtems_assoc_t errno_assoc[] = { rtems_assoc_t errno_assoc[] = {
@@ -71,16 +73,6 @@ rtems_assoc_t errno_assoc[] = {
#define DBG(fmt, vargs...) #define DBG(fmt, vargs...)
#endif #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 */ /* fifo interface */
typedef struct { typedef struct {
int cnt; int cnt;

View File

@@ -43,15 +43,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
#ifdef malloc #ifdef malloc
#undef malloc #undef malloc

View File

@@ -23,7 +23,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <pci/access.h> #include <pci/access.h>
@@ -38,15 +37,7 @@
#include <bsp/gr_701.h> #include <bsp/gr_701.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Offset from 0x80000000 (dual bus version) */ /* Offset from 0x80000000 (dual bus version) */
#define AHB1_BASE_ADDR 0x80000000 #define AHB1_BASE_ADDR 0x80000000

View File

@@ -33,7 +33,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -46,15 +45,7 @@
#include <bsp/gr_cpci_gr740.h> #include <bsp/gr_cpci_gr740.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Determines which PCI address the AHB masters on the GR740 board will /* 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 * access when accessing the AHB to PCI window, it should be set so that the

View File

@@ -32,7 +32,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -45,15 +44,7 @@
#include <bsp/gr_leon4_n2x.h> #include <bsp/gr_leon4_n2x.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Determines which PCI address the AHB masters on the LEON-N2X board will /* 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 * access when accessing the AHB to PCI window, it should be set so that the

View File

@@ -23,7 +23,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -36,15 +35,7 @@
#include <bsp/gr_rasta_adcdac.h> #include <bsp/gr_rasta_adcdac.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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 DEBUG 1*/ /*#define DEBUG 1*/

View File

@@ -23,7 +23,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -36,15 +35,7 @@
#include <bsp/gr_rasta_io.h> #include <bsp/gr_rasta_io.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Determines which PCI address the AHB masters will access, it should be /* 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, * set so that the masters can access the CPU RAM. Default is base of CPU RAM,

View File

@@ -21,7 +21,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -33,15 +32,7 @@
#include <bsp/genirq.h> #include <bsp/genirq.h>
#include <bsp/gr_rasta_spw_router.h> #include <bsp/gr_rasta_spw_router.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Determines which PCI address the AHB masters will access, it should be /* 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, * set so that the masters can access the CPU RAM. Default is base of CPU RAM,

View File

@@ -23,7 +23,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <ambapp.h> #include <ambapp.h>
@@ -36,15 +35,7 @@
#include <bsp/gr_rasta_tmtc.h> #include <bsp/gr_rasta_tmtc.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* Determines which PCI address the AHB masters will access, it should be /* 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, * set so that the masters can access the CPU RAM. Default is base of CPU RAM,

View File

@@ -23,7 +23,6 @@
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <rtems/score/isrlock.h> /* spin-lock */
#include <pci.h> #include <pci.h>
#include <pci/access.h> #include <pci/access.h>
@@ -37,15 +36,7 @@
#include <bsp/gr_tmtc_1553.h> #include <bsp/gr_tmtc_1553.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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 DEBUG 1 */ /*#define DEBUG 1 */

View File

@@ -43,37 +43,7 @@
#include <drvmgr/pci_bus.h> #include <drvmgr/pci_bus.h>
#include <bsp/grpci2.h> #include <bsp/grpci2.h>
/* Use interrupt lock privmitives compatible with SMP defined in #include <grlib_impl.h>
* 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
/* If defined to 1 - byte twisting is enabled by default */ /* If defined to 1 - byte twisting is enabled by default */
#define DEFAULT_BT_ENABLED 0 #define DEFAULT_BT_ENABLED 0

View File

@@ -18,40 +18,10 @@
#include <bsp.h> #include <bsp.h>
#include <bsp/grpci2dma.h> #include <bsp/grpci2dma.h>
#include <grlib_impl.h>
/* This driver has been prepared for SMP operation /* 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*/
#define STATIC static #define STATIC static

View File

@@ -28,40 +28,7 @@
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <bsp/grspw_pkt.h> #include <bsp/grspw_pkt.h>
/* Use interrupt lock privmitives compatible with SMP defined in #include <grlib_impl.h>
* RTEMS 4.11.99 and higher.
*/
#if (((__RTEMS_MAJOR__ << 16) | (__RTEMS_MINOR__ << 8) | __RTEMS_REVISION__) >= 0x040b63)
#include <rtems/score/isrlock.h> /* 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
/*#define STATIC*/ /*#define STATIC*/
#define STATIC static #define STATIC static

View File

@@ -13,12 +13,13 @@
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
#include <stdio.h> #include <stdio.h>
#include <bsp.h> #include <bsp.h>
#include <rtems/bspIo.h> /* printk */
#include <drvmgr/drvmgr.h> #include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <bsp/grspw_router.h> #include <bsp/grspw_router.h>
#include <grlib_impl.h>
//#define STATIC //#define STATIC
#define STATIC static #define STATIC static
@@ -34,56 +35,6 @@
#define THREAD_SAFE 1 #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_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (unsigned int)(val))
#define REG_READ(addr) (*(volatile unsigned int *)(addr)) #define REG_READ(addr) (*(volatile unsigned int *)(addr))

View File

@@ -21,38 +21,7 @@
#include <bsp.h> #include <bsp.h>
#include <bsp/spwtdp.h> #include <bsp/spwtdp.h>
/* Use interrupt lock privmitives compatible with SMP defined in #include <grlib_impl.h>
* 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*/
#define STATIC static #define STATIC static

View File

@@ -23,20 +23,7 @@
#include <ambapp.h> #include <ambapp.h>
#include <bsp/grtc.h> #include <bsp/grtc.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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)
/* /*
#define DEBUG #define DEBUG

View File

@@ -23,15 +23,7 @@
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <bsp/grtm.h> #include <bsp/grtm.h>
/* map via rtems_interrupt_lock_* API: */ #include <grlib_impl.h>
#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 DEBUG #define DEBUG