diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 70b24ac5c..47f787c71 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -12,6 +12,25 @@
The fields DTYP and INP/OUT can now be specified in any order.
diff --git a/src/libCom/Makefile b/src/libCom/Makefile index 3d251f35c..7f0168fb0 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -192,6 +192,8 @@ INC += epicsStdioRedirect.h INC += epicsGetopt.h INC += devLib.h +INC += devLibVME.h +INC += devLibVMEImpl.h INC += osdVME.h SRCS += epicsThread.cpp @@ -230,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.h b/src/libCom/osi/devLib.h index f9dd85751..e642afe5a 100644 --- a/src/libCom/osi/devLib.h +++ b/src/libCom/osi/devLib.h @@ -1,252 +1,27 @@ /*************************************************************************\ +* 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. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLib.h */ /* $Id$ */ /* - * Original Author: Marty Kraimer + * Original Author: Marty Kraimer * Author: Jeff Hill * Date: 03-10-93 */ - -#ifndef INCdevLibh -#define INCdevLibh 1 - -#include "dbDefs.h" -#include "osdVME.h" -#include "errMdef.h" -#include "shareLib.h" - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef EPICSDEVLIB_H +#define EPICSDEVLIB_H /* - * epdevAddressType & EPICStovxWorksAddrType - * devLib.c must change in unison + * Support macros */ -typedef enum { - atVMEA16, - atVMEA24, - atVMEA32, - atISA, /* memory mapped ISA access (until now only on PC) */ - atVMECSR, /* VME-64 CR/CSR address space */ - atLast /* atLast must be the last enum in this list */ - } epicsAddressType; - -/* - * pointer to an array of strings for each of - * the above address types - */ -extern const char *epicsAddressTypeName[]; - -epicsShareFunc long devAddressMap(void); /* print an address map */ - -/* - * devBusToLocalAddr() - * - * OSI routine to translate bus addresses their local CPU address mapping - */ -epicsShareFunc long devBusToLocalAddr ( - epicsAddressType addrType, - size_t busAddr, - volatile void **ppLocalAddr); -/* - * devReadProbe() - * - * a bus error safe "wordSize" read at the specified address which returns - * unsuccessful status if the device isnt present - */ -epicsShareFunc long devReadProbe ( - unsigned wordSize, volatile const void *ptr, void *pValueRead); - -/* - * devNoResponseProbe() - * - * Verifies that no devices respond at naturally aligned words - * within the specified address range. Return success if no devices - * respond. Returns an error if a device does respond or if - * a physical address for a naturally aligned word cant be mapped. - * Checks all naturally aligned word sizes between char and long for - * the entire specified range of bytes. - */ -epicsShareFunc long devNoResponseProbe( - epicsAddressType addrType, - size_t base, - size_t size -); - -/* - * devWriteProbe - * - * a bus error safe "wordSize" write at the specified address which returns - * unsuccessful status if the device isnt present - */ -epicsShareFunc long devWriteProbe ( - unsigned wordSize, volatile void *ptr, const void *pValueWritten); - -epicsShareFunc long devRegisterAddress( - const char *pOwnerName, - epicsAddressType addrType, - size_t logicalBaseAddress, - size_t size, /* bytes */ - volatile void **pPhysicalAddress); - -epicsShareFunc long devUnregisterAddress( - epicsAddressType addrType, - size_t logicalBaseAddress, - const char *pOwnerName); - -/* - * allocate and register an unoccupied address block - */ -epicsShareFunc long devAllocAddress( - const char *pOwnerName, - epicsAddressType addrType, - size_t size, - unsigned alignment, /*n ls bits zero in addr*/ - volatile void **pLocalAddress); - -/* - * connect ISR to a VME interrupt vector - */ -epicsShareFunc long devConnectInterruptVME( - unsigned vectorNumber, - 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 - * - * 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 devDisconnectInterruptVME( - unsigned vectorNumber, - void (*pFunction)(void *)); - -/* - * disconnect ISR from an ISA interrupt level - * (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 devDisconnectInterruptISA( - unsigned interruptLevel, - void (*pFunction)(void *)); - -/* - * 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 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) - * - * returns boolean - */ -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 - */ -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. - * - */ -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 @@ -280,59 +55,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); -}devLibVirtualOS; -epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; - /* * error codes (and messages) associated with devLib.c */ @@ -374,71 +96,12 @@ epicsShareExtern devLibVirtualOS *pdevLibVirtualOS; #define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ #define S_dev_vxWorksIntEnFail S_dev_intEnFail -/* - * NOTE: this routine has been deprecated. It exists - * for backwards compatibility purposes only. - * - * Please use one of devConnectInterruptVME, devConnectInterruptPCI, - * devConnectInterruptISA etc. devConnectInterrupt will be removed - * in a future release. - */ -epicsShareFunc long devConnectInterrupt( - epicsInterruptType intType, - unsigned vectorNumber, - void (*pFunction)(void *), - void *parameter); + +#endif /* EPICSDEVLIB_H */ /* - * NOTE: this routine has been deprecated. It exists - * for backwards compatibility purposes only. - * - * Please use one of devDisconnectInterruptVME, devDisconnectInterruptPCI, - * devDisconnectInterruptISA etc. devDisconnectInterrupt will be removed - * in a future release. + * Retain compatibility by including VME by default */ -epicsShareFunc long devDisconnectInterrupt( - epicsInterruptType intType, - unsigned vectorNumber, - void (*pFunction)(void *)); - -/* - * NOTE: this routine has been deprecated. It exists - * for backwards compatibility purposes only. - * - * Please use one of devEnableInterruptLevelVME, devEnableInterruptLevelPCI, - * devEnableInterruptLevelISA etc. devEnableInterruptLevel will be removed - * in a future release. - */ -epicsShareFunc long devEnableInterruptLevel( - epicsInterruptType intType, unsigned level); - -/* - * NOTE: this routine has been deprecated. It exists - * for backwards compatibility purposes only. - * - * Please use one of devDisableInterruptLevelVME, devDisableInterruptLevelISA, - * devDisableInterruptLevelPCI etc. devDisableInterruptLevel will be removed - * in a future release. - */ -epicsShareFunc long devDisableInterruptLevel ( - epicsInterruptType intType, unsigned level); - -/* - * NOTE: this routine has been deprecated. It exists - * for backwards compatibility purposes only. - * - * Please use devNoResponseProbe(). locationProbe() will be removed - * in a future release. - */ -epicsShareFunc long locationProbe (epicsAddressType addrType, char *pLocation); - -/* - * Some vxWorks convenience routines - */ -void bcopyLongs(char *source, char *destination, int nlongs); - -#ifdef __cplusplus -} +#ifndef NO_DEVLIB_COMPAT +# include "devLibVME.h" #endif - -#endif /* INCdevLibh.h*/ diff --git a/src/libCom/osi/devLib.c b/src/libCom/osi/devLibVME.c similarity index 90% rename from src/libCom/osi/devLib.c rename to src/libCom/osi/devLibVME.c index 8e03f86d9..730b65447 100644 --- a/src/libCom/osi/devLib.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 @@ -29,7 +31,10 @@ static const char sccsID[] = "@(#) $Id$"; #include "epicsMutex.h" #include "errlog.h" #include "ellLib.h" -#include "devLib.h" + +#define NO_DEVLIB_COMPAT +#include "devLibVME.h" +#include "devLibVMEImpl.h" static ELLLIST addrAlloc[atLast]; static ELLLIST addrFree[atLast]; @@ -167,7 +172,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); @@ -275,7 +280,7 @@ long devReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) } } - return (*pdevLibVirtualOS->pDevReadProbe) (wordSize, ptr, pValue); + return (*pdevLibVME->pDevReadProbe) (wordSize, ptr, pValue); } /* @@ -295,7 +300,7 @@ long devWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) } } - return (*pdevLibVirtualOS->pDevWriteProbe) (wordSize, ptr, pValue); + return (*pdevLibVME->pDevWriteProbe) (wordSize, ptr, pValue); } /* @@ -332,7 +337,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", @@ -697,8 +702,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; } @@ -727,7 +732,7 @@ static long devLibInit (void) } epicsMutexUnlock(addrListLock); devLibInitFlag = TRUE; - return pdevLibVirtualOS->pDevInit(); + return pdevLibVME->pDevInit(); } /* @@ -889,7 +894,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; } @@ -897,7 +902,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; } @@ -907,6 +912,82 @@ 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 (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, + pFunction, parameter); +} + +long devDisconnectInterruptVME( +unsigned vectorNumber, +void (*pFunction)(void *) ) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, pFunction); +} + +int devInterruptInUseVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVME->pDevInterruptInUseVME) (level); +} + +long devEnableInterruptLevelVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVME->pDevEnableInterruptLevelVME) (level); +} + +long devDisableInterruptLevelVME (unsigned level) +{ + long status; + + if (!devLibInitFlag) { + status = devLibInit(); + if (status) { + return status; + } + } + + return (*pdevLibVME->pDevDisableInterruptLevelVME) (level); +} + /* * devConnectInterrupt () * @@ -930,7 +1011,7 @@ void *parameter) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevConnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, pFunction, parameter); default: return S_dev_uknIntType; @@ -961,7 +1042,7 @@ void (*pFunction)(void *) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevDisconnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, pFunction); default: return S_dev_uknIntType; @@ -989,7 +1070,7 @@ unsigned level) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevEnableInterruptLevelVME) (level); + return (*pdevLibVME->pDevEnableInterruptLevelVME) (level); default: return S_dev_uknIntType; } @@ -1016,7 +1097,7 @@ unsigned level) switch(intType){ case intVME: case intVXI: - return (*pdevLibVirtualOS->pDevDisableInterruptLevelVME) (level); + return (*pdevLibVME->pDevDisableInterruptLevelVME) (level); default: return S_dev_uknIntType; } @@ -1065,7 +1146,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); } @@ -1074,5 +1155,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/devLibVME.h b/src/libCom/osi/devLibVME.h new file mode 100644 index 000000000..6d7476098 --- /dev/null +++ b/src/libCom/osi/devLibVME.h @@ -0,0 +1,312 @@ +/*************************************************************************\ +* 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 */ +/* devLib.h,v 1.1.2.8 2009/07/09 15:27:43 anj Exp */ + +/* + * Original Author: Marty Kraimer + * Author: Jeff Hill + * Date: 03-10-93 + */ + +#ifndef INCdevLibh +#define INCdevLibh 1 + +#include "dbDefs.h" +#include "osdVME.h" +#include "errMdef.h" +#include "shareLib.h" +#include "devLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * epdevAddressType & EPICStovxWorksAddrType + * devLib.c must change in unison + */ +typedef enum { + atVMEA16, + atVMEA24, + atVMEA32, + atISA, /* memory mapped ISA access (until now only on PC) */ + atVMECSR, /* VME-64 CR/CSR address space */ + atLast /* atLast must be the last enum in this list */ + } epicsAddressType; + +/* + * pointer to an array of strings for each of + * the above address types + */ +epicsShareExtern const char *epicsAddressTypeName[]; + +#ifdef __cplusplus +} +#endif + +/* + * To retain compatibility include everything by default + */ +#ifndef NO_DEVLIB_COMPAT +# include "devLibVMEImpl.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * General API + * + * This section applies to all bus types + */ + +epicsShareFunc long devAddressMap(void); /* print an address map */ + +/* + * devBusToLocalAddr() + * + * OSI routine to translate bus addresses their local CPU address mapping + */ +epicsShareFunc long devBusToLocalAddr ( + epicsAddressType addrType, + size_t busAddr, + volatile void **ppLocalAddr); +/* + * devReadProbe() + * + * a bus error safe "wordSize" read at the specified address which returns + * unsuccessful status if the device isnt present + */ +epicsShareFunc long devReadProbe ( + unsigned wordSize, volatile const void *ptr, void *pValueRead); + +/* + * devNoResponseProbe() + * + * Verifies that no devices respond at naturally aligned words + * within the specified address range. Return success if no devices + * respond. Returns an error if a device does respond or if + * a physical address for a naturally aligned word cant be mapped. + * Checks all naturally aligned word sizes between char and long for + * the entire specified range of bytes. + */ +epicsShareFunc long devNoResponseProbe( + epicsAddressType addrType, + size_t base, + size_t size +); + +/* + * devWriteProbe + * + * a bus error safe "wordSize" write at the specified address which returns + * unsuccessful status if the device isnt present + */ +epicsShareFunc long devWriteProbe ( + unsigned wordSize, volatile void *ptr, const void *pValueWritten); + +epicsShareFunc long devRegisterAddress( + const char *pOwnerName, + epicsAddressType addrType, + size_t logicalBaseAddress, + size_t size, /* bytes */ + volatile void **pPhysicalAddress); + +epicsShareFunc long devUnregisterAddress( + epicsAddressType addrType, + size_t logicalBaseAddress, + const char *pOwnerName); + +/* + * allocate and register an unoccupied address block + */ +epicsShareFunc long devAllocAddress( + const char *pOwnerName, + epicsAddressType addrType, + size_t size, + 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 + */ +epicsShareFunc long devConnectInterruptVME( + unsigned vectorNumber, + void (*pFunction)(void *), + void *parameter); + +/* + * disconnect ISR from a VME interrupt vector + * + * 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 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) + * (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 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); + +/* + * 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. + * + * Please use one of devConnectInterruptVME, devConnectInterruptPCI, + * devConnectInterruptISA etc. devConnectInterrupt will be removed + * in a future release. + */ +epicsShareFunc long devConnectInterrupt( + epicsInterruptType intType, + unsigned vectorNumber, + void (*pFunction)(void *), + void *parameter); + +/* + * NOTE: this routine has been deprecated. It exists + * for backwards compatibility purposes only. + * + * Please use one of devDisconnectInterruptVME, devDisconnectInterruptPCI, + * devDisconnectInterruptISA etc. devDisconnectInterrupt will be removed + * in a future release. + */ +epicsShareFunc long devDisconnectInterrupt( + epicsInterruptType intType, + unsigned vectorNumber, + void (*pFunction)(void *)); + +/* + * NOTE: this routine has been deprecated. It exists + * for backwards compatibility purposes only. + * + * Please use one of devEnableInterruptLevelVME, devEnableInterruptLevelPCI, + * devEnableInterruptLevelISA etc. devEnableInterruptLevel will be removed + * in a future release. + */ +epicsShareFunc long devEnableInterruptLevel( + epicsInterruptType intType, unsigned level); + +/* + * NOTE: this routine has been deprecated. It exists + * for backwards compatibility purposes only. + * + * Please use one of devDisableInterruptLevelVME, devDisableInterruptLevelISA, + * devDisableInterruptLevelPCI etc. devDisableInterruptLevel will be removed + * in a future release. + */ +epicsShareFunc long devDisableInterruptLevel ( + epicsInterruptType intType, unsigned level); + +/* + * NOTE: this routine has been deprecated. It exists + * for backwards compatibility purposes only. + * + * Please use devNoResponseProbe(). locationProbe() will be removed + * in a future release. + */ +epicsShareFunc long locationProbe (epicsAddressType addrType, char *pLocation); + +#endif /* NO_DEVLIB_OLD_INTERFACE */ + +/* + * Some vxWorks convenience routines + */ +void bcopyLongs(char *source, char *destination, int nlongs); + +#ifdef __cplusplus +} +#endif + +#endif /* INCdevLibh.h*/ diff --git a/src/libCom/osi/devLibVMEImpl.h b/src/libCom/osi/devLibVMEImpl.h new file mode 100644 index 000000000..63d794ca3 --- /dev/null +++ b/src/libCom/osi/devLibVMEImpl.h @@ -0,0 +1,104 @@ +/*************************************************************************\ +* 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. +\*************************************************************************/ +/* 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 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 devLibVME { + /* + * 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); +}devLibVME; + +epicsShareExtern devLibVME *pdevLibVME; + +#ifndef NO_DEVLIB_COMPAT +# define pdevLibVirtualOS pdevLibVME +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* INCdevLibImplh */ diff --git a/src/libCom/osi/os/RTEMS/devLibOSD.c b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c similarity index 80% rename from src/libCom/osi/os/RTEMS/devLibOSD.c rename to src/libCom/osi/os/RTEMS/devLibVMEOSD.c index 633736d24..0143780b4 100644 --- a/src/libCom/osi/os/RTEMS/devLibOSD.c +++ b/src/libCom/osi/os/RTEMS/devLibVMEOSD.c @@ -17,7 +17,7 @@ #include