From 62d035c3109cca06496119a4faefb3f1b8daa087 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:42 +0100 Subject: [PATCH 01/15] [PATCH 01/12] add jumping VME interrupt routines to independent implementation Adds implementations which use the virtual os table to invoke the OS specific call. rename conflicting functions --- src/libCom/osi/devLib.c | 62 +++++++++++++++++++++++++++ src/libCom/osi/os/RTEMS/devLibOSD.c | 26 ++++++++--- src/libCom/osi/os/vxWorks/devLibOSD.c | 28 +++++++++--- 3 files changed, 103 insertions(+), 13 deletions(-) diff --git a/src/libCom/osi/devLib.c b/src/libCom/osi/devLib.c index 8e03f86d9..6e2f44bbd 100644 --- a/src/libCom/osi/devLib.c +++ b/src/libCom/osi/devLib.c @@ -907,6 +907,68 @@ long devNoResponseProbe (epicsAddressType addrType, return SUCCESS; } +long devConnectInterruptVME( +unsigned vectorNumber, +void (*pFunction)(void *), +void *parameter ) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVirtualOS->pDevConnectInterruptVME) (vectorNumber, + pFunction, parameter); +} + +long devDisconnectInterruptVME( +unsigned vectorNumber, +void (*pFunction)(void *) ) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVirtualOS->pDevDisconnectInterruptVME) (vectorNumber, pFunction); +} + +long devEnableInterruptLevelVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVirtualOS->pDevEnableInterruptLevelVME) (level); +} + +long devDisableInterruptLevelVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVirtualOS->pDevDisableInterruptLevelVME) (level); +} + /* * devConnectInterrupt () * diff --git a/src/libCom/osi/os/RTEMS/devLibOSD.c b/src/libCom/osi/os/RTEMS/devLibOSD.c index 633736d24..5f8ceb9ad 100644 --- a/src/libCom/osi/os/RTEMS/devLibOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibOSD.c @@ -87,6 +87,20 @@ long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue */ long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); +static long rtmsDevConnectInterruptVME ( + unsigned vectorNumber, + void (*pFunction)(), + void *parameter); + +static long rtmsDevDisconnectInterruptVME ( + unsigned vectorNumber, + void (*pFunction)() +); + +static long rtmsDevEnableInterruptLevelVME (unsigned level); + +static long rtmsDevDisableInterruptLevelVME (unsigned level); + /* RTEMS specific init */ /*devA24Malloc and devA24Free are not implemented*/ @@ -99,8 +113,8 @@ static long rtmsDevInit(void); */ static devLibVirtualOS rtemsVirtualOS = { rtmsDevMapAddr, rtmsDevReadProbe, rtmsDevWriteProbe, - devConnectInterruptVME, devDisconnectInterruptVME, - devEnableInterruptLevelVME, devDisableInterruptLevelVME, + rtmsDevConnectInterruptVME, rtmsDevDisconnectInterruptVME, + rtmsDevEnableInterruptLevelVME, rtmsDevDisableInterruptLevelVME, devA24Malloc,devA24Free,rtmsDevInit }; devLibVirtualOS *pdevLibVirtualOS = &rtemsVirtualOS; @@ -119,7 +133,7 @@ rtmsDevInit(void) * * wrapper to minimize driver dependency on OS */ -long devConnectInterruptVME ( +static long rtmsDevConnectInterruptVME ( unsigned vectorNumber, void (*pFunction)(), void *parameter) @@ -152,7 +166,7 @@ long devConnectInterruptVME ( * an interrupt handler that was installed by another driver * */ -long devDisconnectInterruptVME ( +static long rtmsDevDisconnectInterruptVME ( unsigned vectorNumber, void (*pFunction)() ) @@ -188,7 +202,7 @@ long devDisconnectInterruptVME ( /* * enable VME interrupt level */ -long devEnableInterruptLevelVME (unsigned level) +static long rtmsDevEnableInterruptLevelVME (unsigned level) { return BSP_enableVME_int_lvl(level); } @@ -196,7 +210,7 @@ long devEnableInterruptLevelVME (unsigned level) /* * disable VME interrupt level */ -long devDisableInterruptLevelVME (unsigned level) +static long rtmsDevDisableInterruptLevelVME (unsigned level) { return BSP_disableVME_int_lvl(level); } diff --git a/src/libCom/osi/os/vxWorks/devLibOSD.c b/src/libCom/osi/os/vxWorks/devLibOSD.c index 871045fb6..28a32c660 100644 --- a/src/libCom/osi/os/vxWorks/devLibOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibOSD.c @@ -114,13 +114,27 @@ static void *devA24Malloc(size_t size); static void devA24Free(void *pBlock); static long devInit(void) { return 0;} +static long vxDevConnectInterruptVME ( + unsigned vectorNumber, + void (*pFunction)(), + void *parameter); + +static long vxDevDisconnectInterruptVME ( + unsigned vectorNumber, + void (*pFunction)() +); + +static long vxDevEnableInterruptLevelVME (unsigned level); + +static long vxDevDisableInterruptLevelVME (unsigned level); + /* * used by dynamic bind in devLib.c */ static devLibVirtualOS vxVirtualOS = { vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe, - devConnectInterruptVME, devDisconnectInterruptVME, - devEnableInterruptLevelVME, devDisableInterruptLevelVME, + vxDevConnectInterruptVME, vxDevDisconnectInterruptVME, + vxDevEnableInterruptLevelVME, vxDevDisableInterruptLevelVME, devA24Malloc,devA24Free,devInit }; devLibVirtualOS *pdevLibVirtualOS = &vxVirtualOS; @@ -130,7 +144,7 @@ devLibVirtualOS *pdevLibVirtualOS = &vxVirtualOS; * * wrapper to minimize driver dependency on vxWorks */ -long devConnectInterruptVME ( +static long vxDevConnectInterruptVME ( unsigned vectorNumber, void (*pFunction)(), void *parameter) @@ -154,7 +168,7 @@ long devConnectInterruptVME ( /* * - * devDisconnectInterruptVME() + * vxDevDisconnectInterruptVME() * * wrapper to minimize driver dependency on vxWorks * @@ -163,7 +177,7 @@ long devConnectInterruptVME ( * an interrupt handler that was installed by another driver * */ -long devDisconnectInterruptVME ( +static long vxDevDisconnectInterruptVME ( unsigned vectorNumber, void (*pFunction)() ) @@ -198,7 +212,7 @@ long devDisconnectInterruptVME ( /* * enable VME interrupt level */ -long devEnableInterruptLevelVME (unsigned level) +static long vxDevEnableInterruptLevelVME (unsigned level) { # if CPU_FAMILY != I80X86 int s; @@ -250,7 +264,7 @@ long devDisableInterruptLevelISA (unsigned level) /* * disable VME interrupt level */ -long devDisableInterruptLevelVME (unsigned level) +static long vxDevDisableInterruptLevelVME (unsigned level) { # if CPU_FAMILY != I80X86 int s; From acb905fcfcd8c63e0d04061b25087f371327d662 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:43 +0100 Subject: [PATCH 02/15] [PATCH 02/12] add devInterruptInUseVME to function table Add test for interrupt handler function to the virtual os table. Adds a stub implementation to devLib.c Renames OS implementations functions for RTEMS and vxWorks to avoid symbol name conflicts --- src/libCom/osi/devLib.c | 14 ++++++++++++++ src/libCom/osi/devLib.h | 5 +++++ src/libCom/osi/os/RTEMS/devLibOSD.c | 6 ++++-- src/libCom/osi/os/vxWorks/devLibOSD.c | 6 ++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/devLib.c b/src/libCom/osi/devLib.c index 6e2f44bbd..6a8aa68e6 100644 --- a/src/libCom/osi/devLib.c +++ b/src/libCom/osi/devLib.c @@ -941,6 +941,20 @@ void (*pFunction)(void *) ) return (*pdevLibVirtualOS->pDevDisconnectInterruptVME) (vectorNumber, pFunction); } +int devInterruptInUseVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVirtualOS->pDevInterruptInUseVME) (level); +} + long devEnableInterruptLevelVME (unsigned level) { long status; diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h index f9dd85751..2cd2471e8 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -330,6 +330,11 @@ typedef struct devLibVirtualOS { void *(*pDevA24Malloc)(size_t nbytes); void (*pDevA24Free)(void *pBlock); long (*pDevInit)(void); + + /* + * test if VME interrupt has an ISR connected + */ + int (*pDevInterruptInUseVME) (unsigned vectorNumber); }devLibVirtualOS; epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; diff --git a/src/libCom/osi/os/RTEMS/devLibOSD.c b/src/libCom/osi/os/RTEMS/devLibOSD.c index 5f8ceb9ad..50f1ffe36 100644 --- a/src/libCom/osi/os/RTEMS/devLibOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibOSD.c @@ -101,6 +101,8 @@ static long rtmsDevEnableInterruptLevelVME (unsigned level); static long rtmsDevDisableInterruptLevelVME (unsigned level); +static int rtemsDevInterruptInUseVME (unsigned vectorNumber); + /* RTEMS specific init */ /*devA24Malloc and devA24Free are not implemented*/ @@ -115,7 +117,7 @@ static devLibVirtualOS rtemsVirtualOS = { rtmsDevMapAddr, rtmsDevReadProbe, rtmsDevWriteProbe, rtmsDevConnectInterruptVME, rtmsDevDisconnectInterruptVME, rtmsDevEnableInterruptLevelVME, rtmsDevDisableInterruptLevelVME, - devA24Malloc,devA24Free,rtmsDevInit + devA24Malloc,devA24Free,rtmsDevInit,rtemsDevInterruptInUseVME }; devLibVirtualOS *pdevLibVirtualOS = &rtemsVirtualOS; @@ -296,7 +298,7 @@ static myISR *isrFetch(unsigned vectorNumber, void **parg) /* * determine if a VME interrupt vector is in use */ -int devInterruptInUseVME (unsigned vectorNumber) +static int rtemsDevInterruptInUseVME (unsigned vectorNumber) { int i; myISR *psub; diff --git a/src/libCom/osi/os/vxWorks/devLibOSD.c b/src/libCom/osi/os/vxWorks/devLibOSD.c index 28a32c660..ca95b3b60 100644 --- a/src/libCom/osi/os/vxWorks/devLibOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibOSD.c @@ -128,6 +128,8 @@ static long vxDevEnableInterruptLevelVME (unsigned level); static long vxDevDisableInterruptLevelVME (unsigned level); +static int vxDevInterruptInUseVME (unsigned vectorNumber); + /* * used by dynamic bind in devLib.c */ @@ -135,7 +137,7 @@ static devLibVirtualOS vxVirtualOS = { vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe, vxDevConnectInterruptVME, vxDevDisconnectInterruptVME, vxDevEnableInterruptLevelVME, vxDevDisableInterruptLevelVME, - devA24Malloc,devA24Free,devInit + devA24Malloc,devA24Free,devInit,vxDevInterruptInUseVME }; devLibVirtualOS *pdevLibVirtualOS = &vxVirtualOS; @@ -373,7 +375,7 @@ static myISR *isrFetch(unsigned vectorNumber) /* * determine if a VME interrupt vector is in use */ -int devInterruptInUseVME (unsigned vectorNumber) +static int vxDevInterruptInUseVME (unsigned vectorNumber) { #if CPU_FAMILY == PPC return FALSE; From ad8cd28f7d3a18b4f4428e6180d1addc1d080c48 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:43 +0100 Subject: [PATCH 03/15] [PATCH 03/12] mark all implimentation functions as static --- src/libCom/osi/os/RTEMS/devLibOSD.c | 12 ++++++------ src/libCom/osi/os/vxWorks/devLibOSD.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/devLibOSD.c b/src/libCom/osi/os/RTEMS/devLibOSD.c index 50f1ffe36..d3c4b9287 100644 --- a/src/libCom/osi/os/RTEMS/devLibOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibOSD.c @@ -36,7 +36,7 @@ static myISR *isrFetch(unsigned vectorNumber, void **parg); * this routine needs to be in the symbol table * for this code to work correctly */ -void unsolicitedHandlerEPICS(int vectorNumber); +static void unsolicitedHandlerEPICS(int vectorNumber); static myISR *defaultHandlerAddr[]={ (myISR*)unsolicitedHandlerEPICS, @@ -79,13 +79,13 @@ static long rtmsDevMapAddr (epicsAddressType addrType, unsigned options, * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ -long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); +static long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); /* * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ -long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); +static long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); static long rtmsDevConnectInterruptVME ( unsigned vectorNumber, @@ -250,7 +250,7 @@ static long rtmsDevMapAddr (epicsAddressType addrType, unsigned options, * unsuccessful status if the device isnt present */ rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval); -long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) +static long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) { long status; @@ -269,7 +269,7 @@ long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ -long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) +static long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) { long status; @@ -335,7 +335,7 @@ static int rtemsDevInterruptInUseVME (unsigned vectorNumber) * macro to declare handler prototypes... * */ -void unsolicitedHandlerEPICS(int vectorNumber) +static void unsolicitedHandlerEPICS(int vectorNumber) { /* * call epicInterruptContextMessage() diff --git a/src/libCom/osi/os/vxWorks/devLibOSD.c b/src/libCom/osi/os/vxWorks/devLibOSD.c index ca95b3b60..ebce458ea 100644 --- a/src/libCom/osi/os/vxWorks/devLibOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibOSD.c @@ -52,7 +52,7 @@ static myISR *isrFetch(unsigned vectorNumber); * this routine needs to be in the symbol table * for this code to work correctly */ -void unsolicitedHandlerEPICS(int vectorNumber); +static void unsolicitedHandlerEPICS(int vectorNumber); /* * this is in veclist.c @@ -413,7 +413,7 @@ static int vxDevInterruptInUseVME (unsigned vectorNumber) * disconnected vector * */ -void unsolicitedHandlerEPICS(int vectorNumber) +static void unsolicitedHandlerEPICS(int vectorNumber) { /* * call logMsg() and not errMessage() From 83adda7e6c66abaa175e3db54dc7f46d6392facf Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:44 +0100 Subject: [PATCH 04/15] [PATCH 04/12] move "virtual os" definition to a seperate file The virtual os table is not something ordinary devLib users should know or care about. --- src/libCom/Makefile | 1 + src/libCom/osi/devLib.c | 3 ++ src/libCom/osi/devLib.h | 73 ++++++------------------- src/libCom/osi/devLibVMEImpl.h | 97 ++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 58 deletions(-) create mode 100644 src/libCom/osi/devLibVMEImpl.h diff --git a/src/libCom/Makefile b/src/libCom/Makefile index 3d251f35c..01e517080 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -192,6 +192,7 @@ INC += epicsStdioRedirect.h INC += epicsGetopt.h INC += devLib.h +INC += devLibImpl.h INC += osdVME.h SRCS += epicsThread.cpp diff --git a/src/libCom/osi/devLib.c b/src/libCom/osi/devLib.c index 6a8aa68e6..f56c63968 100644 --- a/src/libCom/osi/devLib.c +++ b/src/libCom/osi/devLib.c @@ -29,7 +29,10 @@ static const char sccsID[] = "@(#) $Id$"; #include "epicsMutex.h" #include "errlog.h" #include "ellLib.h" + +#define NO_DEVLIB_COMPAT #include "devLib.h" +#include "devLibImpl.h" static ELLLIST addrAlloc[atLast]; static ELLLIST addrFree[atLast]; diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h index 2cd2471e8..d0f444fc3 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -46,6 +46,21 @@ typedef enum { */ extern const char *epicsAddressTypeName[]; +#ifdef __cplusplus +} +#endif + +/* + * To retain compatibility include everything by default + */ +#ifndef NO_DEVLIB_COMPAT +# include "devLibImpl.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + epicsShareFunc long devAddressMap(void); /* print an address map */ /* @@ -280,64 +295,6 @@ epicsShareFunc void devLibA24Free(void *pBlock); */ #define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR))) -/* - * virtual OS layer for devLib.c - */ -typedef struct devLibVirtualOS { - /* - * maps logical address to physical address, but does not detect - * two device drivers that are using the same address range - */ - long (*pDevMapAddr) (epicsAddressType addrType, unsigned options, - size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); - - /* - * a bus error safe "wordSize" read at the specified address which returns - * unsuccessful status if the device isnt present - */ - long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead); - - /* - * a bus error safe "wordSize" write at the specified address which returns - * unsuccessful status if the device isnt present - */ - long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten); - - /* - * connect ISR to a VME interrupt vector - * (required for backwards compatibility) - */ - long (*pDevConnectInterruptVME) (unsigned vectorNumber, - void (*pFunction)(void *), void *parameter); - - /* - * disconnect ISR from a VME interrupt vector - * (required for backwards compatibility) - */ - long (*pDevDisconnectInterruptVME) (unsigned vectorNumber, - void (*pFunction)(void *)); - - /* - * enable VME interrupt level - */ - long (*pDevEnableInterruptLevelVME) (unsigned level); - - /* - * disable VME interrupt level - */ - long (*pDevDisableInterruptLevelVME) (unsigned level); - /* malloc/free A24 address space */ - void *(*pDevA24Malloc)(size_t nbytes); - void (*pDevA24Free)(void *pBlock); - long (*pDevInit)(void); - - /* - * test if VME interrupt has an ISR connected - */ - int (*pDevInterruptInUseVME) (unsigned vectorNumber); -}devLibVirtualOS; -epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; - /* * error codes (and messages) associated with devLib.c */ diff --git a/src/libCom/osi/devLibVMEImpl.h b/src/libCom/osi/devLibVMEImpl.h new file mode 100644 index 000000000..775bc3b42 --- /dev/null +++ b/src/libCom/osi/devLibVMEImpl.h @@ -0,0 +1,97 @@ +/*************************************************************************\ +* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* devLibImpl.h */ +/* */ + +/* + * Original Author: Marty Kraimer + * Author: Jeff Hill + * Date: 03-10-93 + */ + +#ifndef INCdevLibImplh +#define INCdevLibImplh 1 + +#include "dbDefs.h" +#include "shareLib.h" +#include "devLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * virtual OS layer for devLib.c + * + * The global virtual OS table pdevLibVirtualOS controls + * the behaviour of the functions defined in devLib.h. + * All of which call into the functions found in this table + * to perform system specific tasks. + */ +typedef struct devLibVirtualOS { + /* + * maps logical address to physical address, but does not detect + * two device drivers that are using the same address range + */ + long (*pDevMapAddr) (epicsAddressType addrType, unsigned options, + size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); + + /* + * a bus error safe "wordSize" read at the specified address which returns + * unsuccessful status if the device isnt present + */ + long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead); + + /* + * a bus error safe "wordSize" write at the specified address which returns + * unsuccessful status if the device isnt present + */ + long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten); + + /* + * connect ISR to a VME interrupt vector + * (required for backwards compatibility) + */ + long (*pDevConnectInterruptVME) (unsigned vectorNumber, + void (*pFunction)(void *), void *parameter); + + /* + * disconnect ISR from a VME interrupt vector + * (required for backwards compatibility) + */ + long (*pDevDisconnectInterruptVME) (unsigned vectorNumber, + void (*pFunction)(void *)); + + /* + * enable VME interrupt level + */ + long (*pDevEnableInterruptLevelVME) (unsigned level); + + /* + * disable VME interrupt level + */ + long (*pDevDisableInterruptLevelVME) (unsigned level); + /* malloc/free A24 address space */ + void *(*pDevA24Malloc)(size_t nbytes); + void (*pDevA24Free)(void *pBlock); + long (*pDevInit)(void); + + /* + * test if VME interrupt has an ISR connected + */ + int (*pDevInterruptInUseVME) (unsigned vectorNumber); +}devLibVirtualOS; + +epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; + +#ifdef __cplusplus +} +#endif + +#endif /* INCdevLibImplh */ From e21cde013dfcc1caea7c797f3b076d417056a09b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:45 +0100 Subject: [PATCH 05/15] [PATCH 05/12] reorganize devLib.h Group functions by bus type with general functions at the top add macro to exclude deprecated api --- src/libCom/osi/devLib.h | 166 +++++++++++++++++++++++++--------------- 1 file changed, 103 insertions(+), 63 deletions(-) diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h index d0f444fc3..d37d20deb 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -61,6 +61,12 @@ extern const char *epicsAddressTypeName[]; extern "C" { #endif +/* + * General API + * + * This section applies to all bus types + */ + epicsShareFunc long devAddressMap(void); /* print an address map */ /* @@ -128,6 +134,12 @@ epicsShareFunc long devAllocAddress( unsigned alignment, /*n ls bits zero in addr*/ volatile void **pLocalAddress); +/* + * VME API + * + * Functions in this section apply only to the VME bus type + */ + /* * connect ISR to a VME interrupt vector */ @@ -136,28 +148,6 @@ epicsShareFunc long devConnectInterruptVME( void (*pFunction)(void *), void *parameter); -/* - * connect ISR to an ISA interrupt level - * (not implemented) - * (API should be reviewed) - */ -epicsShareFunc long devConnectInterruptISA( - unsigned interruptLevel, - void (*pFunction)(void *), - void *parameter); - -/* - * connect ISR to a PCI interrupt - * (not implemented) - * (API should be reviewed) - */ -epicsShareFunc long devConnectInterruptPCI( - unsigned bus, - unsigned device, - unsigned function, - void (*pFunction)(void *), - void *parameter); - /* * disconnect ISR from a VME interrupt vector * @@ -169,6 +159,47 @@ epicsShareFunc long devDisconnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *)); +/* + * determine if a VME interrupt vector is in use + * + * returns boolean + */ +epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); + +/* + * enable VME interrupt level + */ +epicsShareFunc long devEnableInterruptLevelVME (unsigned level); + +/* + * disable VME interrupt level + */ +epicsShareFunc long devDisableInterruptLevelVME (unsigned level); + +/* + * Routines to allocate and free memory in the A24 memory region. + * + */ +epicsShareFunc void *devLibA24Malloc(size_t); +epicsShareFunc void *devLibA24Calloc(size_t); +epicsShareFunc void devLibA24Free(void *pBlock); + +/* + * ISA API + * + * Functions in this section apply only to the ISA bus type + */ + +/* + * connect ISR to an ISA interrupt level + * (not implemented) + * (API should be reviewed) + */ +epicsShareFunc long devConnectInterruptISA( + unsigned interruptLevel, + void (*pFunction)(void *), + void *parameter); + /* * disconnect ISR from an ISA interrupt level * (not implemented) @@ -182,6 +213,43 @@ epicsShareFunc long devDisconnectInterruptISA( unsigned interruptLevel, void (*pFunction)(void *)); +/* + * determine if an ISA interrupt level is in use + * (not implemented) + * + * returns boolean + */ +epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); + +/* + * enable ISA interrupt level + */ +epicsShareFunc long devEnableInterruptLevelISA (unsigned level); + +/* + * disable ISA interrupt level + */ +epicsShareFunc long devDisableInterruptLevelISA (unsigned level); + + +/* + * PCI API + * + * Functions in this section apply only to the ISA bus type + */ + +/* + * connect ISR to a PCI interrupt + * (not implemented) + * (API should be reviewed) + */ +epicsShareFunc long devConnectInterruptPCI( + unsigned bus, + unsigned device, + unsigned function, + void (*pFunction)(void *), + void *parameter); + /* * disconnect ISR from a PCI interrupt * (not implemented) @@ -197,21 +265,6 @@ epicsShareFunc long devDisconnectInterruptPCI( unsigned function, void (*pFunction)(void *)); -/* - * determine if a VME interrupt vector is in use - * - * returns boolean - */ -epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); - -/* - * determine if an ISA interrupt level is in use - * (not implemented) - * - * returns boolean - */ -epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); - /* * determine if a PCI interrupt is in use * (not implemented) @@ -221,17 +274,6 @@ epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); epicsShareFunc int devInterruptInUsePCI (unsigned bus, unsigned device, unsigned function); -typedef enum {intVME, intVXI, intISA} epicsInterruptType; - -/* - * enable VME interrupt level - */ -epicsShareFunc long devEnableInterruptLevelVME (unsigned level); - -/* - * enable ISA interrupt level - */ -epicsShareFunc long devEnableInterruptLevelISA (unsigned level); /* * not implemented - API needs to be reviewed @@ -239,29 +281,16 @@ epicsShareFunc long devEnableInterruptLevelISA (unsigned level); epicsShareFunc long devEnableInterruptLevelPCI (unsigned level, unsigned bus, unsigned device, unsigned function); -/* - * disable VME interrupt level - */ -epicsShareFunc long devDisableInterruptLevelVME (unsigned level); - -/* - * disable ISA interrupt level - */ -epicsShareFunc long devDisableInterruptLevelISA (unsigned level); - /* * not implemented - API needs to be reviewed */ epicsShareFunc long devDisableInterruptLevelPCI (unsigned level, unsigned bus, unsigned device, unsigned function); + /* - * Routines to allocate and free memory in the A24 memory region. - * + * Support macros */ -epicsShareFunc void *devLibA24Malloc(size_t); -epicsShareFunc void *devLibA24Calloc(size_t); -epicsShareFunc void devLibA24Free(void *pBlock); /* * Normalize a digital value and convert it to type TYPE @@ -336,6 +365,15 @@ epicsShareFunc void devLibA24Free(void *pBlock); #define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ #define S_dev_vxWorksIntEnFail S_dev_intEnFail + +/* + * Deprecated interface + */ + +#ifndef NO_DEVLIB_OLD_INTERFACE + +typedef enum {intVME, intVXI, intISA} epicsInterruptType; + /* * NOTE: this routine has been deprecated. It exists * for backwards compatibility purposes only. @@ -394,6 +432,8 @@ epicsShareFunc long devDisableInterruptLevel ( */ epicsShareFunc long locationProbe (epicsAddressType addrType, char *pLocation); +#endif /* NO_DEVLIB_OLD_INTERFACE */ + /* * Some vxWorks convenience routines */ From 46ec38756bb42c2cfe3bd2b6e4170d37063f2a3f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:46 +0100 Subject: [PATCH 06/15] [PATCH 06/12] use epics extern macro --- src/libCom/osi/devLib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h index d37d20deb..47a71eac3 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -44,7 +44,7 @@ typedef enum { * pointer to an array of strings for each of * the above address types */ -extern const char *epicsAddressTypeName[]; +epicsShareExtern const char *epicsAddressTypeName[]; #ifdef __cplusplus } From 4a3b4358c3f2d01d0414b8487075fa6a30c6f30b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:49 +0100 Subject: [PATCH 07/15] [PATCH 07/12] rename devLib to devLibVME --- src/libCom/Makefile | 7 ++++--- src/libCom/osi/{devLib.c => devLibVME.c} | 4 ++-- src/libCom/osi/{devLib.h => devLibVME.h} | 2 +- src/libCom/osi/os/RTEMS/{devLibOSD.c => devLibVMEOSD.c} | 2 +- src/libCom/osi/os/cygwin32/{devLibOSD.c => devLibVMEOSD.c} | 2 +- src/libCom/osi/os/default/{devLibOSD.c => devLibVMEOSD.c} | 2 +- src/libCom/osi/os/vxWorks/{devLibOSD.c => devLibVMEOSD.c} | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) rename src/libCom/osi/{devLib.c => devLibVME.c} (99%) rename src/libCom/osi/{devLib.h => devLibVME.h} (99%) rename src/libCom/osi/os/RTEMS/{devLibOSD.c => devLibVMEOSD.c} (99%) rename src/libCom/osi/os/cygwin32/{devLibOSD.c => devLibVMEOSD.c} (90%) rename src/libCom/osi/os/default/{devLibOSD.c => devLibVMEOSD.c} (90%) rename src/libCom/osi/os/vxWorks/{devLibOSD.c => devLibVMEOSD.c} (99%) diff --git a/src/libCom/Makefile b/src/libCom/Makefile index 01e517080..7f0168fb0 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -192,7 +192,8 @@ INC += epicsStdioRedirect.h INC += epicsGetopt.h INC += devLib.h -INC += devLibImpl.h +INC += devLibVME.h +INC += devLibVMEImpl.h INC += osdVME.h SRCS += epicsThread.cpp @@ -231,8 +232,8 @@ SRCS += osdProcess.c SRCS += osdNetIntf.c SRCS += osdMessageQueue.c -SRCS += devLib.c -SRCS += devLibOSD.c +SRCS += devLibVME.c +SRCS += devLibVMEOSD.c SRC_DIRS += $(LIBCOM)/taskwd INC += taskwd.h diff --git a/src/libCom/osi/devLib.c b/src/libCom/osi/devLibVME.c similarity index 99% rename from src/libCom/osi/devLib.c rename to src/libCom/osi/devLibVME.c index f56c63968..5a4965380 100644 --- a/src/libCom/osi/devLib.c +++ b/src/libCom/osi/devLibVME.c @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLib.c - support for allocation of common device resources */ -/* $Id$ */ +/* devLib.c,v 1.1.2.11 2009/07/09 16:37:23 anj Exp */ /* * Original Author: Marty Kraimer @@ -18,7 +18,7 @@ * .01 06-14-93 joh needs devAllocInterruptVector() routine */ -static const char sccsID[] = "@(#) $Id$"; +static const char sccsID[] = "@(#) devLib.c,v 1.1.2.11 2009/07/09 16:37:23 anj Exp"; #include #include diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLibVME.h similarity index 99% rename from src/libCom/osi/devLib.h rename to src/libCom/osi/devLibVME.h index 47a71eac3..85347f81f 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLibVME.h @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLib.h */ -/* $Id$ */ +/* devLib.h,v 1.1.2.8 2009/07/09 15:27:43 anj Exp */ /* * Original Author: Marty Kraimer diff --git a/src/libCom/osi/os/RTEMS/devLibOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c similarity index 99% rename from src/libCom/osi/os/RTEMS/devLibOSD.c rename to src/libCom/osi/os/RTEMS/devLibVMEOSD.c index d3c4b9287..2abb3de38 100644 --- a/src/libCom/osi/os/RTEMS/devLibOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* $Id$ */ +/* devLibOSD.c,v 1.1.2.8 2009/07/09 16:37:23 anj Exp */ /* RTEMS port by Till Straumann, * 3/2002 diff --git a/src/libCom/osi/os/cygwin32/devLibOSD.c b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c similarity index 90% rename from src/libCom/osi/os/cygwin32/devLibOSD.c rename to src/libCom/osi/os/cygwin32/devLibVMEOSD.c index ac2dda63e..90844de61 100644 --- a/src/libCom/osi/os/cygwin32/devLibOSD.c +++ b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c @@ -5,7 +5,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* $Id$ */ +/* devLibOSD.c,v 1.1.2.1 2009/06/15 16:10:05 anj Exp */ #include diff --git a/src/libCom/osi/os/default/devLibOSD.c b/src/libCom/osi/os/default/devLibVMEOSD.c similarity index 90% rename from src/libCom/osi/os/default/devLibOSD.c rename to src/libCom/osi/os/default/devLibVMEOSD.c index bcb24e179..064f1e7d6 100644 --- a/src/libCom/osi/os/default/devLibOSD.c +++ b/src/libCom/osi/os/default/devLibVMEOSD.c @@ -6,7 +6,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* $Id$ */ +/* devLibOSD.c,v 1.1.2.1 2006/02/17 22:51:24 anj Exp */ #include diff --git a/src/libCom/osi/os/vxWorks/devLibOSD.c b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c similarity index 99% rename from src/libCom/osi/os/vxWorks/devLibOSD.c rename to src/libCom/osi/os/vxWorks/devLibVMEOSD.c index ebce458ea..6bf6fbd66 100644 --- a/src/libCom/osi/os/vxWorks/devLibOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * $Id$ + * devLibOSD.c,v 1.1.2.9 2009/07/09 16:37:23 anj Exp * * Archictecture dependent support for common device driver resources * From 000c98dbaad769971f8874ff977e6462a7bb3bf7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:50 +0100 Subject: [PATCH 08/15] [PATCH 08/12] fix includes --- src/libCom/osi/devLibVME.c | 4 ++-- src/libCom/osi/devLibVME.h | 3 ++- src/libCom/osi/os/RTEMS/devLibVMEOSD.c | 2 +- src/libCom/osi/os/cygwin32/devLibVMEOSD.c | 2 +- src/libCom/osi/os/default/devLibVMEOSD.c | 2 +- src/libCom/osi/os/vxWorks/devLibVMEOSD.c | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libCom/osi/devLibVME.c b/src/libCom/osi/devLibVME.c index 5a4965380..53f55dd99 100644 --- a/src/libCom/osi/devLibVME.c +++ b/src/libCom/osi/devLibVME.c @@ -31,8 +31,8 @@ static const char sccsID[] = "@(#) devLib.c,v 1.1.2.11 2009/07/09 16:37:23 anj E #include "ellLib.h" #define NO_DEVLIB_COMPAT -#include "devLib.h" -#include "devLibImpl.h" +#include "devLibVME.h" +#include "devLibVMEImpl.h" static ELLLIST addrAlloc[atLast]; static ELLLIST addrFree[atLast]; diff --git a/src/libCom/osi/devLibVME.h b/src/libCom/osi/devLibVME.h index 85347f81f..847949d07 100644 --- a/src/libCom/osi/devLibVME.h +++ b/src/libCom/osi/devLibVME.h @@ -22,6 +22,7 @@ #include "osdVME.h" #include "errMdef.h" #include "shareLib.h" +#include "devLib.h" #ifdef __cplusplus extern "C" { @@ -54,7 +55,7 @@ epicsShareExtern const char *epicsAddressTypeName[]; * To retain compatibility include everything by default */ #ifndef NO_DEVLIB_COMPAT -# include "devLibImpl.h" +# include "devLibVMEImpl.h" #endif #ifdef __cplusplus diff --git a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c index 2abb3de38..20b81bc3a 100644 --- a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -17,7 +17,7 @@ #include #include #include -#include "devLib.h" +#include "devLibVME.h" #include #if defined(__PPC__) || defined(__mcf528x__) diff --git a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c index 90844de61..9192eac8b 100644 --- a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c +++ b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c @@ -10,6 +10,6 @@ #include #define epicsExportSharedSymbols -#include "devLib.h" +#include "devLibVME.h" epicsShareDef devLibVirtualOS *pdevLibVirtualOS = NULL; diff --git a/src/libCom/osi/os/default/devLibVMEOSD.c b/src/libCom/osi/os/default/devLibVMEOSD.c index 064f1e7d6..e373325a8 100644 --- a/src/libCom/osi/os/default/devLibVMEOSD.c +++ b/src/libCom/osi/os/default/devLibVMEOSD.c @@ -10,7 +10,7 @@ #include -#include "devLib.h" +#include "devLibVME.h" /* This file must contain no definitions other than the following: */ diff --git a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c index 6bf6fbd66..7ce0ce663 100644 --- a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c @@ -28,7 +28,7 @@ #include #include "epicsFindSymbol.h" -#include "devLib.h" +#include "devLibVME.h" #include "errlog.h" typedef void myISR (void *pParam); From 50bcef9c634bf7fe6cd68875afc8ad0a08871372 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:50 +0100 Subject: [PATCH 09/15] [PATCH 09/12] rename vme pointer table --- src/libCom/osi/devLibVME.c | 40 +++++++++++------------ src/libCom/osi/devLibVMEImpl.h | 8 ++--- src/libCom/osi/os/RTEMS/devLibVMEOSD.c | 4 +-- src/libCom/osi/os/cygwin32/devLibVMEOSD.c | 2 +- src/libCom/osi/os/default/devLibVMEOSD.c | 2 +- src/libCom/osi/os/vxWorks/devLibVMEOSD.c | 4 +-- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libCom/osi/devLibVME.c b/src/libCom/osi/devLibVME.c index 53f55dd99..7d5c9981a 100644 --- a/src/libCom/osi/devLibVME.c +++ b/src/libCom/osi/devLibVME.c @@ -170,7 +170,7 @@ long devBusToLocalAddr( /* * Call the virtual os routine to map the bus address to a CPU address */ - status = (*pdevLibVirtualOS->pDevMapAddr) (addrType, 0, busAddr, 4, &localAddress); + status = (*pdevLibVME->pDevMapAddr) (addrType, 0, busAddr, 4, &localAddress); if (status) { errPrintf (status, __FILE__, __LINE__, "%s bus address =0X%X\n", epicsAddressTypeName[addrType], (unsigned int)busAddr); @@ -278,7 +278,7 @@ long devReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) } } - return (*pdevLibVirtualOS->pDevReadProbe) (wordSize, ptr, pValue); + return (*pdevLibVME->pDevReadProbe) (wordSize, ptr, pValue); } /* @@ -298,7 +298,7 @@ long devWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) } } - return (*pdevLibVirtualOS->pDevWriteProbe) (wordSize, ptr, pValue); + return (*pdevLibVME->pDevWriteProbe) (wordSize, ptr, pValue); } /* @@ -335,7 +335,7 @@ static long devInstallAddr ( * always map through the virtual os in case the memory * management is set up there */ - status = (*pdevLibVirtualOS->pDevMapAddr) (addrType, 0, base, + status = (*pdevLibVME->pDevMapAddr) (addrType, 0, base, size, &pPhysicalAddress); if (status) { errPrintf (status, __FILE__, __LINE__, "%s base=0X%X size = 0X%X", @@ -700,8 +700,8 @@ static long devLibInit (void) if(devLibInitFlag) return(SUCCESS); - if(!pdevLibVirtualOS) { - epicsPrintf ("pdevLibVirtualOS is NULL\n"); + if(!pdevLibVME) { + epicsPrintf ("pdevLibVME is NULL\n"); return S_dev_internal; } @@ -730,7 +730,7 @@ static long devLibInit (void) } epicsMutexUnlock(addrListLock); devLibInitFlag = TRUE; - return pdevLibVirtualOS->pDevInit(); + return pdevLibVME->pDevInit(); } /* @@ -892,7 +892,7 @@ long devNoResponseProbe (epicsAddressType addrType, * every byte in the block must * map to a physical address */ - s = (*pdevLibVirtualOS->pDevMapAddr) (addrType, 0, probe, wordSize, &pPhysical); + s = (*pdevLibVME->pDevMapAddr) (addrType, 0, probe, wordSize, &pPhysical); if (s!=SUCCESS) { return s; } @@ -900,7 +900,7 @@ long devNoResponseProbe (epicsAddressType addrType, /* * verify that no device is present */ - s = (*pdevLibVirtualOS->pDevReadProbe)(wordSize, pPhysical, &allWordSizes); + s = (*pdevLibVME->pDevReadProbe)(wordSize, pPhysical, &allWordSizes); if (s==SUCCESS) { return S_dev_addressOverlap; } @@ -924,7 +924,7 @@ void *parameter ) } } - return (*pdevLibVirtualOS->pDevConnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, pFunction, parameter); } @@ -941,7 +941,7 @@ void (*pFunction)(void *) ) } } - return (*pdevLibVirtualOS->pDevDisconnectInterruptVME) (vectorNumber, pFunction); + return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, pFunction); } int devInterruptInUseVME (unsigned level) @@ -955,7 +955,7 @@ int devInterruptInUseVME (unsigned level) } } - return (*pdevLibVirtualOS->pDevInterruptInUseVME) (level); + return (*pdevLibVME->pDevInterruptInUseVME) (level); } long devEnableInterruptLevelVME (unsigned level) @@ -969,7 +969,7 @@ long devEnableInterruptLevelVME (unsigned level) } } - return (*pdevLibVirtualOS->pDevEnableInterruptLevelVME) (level); + return (*pdevLibVME->pDevEnableInterruptLevelVME) (level); } long devDisableInterruptLevelVME (unsigned level) @@ -983,7 +983,7 @@ long devDisableInterruptLevelVME (unsigned level) } } - return (*pdevLibVirtualOS->pDevDisableInterruptLevelVME) (level); + return (*pdevLibVME->pDevDisableInterruptLevelVME) (level); } /* @@ -1009,7 +1009,7 @@ void *parameter) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevConnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, pFunction, parameter); default: return S_dev_uknIntType; @@ -1040,7 +1040,7 @@ void (*pFunction)(void *) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevDisconnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, pFunction); default: return S_dev_uknIntType; @@ -1068,7 +1068,7 @@ unsigned level) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevEnableInterruptLevelVME) (level); + return (*pdevLibVME->pDevEnableInterruptLevelVME) (level); default: return S_dev_uknIntType; } @@ -1095,7 +1095,7 @@ unsigned level) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevDisableInterruptLevelVME) (level); + return (*pdevLibVME->pDevDisableInterruptLevelVME) (level); default: return S_dev_uknIntType; } @@ -1144,7 +1144,7 @@ void *devLibA24Malloc(size_t size) if (devLibA24Debug) epicsPrintf ("devLibA24Malloc(%u) entered\n", (unsigned int)size); - ret = pdevLibVirtualOS->pDevA24Malloc(size); + ret = pdevLibVME->pDevA24Malloc(size); return(ret); } @@ -1153,5 +1153,5 @@ void devLibA24Free(void *pBlock) if (devLibA24Debug) epicsPrintf("devLibA24Free(%p) entered\n", pBlock); - pdevLibVirtualOS->pDevA24Free(pBlock); + pdevLibVME->pDevA24Free(pBlock); } diff --git a/src/libCom/osi/devLibVMEImpl.h b/src/libCom/osi/devLibVMEImpl.h index 775bc3b42..b75aa1ba9 100644 --- a/src/libCom/osi/devLibVMEImpl.h +++ b/src/libCom/osi/devLibVMEImpl.h @@ -29,12 +29,12 @@ extern "C" { /* * virtual OS layer for devLib.c * - * The global virtual OS table pdevLibVirtualOS controls + * The global virtual OS table pdevLibVME controls * the behaviour of the functions defined in devLib.h. * All of which call into the functions found in this table * to perform system specific tasks. */ -typedef struct devLibVirtualOS { +typedef struct devLibVME { /* * maps logical address to physical address, but does not detect * two device drivers that are using the same address range @@ -86,9 +86,9 @@ typedef struct devLibVirtualOS { * test if VME interrupt has an ISR connected */ int (*pDevInterruptInUseVME) (unsigned vectorNumber); -}devLibVirtualOS; +}devLibVME; -epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; +epicsShareExtern devLibVME *pdevLibVME; #ifdef __cplusplus } diff --git a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c index 20b81bc3a..44ebb3adf 100644 --- a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -113,13 +113,13 @@ static long rtmsDevInit(void); /* * used by bind in devLib.c */ -static devLibVirtualOS rtemsVirtualOS = { +static devLibVME rtemsVirtualOS = { rtmsDevMapAddr, rtmsDevReadProbe, rtmsDevWriteProbe, rtmsDevConnectInterruptVME, rtmsDevDisconnectInterruptVME, rtmsDevEnableInterruptLevelVME, rtmsDevDisableInterruptLevelVME, devA24Malloc,devA24Free,rtmsDevInit,rtemsDevInterruptInUseVME }; -devLibVirtualOS *pdevLibVirtualOS = &rtemsVirtualOS; +devLibVME *pdevLibVME = &rtemsVirtualOS; /* RTEMS specific initialization */ static long diff --git a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c index 9192eac8b..3058292a5 100644 --- a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c +++ b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c @@ -12,4 +12,4 @@ #define epicsExportSharedSymbols #include "devLibVME.h" -epicsShareDef devLibVirtualOS *pdevLibVirtualOS = NULL; +epicsShareDef devLibVME *pdevLibVME = NULL; diff --git a/src/libCom/osi/os/default/devLibVMEOSD.c b/src/libCom/osi/os/default/devLibVMEOSD.c index e373325a8..0ae3e56cf 100644 --- a/src/libCom/osi/os/default/devLibVMEOSD.c +++ b/src/libCom/osi/os/default/devLibVMEOSD.c @@ -14,4 +14,4 @@ /* This file must contain no definitions other than the following: */ -devLibVirtualOS *pdevLibVirtualOS; +devLibVME *pdevLibVME; diff --git a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c index 7ce0ce663..525678419 100644 --- a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c @@ -133,13 +133,13 @@ static int vxDevInterruptInUseVME (unsigned vectorNumber); /* * used by dynamic bind in devLib.c */ -static devLibVirtualOS vxVirtualOS = { +static devLibVME vxVirtualOS = { vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe, vxDevConnectInterruptVME, vxDevDisconnectInterruptVME, vxDevEnableInterruptLevelVME, vxDevDisableInterruptLevelVME, devA24Malloc,devA24Free,devInit,vxDevInterruptInUseVME }; -devLibVirtualOS *pdevLibVirtualOS = &vxVirtualOS; +devLibVME *pdevLibVME = &vxVirtualOS; /* * devConnectInterruptVME From c1142675b68963d2e07ea941277d743a733e515e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:51 +0100 Subject: [PATCH 10/15] [PATCH 10/12] move general macros and error codes to devLib.h includes devLibVME.h for compatibility --- src/libCom/osi/devLib.h | 90 ++++++++++++++++++++++++++++++++++++++ src/libCom/osi/devLibVME.h | 78 --------------------------------- 2 files changed, 90 insertions(+), 78 deletions(-) create mode 100644 src/libCom/osi/devLib.h diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h new file mode 100644 index 000000000..12e583e45 --- /dev/null +++ b/src/libCom/osi/devLib.h @@ -0,0 +1,90 @@ + +#ifndef EPICSDEVLIB_H +#define EPICSDEVLIB_H + +/* + * Support macros + */ + +/* + * Normalize a digital value and convert it to type TYPE + * + * Ex: + * float f; + * int d; + * f = devNormalizeDigital(d,12) + * + */ +#define devCreateMask(NBITS) ((1<<(NBITS))-1) +#define devDigToNml(DIGITAL,NBITS) \ + (((double)(DIGITAL))/devCreateMask(NBITS)) +#define devNmlToDig(NORMAL,NBITS) \ + (((long)(NORMAL)) * devCreateMask(NBITS)) + +/* + * + * Alignment mask + * (for use when testing to see if the proper number of least + * significant bits are zero) + * + */ +#define devCreateAlignmentMask(CTYPE)\ +(sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1) + +/* + * pointer aligned test + * (returns true if the pointer is on the worst case alignemnt + * boundary for its type) + */ +#define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR))) + +/* + * error codes (and messages) associated with devLib.c + */ +#define S_dev_success 0 +#define S_dev_vectorInUse (M_devLib| 1) /*interrupt vector in use*/ +#define S_dev_vecInstlFail (M_devLib| 2) /*interrupt vector install failed*/ +#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/ +#define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/ +#define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/ +#define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/ +#define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/ +#define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/ +#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/ +#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/ +#define S_dev_addrMapFail (M_devLib| 11) /*unable to map address*/ +#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/ +#define S_dev_internal (M_devLib| 13) /*Internal failure*/ +#define S_dev_intEnFail (M_devLib| 14) /*unable to enable interrupt level*/ +#define S_dev_intDissFail (M_devLib| 15) /*unable to disable interrupt level*/ +#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/ +#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/ +#define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/ +#define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/ +#define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/ +#define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/ +#define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/ +#define S_dev_highValue (M_devLib| 23) /*Parameter to high*/ +#define S_dev_lowValue (M_devLib| 24) /*Parameter to low*/ +#define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/ +#define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/ +#define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/ +#define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/ +#define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/ +#define S_dev_deviceTMO (M_devLib| 30) /*device timed out*/ +#define S_dev_badFunction (M_devLib| 31) /*bad function pointer*/ +#define S_dev_badVector (M_devLib| 32) /*bad interrupt vector*/ +#define S_dev_badArgument (M_devLib| 33) /*bad function argument*/ +#define S_dev_badISA (M_devLib| 34) /*Invalid ISA address*/ +#define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ +#define S_dev_vxWorksIntEnFail S_dev_intEnFail + + +#endif /* EPICSDEVLIB_H */ + +/* + * Retain compatibility by including VME by default + */ +#ifndef NO_DEVLIB_COMPAT +# include "devLibVME.h" +#endif diff --git a/src/libCom/osi/devLibVME.h b/src/libCom/osi/devLibVME.h index 847949d07..3644f5b7c 100644 --- a/src/libCom/osi/devLibVME.h +++ b/src/libCom/osi/devLibVME.h @@ -289,84 +289,6 @@ epicsShareFunc long devDisableInterruptLevelPCI (unsigned level, unsigned bus, unsigned device, unsigned function); -/* - * Support macros - */ - -/* - * Normalize a digital value and convert it to type TYPE - * - * Ex: - * float f; - * int d; - * f = devNormalizeDigital(d,12) - * - */ -#define devCreateMask(NBITS) ((1<<(NBITS))-1) -#define devDigToNml(DIGITAL,NBITS) \ - (((double)(DIGITAL))/devCreateMask(NBITS)) -#define devNmlToDig(NORMAL,NBITS) \ - (((long)(NORMAL)) * devCreateMask(NBITS)) - -/* - * - * Alignment mask - * (for use when testing to see if the proper number of least - * significant bits are zero) - * - */ -#define devCreateAlignmentMask(CTYPE)\ -(sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1) - -/* - * pointer aligned test - * (returns true if the pointer is on the worst case alignemnt - * boundary for its type) - */ -#define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR))) - -/* - * error codes (and messages) associated with devLib.c - */ -#define S_dev_success 0 -#define S_dev_vectorInUse (M_devLib| 1) /*interrupt vector in use*/ -#define S_dev_vecInstlFail (M_devLib| 2) /*interrupt vector install failed*/ -#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/ -#define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/ -#define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/ -#define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/ -#define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/ -#define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/ -#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/ -#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/ -#define S_dev_addrMapFail (M_devLib| 11) /*unable to map address*/ -#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/ -#define S_dev_internal (M_devLib| 13) /*Internal failure*/ -#define S_dev_intEnFail (M_devLib| 14) /*unable to enable interrupt level*/ -#define S_dev_intDissFail (M_devLib| 15) /*unable to disable interrupt level*/ -#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/ -#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/ -#define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/ -#define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/ -#define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/ -#define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/ -#define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/ -#define S_dev_highValue (M_devLib| 23) /*Parameter to high*/ -#define S_dev_lowValue (M_devLib| 24) /*Parameter to low*/ -#define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/ -#define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/ -#define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/ -#define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/ -#define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/ -#define S_dev_deviceTMO (M_devLib| 30) /*device timed out*/ -#define S_dev_badFunction (M_devLib| 31) /*bad function pointer*/ -#define S_dev_badVector (M_devLib| 32) /*bad interrupt vector*/ -#define S_dev_badArgument (M_devLib| 33) /*bad function argument*/ -#define S_dev_badISA (M_devLib| 34) /*Invalid ISA address*/ -#define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ -#define S_dev_vxWorksIntEnFail S_dev_intEnFail - - /* * Deprecated interface */ From a161e42e828da756f424d29d8f153433d643bd16 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:52 +0100 Subject: [PATCH 11/15] [PATCH 11/12] remove unimplimented PCI api --- src/libCom/osi/devLibVME.h | 57 -------------------------------------- 1 file changed, 57 deletions(-) diff --git a/src/libCom/osi/devLibVME.h b/src/libCom/osi/devLibVME.h index 3644f5b7c..6d7476098 100644 --- a/src/libCom/osi/devLibVME.h +++ b/src/libCom/osi/devLibVME.h @@ -232,63 +232,6 @@ epicsShareFunc long devEnableInterruptLevelISA (unsigned level); */ epicsShareFunc long devDisableInterruptLevelISA (unsigned level); - -/* - * PCI API - * - * Functions in this section apply only to the ISA bus type - */ - -/* - * connect ISR to a PCI interrupt - * (not implemented) - * (API should be reviewed) - */ -epicsShareFunc long devConnectInterruptPCI( - unsigned bus, - unsigned device, - unsigned function, - void (*pFunction)(void *), - void *parameter); - -/* - * disconnect ISR from a PCI interrupt - * (not implemented) - * (API should be reviewed) - * - * The parameter pFunction should be set to the C function pointer that - * was connected. It is used as a key to prevent a driver from inadvertently - * removing an interrupt handler that it didn't install - */ -epicsShareFunc long devDisconnectInterruptPCI( - unsigned bus, - unsigned device, - unsigned function, - void (*pFunction)(void *)); - -/* - * determine if a PCI interrupt is in use - * (not implemented) - * - * returns boolean - */ -epicsShareFunc int devInterruptInUsePCI (unsigned bus, unsigned device, - unsigned function); - - -/* - * not implemented - API needs to be reviewed - */ -epicsShareFunc long devEnableInterruptLevelPCI (unsigned level, - unsigned bus, unsigned device, unsigned function); - -/* - * not implemented - API needs to be reviewed - */ -epicsShareFunc long devDisableInterruptLevelPCI (unsigned level, - unsigned bus, unsigned device, unsigned function); - - /* * Deprecated interface */ From 43f5cfed7ef9a3a8d0d5777af1f4aa8166db03a4 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 May 2010 13:58:53 +0100 Subject: [PATCH 12/15] [PATCH 12/12] add entry to release notes --- documentation/RELEASE_NOTES.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 9b3ce378e..dfc825d68 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -12,6 +12,19 @@

Changes between 3.14.11 and 3.14.12

+

devLib cleanup

+ +
    +
  • Add VME connect/disconnect IRQ calls to the "virtual os" table
  • +
  • It is now possible to compile all devLib code on targets without runtime support
  • +
  • All internal functions are made static. Some were not before.
  • +
  • Move VME calls to devLibVME.h. devLib.h contains general defintions and error codes.
  • +
  • For compatibility devLib.h includes devLibVME.h unless the macro NO_DEVLIB_COMPAT is defined.
  • +
  • The "virtual os" table is renamed from pdevLibVirtualOS to pdevLibVME to reflect the fact +that other bus types would use seperate tables.
  • +
  • The "virtual os" table API has been moved to a seperate header devLibVMEImpl.h.
  • +
+

Rewrite epicsThreadOnce()

Michael Davidsaver suggested a better implementation of epicsThreadOnce() From eaf07d4f05b72ad340b5a5eec4288a25ef81b79a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 26 May 2010 17:17:26 +0100 Subject: [PATCH 13/15] copyright boilerplate for devLibVME --- src/libCom/osi/devLib.h | 17 +++++++++++++++++ src/libCom/osi/devLibVME.c | 6 ++++-- src/libCom/osi/devLibVMEImpl.h | 2 ++ src/libCom/osi/os/RTEMS/devLibVMEOSD.c | 2 +- src/libCom/osi/os/cygwin32/devLibVMEOSD.c | 2 +- src/libCom/osi/os/default/devLibVMEOSD.c | 2 +- src/libCom/osi/os/vxWorks/devLibVMEOSD.c | 2 +- 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/libCom/osi/devLib.h b/src/libCom/osi/devLib.h index 12e583e45..e642afe5a 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -1,4 +1,21 @@ +/*************************************************************************\ +* Copyright (c) 2010 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. +* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* devLib.h */ +/* $Id$ */ +/* + * Original Author: Marty Kraimer + * Author: Jeff Hill + * Date: 03-10-93 + */ #ifndef EPICSDEVLIB_H #define EPICSDEVLIB_H diff --git a/src/libCom/osi/devLibVME.c b/src/libCom/osi/devLibVME.c index 7d5c9981a..730b65447 100644 --- a/src/libCom/osi/devLibVME.c +++ b/src/libCom/osi/devLibVME.c @@ -1,4 +1,6 @@ /*************************************************************************\ +* Copyright (c) 2010 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as @@ -7,7 +9,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLib.c - support for allocation of common device resources */ -/* devLib.c,v 1.1.2.11 2009/07/09 16:37:23 anj Exp */ +/* $Id$ */ /* * Original Author: Marty Kraimer @@ -18,7 +20,7 @@ * .01 06-14-93 joh needs devAllocInterruptVector() routine */ -static const char sccsID[] = "@(#) devLib.c,v 1.1.2.11 2009/07/09 16:37:23 anj Exp"; +static const char sccsID[] = "@(#) $Id$"; #include #include diff --git a/src/libCom/osi/devLibVMEImpl.h b/src/libCom/osi/devLibVMEImpl.h index b75aa1ba9..1f5db3bb4 100644 --- a/src/libCom/osi/devLibVMEImpl.h +++ b/src/libCom/osi/devLibVMEImpl.h @@ -1,4 +1,6 @@ /*************************************************************************\ +* Copyright (c) 2010 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as diff --git a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c index 44ebb3adf..44861b83d 100644 --- a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLibOSD.c,v 1.1.2.8 2009/07/09 16:37:23 anj Exp */ +/* $Id$ */ /* RTEMS port by Till Straumann, * 3/2002 diff --git a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c index 3058292a5..5c327b939 100644 --- a/src/libCom/osi/os/cygwin32/devLibVMEOSD.c +++ b/src/libCom/osi/os/cygwin32/devLibVMEOSD.c @@ -5,7 +5,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLibOSD.c,v 1.1.2.1 2009/06/15 16:10:05 anj Exp */ +/* $Id$ */ #include diff --git a/src/libCom/osi/os/default/devLibVMEOSD.c b/src/libCom/osi/os/default/devLibVMEOSD.c index 0ae3e56cf..40ae6b589 100644 --- a/src/libCom/osi/os/default/devLibVMEOSD.c +++ b/src/libCom/osi/os/default/devLibVMEOSD.c @@ -6,7 +6,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLibOSD.c,v 1.1.2.1 2006/02/17 22:51:24 anj Exp */ +/* $Id$ */ #include diff --git a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c index 525678419..11b17fe57 100644 --- a/src/libCom/osi/os/vxWorks/devLibVMEOSD.c +++ b/src/libCom/osi/os/vxWorks/devLibVMEOSD.c @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * devLibOSD.c,v 1.1.2.9 2009/07/09 16:37:23 anj Exp + * $Id$ * * Archictecture dependent support for common device driver resources * From 7d3986664e1249f361596f36e51ab4e4cb7c6a81 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 27 May 2010 09:35:29 +0100 Subject: [PATCH 14/15] fix typo in rtems internal function names Not externally visible so no reason not to fix --- src/libCom/osi/os/RTEMS/devLibVMEOSD.c | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c index 44861b83d..0143780b4 100644 --- a/src/libCom/osi/os/RTEMS/devLibVMEOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -72,34 +72,34 @@ int EPICStovxWorksAddrType[] * maps logical address to physical address, but does not detect * two device drivers that are using the same address range */ -static long rtmsDevMapAddr (epicsAddressType addrType, unsigned options, +static long rtemsDevMapAddr (epicsAddressType addrType, unsigned options, size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); /* * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ -static long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); +static long rtemsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); /* * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ -static long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); +static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); -static long rtmsDevConnectInterruptVME ( +static long rtemsDevConnectInterruptVME ( unsigned vectorNumber, void (*pFunction)(), void *parameter); -static long rtmsDevDisconnectInterruptVME ( +static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, void (*pFunction)() ); -static long rtmsDevEnableInterruptLevelVME (unsigned level); +static long rtemsDevEnableInterruptLevelVME (unsigned level); -static long rtmsDevDisableInterruptLevelVME (unsigned level); +static long rtemsDevDisableInterruptLevelVME (unsigned level); static int rtemsDevInterruptInUseVME (unsigned vectorNumber); @@ -108,22 +108,22 @@ static int rtemsDevInterruptInUseVME (unsigned vectorNumber); /*devA24Malloc and devA24Free are not implemented*/ static void *devA24Malloc(size_t size) { return 0;} static void devA24Free(void *pBlock) {}; -static long rtmsDevInit(void); +static long rtemsDevInit(void); /* * used by bind in devLib.c */ static devLibVME rtemsVirtualOS = { - rtmsDevMapAddr, rtmsDevReadProbe, rtmsDevWriteProbe, - rtmsDevConnectInterruptVME, rtmsDevDisconnectInterruptVME, - rtmsDevEnableInterruptLevelVME, rtmsDevDisableInterruptLevelVME, - devA24Malloc,devA24Free,rtmsDevInit,rtemsDevInterruptInUseVME + rtemsDevMapAddr, rtemsDevReadProbe, rtemsDevWriteProbe, + rtemsDevConnectInterruptVME, rtemsDevDisconnectInterruptVME, + rtemsDevEnableInterruptLevelVME, rtemsDevDisableInterruptLevelVME, + devA24Malloc,devA24Free,rtemsDevInit,rtemsDevInterruptInUseVME }; devLibVME *pdevLibVME = &rtemsVirtualOS; /* RTEMS specific initialization */ static long -rtmsDevInit(void) +rtemsDevInit(void) { /* assume the vme bridge has been initialized by bsp */ /* init BSP extensions [memProbe etc.] */ @@ -135,7 +135,7 @@ rtmsDevInit(void) * * wrapper to minimize driver dependency on OS */ -static long rtmsDevConnectInterruptVME ( +static long rtemsDevConnectInterruptVME ( unsigned vectorNumber, void (*pFunction)(), void *parameter) @@ -168,7 +168,7 @@ static long rtmsDevConnectInterruptVME ( * an interrupt handler that was installed by another driver * */ -static long rtmsDevDisconnectInterruptVME ( +static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, void (*pFunction)() ) @@ -204,7 +204,7 @@ static long rtmsDevDisconnectInterruptVME ( /* * enable VME interrupt level */ -static long rtmsDevEnableInterruptLevelVME (unsigned level) +static long rtemsDevEnableInterruptLevelVME (unsigned level) { return BSP_enableVME_int_lvl(level); } @@ -212,15 +212,15 @@ static long rtmsDevEnableInterruptLevelVME (unsigned level) /* * disable VME interrupt level */ -static long rtmsDevDisableInterruptLevelVME (unsigned level) +static long rtemsDevDisableInterruptLevelVME (unsigned level) { return BSP_disableVME_int_lvl(level); } /* - * rtmsDevMapAddr () + * rtemsDevMapAddr () */ -static long rtmsDevMapAddr (epicsAddressType addrType, unsigned options, +static long rtemsDevMapAddr (epicsAddressType addrType, unsigned options, size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress) { long status; @@ -250,7 +250,7 @@ static long rtmsDevMapAddr (epicsAddressType addrType, unsigned options, * unsuccessful status if the device isnt present */ rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval); -static long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) +static long rtemsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) { long status; @@ -269,7 +269,7 @@ static long rtmsDevReadProbe (unsigned wordSize, volatile const void *ptr, void * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ -static long rtmsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) +static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) { long status; From 5ce74f2a414295f800c6743b41780e33bbdf96fd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 28 May 2010 12:04:46 +0100 Subject: [PATCH 15/15] include compatibility definition of pdevLibVirtualOS --- src/libCom/osi/devLibVMEImpl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libCom/osi/devLibVMEImpl.h b/src/libCom/osi/devLibVMEImpl.h index 1f5db3bb4..63d794ca3 100644 --- a/src/libCom/osi/devLibVMEImpl.h +++ b/src/libCom/osi/devLibVMEImpl.h @@ -92,6 +92,11 @@ typedef struct devLibVME { epicsShareExtern devLibVME *pdevLibVME; +#ifndef NO_DEVLIB_COMPAT +# define pdevLibVirtualOS pdevLibVME +#endif + + #ifdef __cplusplus } #endif