This commit was manufactured by cvs2svn to create branch 'B3.14'.
This commit is contained in:
1022
src/libCom/osi/devLib.c
Normal file
1022
src/libCom/osi/devLib.c
Normal file
File diff suppressed because it is too large
Load Diff
422
src/libCom/osi/devLib.h
Normal file
422
src/libCom/osi/devLib.h
Normal file
@@ -0,0 +1,422 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are 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
|
||||
*
|
||||
* Notes:
|
||||
* ------
|
||||
* .01 03-23-93 joh We will only have problems with mod .03
|
||||
* above if the CPU maintains the different
|
||||
* address modes in different address spaces
|
||||
* and we have a card or a user that insists
|
||||
* on not using the default address type
|
||||
* .02 06-14-93 joh needs devAllocInterruptVector() routine
|
||||
*/
|
||||
|
||||
#ifndef INCdevLibh
|
||||
#define INCdevLibh 1
|
||||
|
||||
#include <dbDefs.h>
|
||||
|
||||
/*
|
||||
* epdevAddressType & EPICStovxWorksAddrType
|
||||
* devLib.c must change in unison
|
||||
*/
|
||||
typedef enum {
|
||||
atVMEA16,
|
||||
atVMEA24,
|
||||
atVMEA32,
|
||||
atISA, /* memory mapped ISA access (until now only on PC) */
|
||||
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[];
|
||||
|
||||
long devAddressMap(void); /* print an address map */
|
||||
|
||||
/*
|
||||
* devReadProbe()
|
||||
*
|
||||
* a bus error safe "wordSize" read at the specified address which returns
|
||||
* unsuccessful status if the device isnt present
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
long devWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValueWritten);
|
||||
|
||||
long devRegisterAddress(
|
||||
const char *pOwnerName,
|
||||
epicsAddressType addrType,
|
||||
size_t logicalBaseAddress,
|
||||
size_t size, /* bytes */
|
||||
volatile void **pPhysicalAddress);
|
||||
|
||||
long devUnregisterAddress(
|
||||
epicsAddressType addrType,
|
||||
size_t logicalBaseAddress,
|
||||
const char *pOwnerName);
|
||||
|
||||
/*
|
||||
* allocate and register an unoccupied address block
|
||||
*/
|
||||
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
|
||||
*/
|
||||
long devConnectInterruptVME(
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(void *),
|
||||
void *parameter);
|
||||
|
||||
/*
|
||||
* connect ISR to an ISA interrupt level
|
||||
* (not implemented)
|
||||
* (API should be reviewed)
|
||||
*/
|
||||
long devConnectInterruptISA(
|
||||
unsigned interruptLevel,
|
||||
void (*pFunction)(void *),
|
||||
void *parameter);
|
||||
|
||||
/*
|
||||
* connect ISR to a PCI interrupt
|
||||
* (not implemented)
|
||||
* (API should be reviewed)
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
long devDisconnectInterruptPCI(
|
||||
unsigned bus,
|
||||
unsigned device,
|
||||
unsigned function,
|
||||
void (*pFunction)(void *));
|
||||
|
||||
/*
|
||||
* determine if a VME interrupt vector is in use
|
||||
*
|
||||
* returns boolean
|
||||
*/
|
||||
int devInterruptInUseVME (unsigned vectorNumber);
|
||||
|
||||
/*
|
||||
* determine if an ISA interrupt level is in use
|
||||
* (not implemented)
|
||||
*
|
||||
* returns boolean
|
||||
*/
|
||||
int devInterruptLevelInUseISA (unsigned interruptLevel);
|
||||
|
||||
/*
|
||||
* determine if a PCI interrupt is in use
|
||||
* (not implemented)
|
||||
*
|
||||
* returns boolean
|
||||
*/
|
||||
int devInterruptInUsePCI (unsigned bus, unsigned device,
|
||||
unsigned function);
|
||||
|
||||
typedef enum {intVME, intVXI, intISA} epicsInterruptType;
|
||||
|
||||
/*
|
||||
* enable VME interrupt level
|
||||
*/
|
||||
long devEnableInterruptLevelVME (unsigned level);
|
||||
|
||||
/*
|
||||
* enable ISA interrupt level
|
||||
*/
|
||||
long devEnableInterruptLevelISA (unsigned level);
|
||||
|
||||
/*
|
||||
* not implemented - API needs to be reviewed
|
||||
*/
|
||||
long devEnableInterruptLevelPCI (unsigned level,
|
||||
unsigned bus, unsigned device, unsigned function);
|
||||
|
||||
/*
|
||||
* disable VME interrupt level
|
||||
*/
|
||||
long devDisableInterruptLevelVME (unsigned level);
|
||||
|
||||
/*
|
||||
* disable ISA interrupt level
|
||||
*/
|
||||
long devDisableInterruptLevelISA (unsigned level);
|
||||
|
||||
/*
|
||||
* not implemented - API needs to be reviewed
|
||||
*/
|
||||
long devDisableInterruptLevelPCI (unsigned level,
|
||||
unsigned bus, unsigned device, unsigned function);
|
||||
|
||||
/*
|
||||
* Routines to allocate and free memory in the A24 memory region.
|
||||
*
|
||||
*/
|
||||
void *devLibA24Malloc(size_t);
|
||||
void *devLibA24Calloc(size_t);
|
||||
void devLibA24Free(void *pBlock);
|
||||
|
||||
/*
|
||||
* 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)))
|
||||
|
||||
/*
|
||||
* 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 *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;
|
||||
extern devLibVirtualOS *pdevLibVirtualOS;
|
||||
|
||||
/*
|
||||
* 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_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.
|
||||
*/
|
||||
long devConnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(),
|
||||
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.
|
||||
*/
|
||||
long devDisconnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)());
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
long locationProbe (epicsAddressType addrType, char *pLocation);
|
||||
|
||||
#endif /* devLib.h*/
|
||||
318
src/libCom/osi/os/RTEMS/devLibOSD.c
Normal file
318
src/libCom/osi/os/RTEMS/devLibOSD.c
Normal file
@@ -0,0 +1,318 @@
|
||||
/* devLibRTEMS.c */
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* RTEMS port by Till Straumann, <strauman@slac.stanford.edu>
|
||||
* 3/2002
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <bsp/VME.h>
|
||||
#include <bsp/bspExt.h>
|
||||
|
||||
#include "devLib.h"
|
||||
#include <epicsInterrupt.h>
|
||||
|
||||
typedef void myISR (void *pParam);
|
||||
|
||||
LOCAL 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);
|
||||
|
||||
LOCAL myISR *defaultHandlerAddr[]={
|
||||
(myISR*)unsolicitedHandlerEPICS,
|
||||
};
|
||||
|
||||
/*
|
||||
* we use a translation between an EPICS encoding
|
||||
* and a vxWorks encoding here
|
||||
* to reduce dependency of drivers on vxWorks
|
||||
*
|
||||
* we assume that the BSP are configured to use these
|
||||
* address modes by default
|
||||
*/
|
||||
#define EPICSAddrTypeNoConvert -1
|
||||
int EPICStovxWorksAddrType[]
|
||||
= {
|
||||
VME_AM_SUP_SHORT_IO,
|
||||
VME_AM_STD_SUP_DATA,
|
||||
VME_AM_EXT_SUP_DATA,
|
||||
EPICSAddrTypeNoConvert
|
||||
};
|
||||
|
||||
/*
|
||||
* maps logical address to physical address, but does not detect
|
||||
* two device drivers that are using the same address range
|
||||
*/
|
||||
LOCAL long rtmsDevMapAddr (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 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);
|
||||
|
||||
/* RTEMS specific init */
|
||||
|
||||
/*devA24Malloc and devA24Free are not implemented*/
|
||||
LOCAL void *devA24Malloc(size_t size) { return 0;}
|
||||
LOCAL void devA24Free(void *pBlock) {};
|
||||
LOCAL long rtmsDevInit(void);
|
||||
|
||||
/*
|
||||
* used by bind in devLib.c
|
||||
*/
|
||||
const struct devLibVirtualOS devLibRTEMSOS =
|
||||
{rtmsDevMapAddr, rtmsDevReadProbe, rtmsDevWriteProbe,
|
||||
devConnectInterruptVME, devDisconnectInterruptVME,
|
||||
devEnableInterruptLevelVME, devDisableInterruptLevelVME,
|
||||
devA24Malloc,devA24Free,rtmsDevInit};
|
||||
|
||||
/* RTEMS specific initialization */
|
||||
LOCAL long
|
||||
rtmsDevInit(void)
|
||||
{
|
||||
/* assume the vme bridge has been initialized by bsp */
|
||||
/* init BSP extensions [memProbe etc.] */
|
||||
return bspExtInit();
|
||||
}
|
||||
|
||||
/*
|
||||
* devConnectInterruptVME
|
||||
*
|
||||
* wrapper to minimize driver dependency on OS
|
||||
*/
|
||||
long devConnectInterruptVME (
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(),
|
||||
void *parameter)
|
||||
{
|
||||
int status;
|
||||
|
||||
|
||||
if (devInterruptInUseVME(vectorNumber)) {
|
||||
return S_dev_vectorInUse;
|
||||
}
|
||||
status = BSP_installVME_isr(
|
||||
vectorNumber,
|
||||
pFunction,
|
||||
parameter);
|
||||
if (status) {
|
||||
return S_dev_vecInstlFail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* devDisconnectInterruptVME()
|
||||
*
|
||||
* wrapper to minimize driver dependency on OS
|
||||
*
|
||||
* 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 removing
|
||||
* an interrupt handler that was installed by another driver
|
||||
*
|
||||
*/
|
||||
long devDisconnectInterruptVME (
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)()
|
||||
)
|
||||
{
|
||||
void (*psub)();
|
||||
void *arg;
|
||||
int status;
|
||||
|
||||
/*
|
||||
* If pFunction not connected to this vector
|
||||
* then they are probably disconnecting from the wrong vector
|
||||
*/
|
||||
psub = isrFetch(vectorNumber, &arg);
|
||||
if(psub != pFunction){
|
||||
return S_dev_vectorNotInUse;
|
||||
}
|
||||
|
||||
status = BSP_removeVME_isr(
|
||||
vectorNumber,
|
||||
psub,
|
||||
arg) ||
|
||||
BSP_installVME_isr(
|
||||
vectorNumber,
|
||||
(BSP_VME_ISR_t)unsolicitedHandlerEPICS,
|
||||
(void*)vectorNumber);
|
||||
if(status){
|
||||
return S_dev_vecInstlFail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* enable VME interrupt level
|
||||
*/
|
||||
long devEnableInterruptLevelVME (unsigned level)
|
||||
{
|
||||
return BSP_enableVME_int_lvl(level);
|
||||
}
|
||||
|
||||
/*
|
||||
* disable VME interrupt level
|
||||
*/
|
||||
long devDisableInterruptLevelVME (unsigned level)
|
||||
{
|
||||
return BSP_disableVME_int_lvl(level);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtmsDevMapAddr ()
|
||||
*/
|
||||
LOCAL long rtmsDevMapAddr (epicsAddressType addrType, unsigned options,
|
||||
size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress)
|
||||
{
|
||||
long status;
|
||||
|
||||
if (ppPhysicalAddress==NULL) {
|
||||
return S_dev_badArgument;
|
||||
}
|
||||
|
||||
if (EPICStovxWorksAddrType[addrType] == EPICSAddrTypeNoConvert)
|
||||
{
|
||||
*ppPhysicalAddress = (void *) logicalAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = BSP_vme2local_adrs(EPICStovxWorksAddrType[addrType],
|
||||
logicalAddress, (unsigned long *)ppPhysicalAddress);
|
||||
if (status) {
|
||||
return S_dev_addrMapFail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = bspExtMemProbe ((void*)ptr, 0/*read*/, wordSize, pValue);
|
||||
if (status!=RTEMS_SUCCESSFUL) {
|
||||
return S_dev_noDevice;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = bspExtMemProbe ((void*)ptr, 1/*write*/, wordSize, (void*)pValue);
|
||||
if (status!=RTEMS_SUCCESSFUL) {
|
||||
return S_dev_noDevice;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* isrFetch()
|
||||
*/
|
||||
LOCAL myISR *isrFetch(unsigned vectorNumber, void **parg)
|
||||
{
|
||||
/*
|
||||
* fetch the handler or C stub attached at this vector
|
||||
*/
|
||||
return (myISR *) BSP_getVME_isr(vectorNumber,parg);
|
||||
}
|
||||
|
||||
/*
|
||||
* determine if a VME interrupt vector is in use
|
||||
*/
|
||||
int devInterruptInUseVME (unsigned vectorNumber)
|
||||
{
|
||||
int i;
|
||||
myISR *psub;
|
||||
void *arg;
|
||||
|
||||
psub = isrFetch (vectorNumber,&arg);
|
||||
|
||||
if (!psub)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* its a C routine. Does it match a default handler?
|
||||
*/
|
||||
for (i=0; i<NELEMENTS(defaultHandlerAddr); i++) {
|
||||
if (defaultHandlerAddr[i] == psub) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* unsolicitedHandlerEPICS()
|
||||
* what gets called if they disconnect from an
|
||||
* interrupt and an interrupt arrives on the
|
||||
* disconnected vector
|
||||
*
|
||||
* NOTE: RTEMS may pass additional arguments - hope
|
||||
* this doesn't disturb this handler...
|
||||
*
|
||||
* A cleaner way would be having a OS dependent
|
||||
* macro to declare handler prototypes...
|
||||
*
|
||||
*/
|
||||
void unsolicitedHandlerEPICS(int vectorNumber)
|
||||
{
|
||||
/*
|
||||
* call epicInterruptContextMessage()
|
||||
* and not errMessage()
|
||||
* so we are certain that printf()
|
||||
* does not get called at interrupt level
|
||||
*
|
||||
* NOTE: current RTEMS implementation only
|
||||
* allows a static string to be passed
|
||||
*/
|
||||
epicsInterruptContextMessage(
|
||||
"Interrupt to EPICS disconnected vector"
|
||||
);
|
||||
}
|
||||
59
src/libCom/osi/os/vxWorks/camacLib.h
Normal file
59
src/libCom/osi/os/vxWorks/camacLib.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* camacLib.h -- Prototypes for camacLib.o
|
||||
*
|
||||
* Marty Wise
|
||||
* 10/11/93
|
||||
*
|
||||
*/
|
||||
|
||||
static char ht2992_h_RCSID[] = "$Header$";
|
||||
|
||||
/********************************/
|
||||
/* GLOBAL DATA */
|
||||
/********************************/
|
||||
extern int debug_hook;
|
||||
|
||||
extern struct glob_dat {
|
||||
int total;
|
||||
int read_error[5];
|
||||
int write_error[5];
|
||||
int cmd_error[5];
|
||||
int total_err;
|
||||
int lam_count[12];
|
||||
} debug_dat;
|
||||
|
||||
|
||||
/********************************/
|
||||
/* FUNCTION PROTOTYPES */
|
||||
/********************************/
|
||||
|
||||
void cdreg(int *ext, int b, int c, int n, int a);
|
||||
void cfsa(int f, int ext, int *dat, int *q);
|
||||
void cssa(int f, int ext, short *dat, int *q);
|
||||
void ccci(int ext, int l);
|
||||
void cccz(int ext);
|
||||
void cccc(int ext);
|
||||
void ccinit(int b);
|
||||
void ctci(int ext, int *l);
|
||||
void cgreg(int ext, int *b, int *c, int *n, int *a);
|
||||
void cfmad(int f, int extb[2], int *intc, int cb[4]);
|
||||
void cfubc(int f, int ext, int *intc, int cb[4]);
|
||||
void cfubc(int f, int ext, int *intc, int cb[4]);
|
||||
void csmad(int f, int extb[2], short *intc, int cb[4]);
|
||||
void ctcd(int ext, int *l);
|
||||
void cccd(int ext, int l);
|
||||
void csga(int fa[], int exta[], unsigned short intc[], int qa[], int cb[4]);
|
||||
void cfga(int fa[], int exta[], int intc[], int qa[], int cb[4]);
|
||||
void cfubr(int f, int ext, int intc[], int cb[4]);
|
||||
void csubc(int f, int ext, unsigned short *intc, int cb[4]);
|
||||
void csubr(int f, int ext, int intc[], int cb[4]);
|
||||
void print_reg(int ext);
|
||||
|
||||
474
src/libCom/osi/os/vxWorks/devLibOSD.c
Normal file
474
src/libCom/osi/os/vxWorks/devLibOSD.c
Normal file
@@ -0,0 +1,474 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* devLibVxWorks.c
|
||||
* @(#)$Id$
|
||||
*
|
||||
* Archictecture dependent support for common device driver resources
|
||||
*
|
||||
* Author: Jeff Hill
|
||||
* Date: 10-30-98
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <iv.h>
|
||||
#include <vme.h>
|
||||
#include <sysLib.h>
|
||||
#include <memLib.h>
|
||||
#include <intLib.h>
|
||||
#include <logLib.h>
|
||||
#include <vxLib.h>
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
#include "devLib.h"
|
||||
|
||||
/*
|
||||
* A list of the names of the unexpected interrupt handlers
|
||||
* ( some of these are provided by wrs )
|
||||
*/
|
||||
LOCAL char *defaultHandlerNames[] = {
|
||||
"excStub",
|
||||
"excIntStub",
|
||||
"unsolicitedHandlerEPICS"};
|
||||
|
||||
typedef void myISR (void *pParam);
|
||||
LOCAL myISR *defaultHandlerAddr[NELEMENTS(defaultHandlerNames)];
|
||||
|
||||
LOCAL myISR *isrFetch(unsigned vectorNumber);
|
||||
|
||||
/*
|
||||
* this routine needs to be in the symbol table
|
||||
* for this code to work correctly
|
||||
*/
|
||||
void unsolicitedHandlerEPICS(int vectorNumber);
|
||||
|
||||
/*
|
||||
* this is in veclist.c
|
||||
*/
|
||||
int cISRTest(void (*)(), void (**)(), void **);
|
||||
|
||||
/*
|
||||
* we use a translation between an EPICS encoding
|
||||
* and a vxWorks encoding here
|
||||
* to reduce dependency of drivers on vxWorks
|
||||
*
|
||||
* we assume that the BSP are configured to use these
|
||||
* address modes by default
|
||||
*/
|
||||
#define EPICSAddrTypeNoConvert -1
|
||||
int EPICStovxWorksAddrType[]
|
||||
= {
|
||||
VME_AM_SUP_SHORT_IO,
|
||||
VME_AM_STD_SUP_DATA,
|
||||
VME_AM_EXT_SUP_DATA,
|
||||
EPICSAddrTypeNoConvert
|
||||
};
|
||||
|
||||
LOCAL void initHandlerAddrList(void);
|
||||
|
||||
/*
|
||||
* maps logical address to physical address, but does not detect
|
||||
* two device drivers that are using the same address range
|
||||
*/
|
||||
LOCAL long vxDevMapAddr (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 vxDevReadProbe (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 vxDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue);
|
||||
|
||||
static void *devA24Malloc(size_t size);
|
||||
static void devA24Free(void *pBlock);
|
||||
static void devInit(void) { return 0;}
|
||||
|
||||
/*
|
||||
* used by dynamic bind in devLib.c
|
||||
*/
|
||||
static devLibVirtualOS virtualOS = {
|
||||
vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe,
|
||||
devConnectInterruptVME, devDisconnectInterruptVME,
|
||||
devEnableInterruptLevelVME, devDisableInterruptLevelVME,
|
||||
devA24Malloc,devA24Free,devInit
|
||||
};
|
||||
devLibVirtualOS *pdevLibVirtualOS = &virtualOS;
|
||||
|
||||
/*
|
||||
* devConnectInterruptVME
|
||||
*
|
||||
* wrapper to minimize driver dependency on vxWorks
|
||||
*/
|
||||
long devConnectInterruptVME (
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(),
|
||||
void *parameter)
|
||||
{
|
||||
int status;
|
||||
|
||||
|
||||
if (devInterruptInUseVME(vectorNumber)) {
|
||||
return S_dev_vectorInUse;
|
||||
}
|
||||
status = intConnect(
|
||||
(void *)INUM_TO_IVEC(vectorNumber),
|
||||
pFunction,
|
||||
(int) parameter);
|
||||
if (status<0) {
|
||||
return S_dev_vecInstlFail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* devDisconnectInterruptVME()
|
||||
*
|
||||
* wrapper to minimize driver dependency on vxWorks
|
||||
*
|
||||
* 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 removing
|
||||
* an interrupt handler that was installed by another driver
|
||||
*
|
||||
*/
|
||||
long devDisconnectInterruptVME (
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)()
|
||||
)
|
||||
{
|
||||
void (*psub)();
|
||||
int status;
|
||||
|
||||
# if CPU_FAMILY == PPC
|
||||
return S_dev_vecInstlFail;
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If pFunction not connected to this vector
|
||||
* then they are probably disconnecting from the wrong vector
|
||||
*/
|
||||
psub = isrFetch(vectorNumber);
|
||||
if(psub != pFunction){
|
||||
return S_dev_vectorNotInUse;
|
||||
}
|
||||
|
||||
status = intConnect(
|
||||
(void *)INUM_TO_IVEC(vectorNumber),
|
||||
unsolicitedHandlerEPICS,
|
||||
(int) vectorNumber);
|
||||
if(status<0){
|
||||
return S_dev_vecInstlFail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* enable VME interrupt level
|
||||
*/
|
||||
long devEnableInterruptLevelVME (unsigned level)
|
||||
{
|
||||
# if CPU_FAMILY != I80X86
|
||||
int s;
|
||||
s = sysIntEnable (level);
|
||||
if (s!=OK) {
|
||||
return S_dev_intEnFail;
|
||||
}
|
||||
return 0;
|
||||
# else
|
||||
return S_dev_intEnFail;
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
* enable ISA interrupt level
|
||||
*/
|
||||
long devEnableInterruptLevelISA (unsigned level)
|
||||
{
|
||||
# if CPU_FAMILY == I80X86
|
||||
int s;
|
||||
s = sysIntEnablePIC (level);
|
||||
if (s!=OK) {
|
||||
return S_dev_intEnFail;
|
||||
}
|
||||
return 0;
|
||||
# else
|
||||
return S_dev_intEnFail;
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
* disable ISA interrupt level
|
||||
*/
|
||||
long devDisableInterruptLevelISA (unsigned level)
|
||||
{
|
||||
# if CPU_FAMILY == I80X86
|
||||
int s;
|
||||
s = sysIntDisablePIC (level);
|
||||
if (s!=OK) {
|
||||
return S_dev_intEnFail;
|
||||
}
|
||||
# else
|
||||
return S_dev_intEnFail;
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* disable VME interrupt level
|
||||
*/
|
||||
long devDisableInterruptLevelVME (unsigned level)
|
||||
{
|
||||
# if CPU_FAMILY != I80X86
|
||||
int s;
|
||||
s = sysIntDisable (level);
|
||||
if (s!=OK) {
|
||||
return S_dev_intDissFail;
|
||||
}
|
||||
return 0;
|
||||
# else
|
||||
return S_dev_intEnFail;
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
* vxDevMapAddr ()
|
||||
*/
|
||||
LOCAL long vxDevMapAddr (epicsAddressType addrType, unsigned options,
|
||||
size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress)
|
||||
{
|
||||
long status;
|
||||
|
||||
if (ppPhysicalAddress==NULL) {
|
||||
return S_dev_badArgument;
|
||||
}
|
||||
|
||||
if (EPICStovxWorksAddrType[addrType] == EPICSAddrTypeNoConvert)
|
||||
{
|
||||
*ppPhysicalAddress = (void *) logicalAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = sysBusToLocalAdrs (EPICStovxWorksAddrType[addrType],
|
||||
(char *) logicalAddress, (char **)ppPhysicalAddress);
|
||||
if (status) {
|
||||
return S_dev_addrMapFail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* a bus error safe "wordSize" read at the specified address which returns
|
||||
* unsuccessful status if the device isnt present
|
||||
*/
|
||||
static long vxDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = vxMemProbe ((char *)ptr, VX_READ, wordSize, (char *) pValue);
|
||||
if (status!=OK) {
|
||||
return S_dev_noDevice;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* a bus error safe "wordSize" write at the specified address which returns
|
||||
* unsuccessful status if the device isnt present
|
||||
*/
|
||||
static long vxDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = vxMemProbe ((char *)ptr, VX_READ, wordSize, (char *) pValue);
|
||||
if (status!=OK) {
|
||||
return S_dev_noDevice;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* isrFetch()
|
||||
*/
|
||||
LOCAL myISR *isrFetch(unsigned vectorNumber)
|
||||
{
|
||||
myISR *psub;
|
||||
myISR *pCISR;
|
||||
void *pParam;
|
||||
int s;
|
||||
|
||||
/*
|
||||
* fetch the handler or C stub attached at this vector
|
||||
*/
|
||||
psub = (myISR *) intVecGet((FUNCPTR *)INUM_TO_IVEC(vectorNumber));
|
||||
|
||||
if ( psub ) {
|
||||
/*
|
||||
* from libvxWorks/veclist.c
|
||||
*
|
||||
* checks to see if it is a C ISR
|
||||
* and if so finds the function pointer and
|
||||
* the parameter passed
|
||||
*/
|
||||
s = cISRTest(psub, &pCISR, &pParam);
|
||||
if(!s){
|
||||
psub = pCISR;
|
||||
}
|
||||
}
|
||||
|
||||
return psub;
|
||||
}
|
||||
|
||||
/*
|
||||
* determine if a VME interrupt vector is in use
|
||||
*/
|
||||
int devInterruptInUseVME (unsigned vectorNumber)
|
||||
{
|
||||
static int init;
|
||||
int i;
|
||||
myISR *psub;
|
||||
|
||||
# if CPU_FAMILY == PPC
|
||||
return FALSE;
|
||||
# else
|
||||
if (!init) {
|
||||
initHandlerAddrList();
|
||||
init = TRUE;
|
||||
}
|
||||
|
||||
psub = isrFetch (vectorNumber);
|
||||
|
||||
/*
|
||||
* its a C routine. Does it match a default handler?
|
||||
*/
|
||||
for (i=0; i<NELEMENTS(defaultHandlerAddr); i++) {
|
||||
if (defaultHandlerAddr[i] == psub) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* unsolicitedHandlerEPICS()
|
||||
* what gets called if they disconnect from an
|
||||
* interrupt and an interrupt arrives on the
|
||||
* disconnected vector
|
||||
*
|
||||
*/
|
||||
void unsolicitedHandlerEPICS(int vectorNumber)
|
||||
{
|
||||
/*
|
||||
* call logMsg() and not errMessage()
|
||||
* so we are certain that printf()
|
||||
* does not get called at interrupt level
|
||||
*/
|
||||
logMsg(
|
||||
"%s: line=%d: Interrupt to EPICS disconnected vector = 0X %X",
|
||||
(int)__FILE__,
|
||||
__LINE__,
|
||||
vectorNumber,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* initHandlerAddrList()
|
||||
* init list of interrupt handlers to ignore
|
||||
*
|
||||
*/
|
||||
LOCAL
|
||||
void initHandlerAddrList(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<NELEMENTS(defaultHandlerNames); i++) {
|
||||
defaultHandlerAddr[i] = epicsFindSymbol(defaultHandlerNames[i]);
|
||||
if(!defaultHandlerAddr[i]) {
|
||||
errPrintf(
|
||||
S_dev_internal,
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
"initHandlerAddrList() %s not in sym table",
|
||||
defaultHandlerNames[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Routines to use to allocate and free memory present in the A24 region.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void * (*A24MallocFunc)(size_t) = NULL;
|
||||
static void (*A24FreeFunc)(void *) = NULL;
|
||||
|
||||
static void *devA24Malloc(size_t size)
|
||||
{
|
||||
static int UsingBSP = 0;
|
||||
void *ret;
|
||||
|
||||
if (A24MallocFunc == NULL)
|
||||
{
|
||||
/* See if the sysA24Malloc() function is present. */
|
||||
A24MallocFunc = epicsFindSymbol("sysA24Malloc");
|
||||
if(!A24MallocFunc) {
|
||||
A24MallocFunc = malloc;
|
||||
A24FreeFunc = free;
|
||||
} else {
|
||||
A24FreeFunc = epicsFindSymbol("sysA24Free");
|
||||
if(!A24FreeFunc) {
|
||||
/* That's strange... we have malloc, but no free! */
|
||||
A24MallocFunc = malloc;
|
||||
A24FreeFunc = free;
|
||||
} else {
|
||||
UsingBSP = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = A24MallocFunc(size);
|
||||
|
||||
if ((ret == NULL) && (UsingBSP))
|
||||
errMessage(S_dev_noMemory, "devLibA24Malloc ran out of A24 memory, try sysA24MapRam(size)");
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void devA24Free(void *pBlock)
|
||||
{
|
||||
A24FreeFunc(pBlock);
|
||||
}
|
||||
1864
src/libCom/osi/os/vxWorks/drvTS.c
Normal file
1864
src/libCom/osi/os/vxWorks/drvTS.c
Normal file
File diff suppressed because it is too large
Load Diff
204
src/libCom/osi/os/vxWorks/drvTS.h
Normal file
204
src/libCom/osi/os/vxWorks/drvTS.h
Normal file
@@ -0,0 +1,204 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#ifndef __DRVTS_h__
|
||||
#define __DRVTS_h__
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Author: Jim Kowalkowski
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <timers.h>
|
||||
#include <semLib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "epicsTime.h"
|
||||
|
||||
#ifdef TS_DRIVER
|
||||
#define TS_EXTERN
|
||||
#else
|
||||
#define TS_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define ER_EVENT_RESET_TICK 0x7d /* Reset the tick counter */
|
||||
|
||||
#define TS_MAGIC ('T'<<24|'S'<<16|'d'<<8|'r')
|
||||
#define TS_SLAVE_PORT 18322
|
||||
#define TS_MASTER_PORT 18323
|
||||
#define TS_RETRY_COUNT 4
|
||||
#define TS_TIME_OUT_MS 250
|
||||
#define TS_SECS_ASYNC_TRY_MASTER (60*5) /* every five minutes */
|
||||
#define TS_SECS_SYNC_TRY_MASTER (60*1) /* every one minute */
|
||||
|
||||
#define UDP_TIME_PORT 37
|
||||
#define UDP_NTP_PORT 123
|
||||
|
||||
#define TS_BILLION 1000000000
|
||||
#define TS_SYNC_RATE_SEC 10
|
||||
#define TS_CLOCK_RATE_HZ 1000
|
||||
#define TS_TOTAL_EVENTS 128
|
||||
/*Following is (SEC_IN_YEAR*90)+(22*SEC_IN_DAY) */
|
||||
/*22 is leap years from 1900 to 1990*/
|
||||
#define TS_1900_TO_EPICS_EPOCH 2840140800UL
|
||||
/*Following is (SEC_IN_YEAR*70)+(17*SEC_IN_DAY) */
|
||||
/*17 is leap years from 1900 to 1970*/
|
||||
#define TS_1900_TO_VXWORKS_EPOCH 2208988800UL
|
||||
/*Following is (SEC_IN_YEAR*20)+(5*SEC_IN_DAY) */
|
||||
/*5 is leap years from 1970 to 1990*/
|
||||
#define TS_VXWORKS_TO_EPICS_EPOCH 631152000UL
|
||||
|
||||
#define TS_STAMP_SERVER_PRI 70
|
||||
#define TS_SYNC_SERVER_PRI 70
|
||||
#define TS_SYNC_CLIENT_PRI 70
|
||||
#define TS_ASYNC_CLIENT_PRI 70
|
||||
|
||||
typedef enum { TS_time_request, TS_sync_request, TS_sync_msg } TStype;
|
||||
typedef enum { TS_master_alive, TS_master_dead } TSstate;
|
||||
typedef enum { TS_async_none, TS_async_private,
|
||||
TS_async_ntp, TS_async_time } TStime_protocol;
|
||||
typedef enum { TS_sync_master, TS_async_master,
|
||||
TS_sync_slave, TS_async_slave,
|
||||
TS_direct_master, TS_direct_slave} TStime_type;
|
||||
|
||||
struct TSstampTransStruct {
|
||||
unsigned long magic; /* identifier */
|
||||
TStype type; /* transaction type */
|
||||
struct timespec master_time; /* master time stamp - last sync time */
|
||||
struct timespec current_time; /* master current time stamp 1990 epoch */
|
||||
struct timespec unix_time; /* time using 1900 epoch */
|
||||
unsigned long sync_rate; /* master sends sync at this rate */
|
||||
unsigned long clock_hz; /* master clock this frequency (tick rate) */
|
||||
};
|
||||
typedef struct TSstampTransStruct TSstampTrans;
|
||||
|
||||
struct TSinfoStruct {
|
||||
TSstate state;
|
||||
TStime_type type;
|
||||
TStime_protocol async_type;
|
||||
int ts_sync_valid;
|
||||
|
||||
struct timespec *event_table; /* timestamp table */
|
||||
|
||||
unsigned long sync_rate; /* master send sync at this rate */
|
||||
unsigned long clock_hz; /* master clock is this frequency */
|
||||
unsigned long clock_conv;/* conversion factor for tick_rate->ns */
|
||||
unsigned long time_out; /* udp packet time-out in milliseconds */
|
||||
int master_timing_IOC; /* 1=master, 0=slave */
|
||||
int master_port; /* port that master listens on */
|
||||
int slave_port; /* port that slave listens on */
|
||||
int total_events; /* this is the total event in the event system*/
|
||||
int sync_event; /* this is the sync event number */
|
||||
int has_event_system; /* 1=has event system, 0=no event system */
|
||||
int has_direct_time; /* 1=has direct time, 0=no direct time */
|
||||
int UserRequestedType; /* let user force the setting of type */
|
||||
|
||||
SEM_ID sync_occurred;
|
||||
|
||||
struct sockaddr hunt; /* broadcast address info */
|
||||
struct sockaddr master; /* socket info for contacting master */
|
||||
};
|
||||
typedef struct TSinfoStruct TSinfo;
|
||||
|
||||
/* global functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TS_EXTERN long TSinit(void);
|
||||
TS_EXTERN long TSgetTimeStamp(int event_number,struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochNtpToUnix(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSfractionToNano(unsigned long fraction);
|
||||
TS_EXTERN unsigned long TSepochNtpToEpics(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochUnixToEpics(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochEpicsToUnix(struct timespec* ts);
|
||||
TS_EXTERN long TScurrentTimeStamp(struct timespec* ts);
|
||||
TS_EXTERN long TSaccurateTimeStamp(struct timespec* ts);
|
||||
TS_EXTERN long TSgetFirstOfYearVx(struct timespec* ts);
|
||||
TS_EXTERN void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
|
||||
int master_port, int slave_port,
|
||||
unsigned long millisecond_request_time_out, int type);
|
||||
TS_EXTERN long TSsetClockFromUnix(void);
|
||||
|
||||
#ifndef TS_DRIVER
|
||||
TS_EXTERN TSinfo TSdata;
|
||||
TS_EXTERN TSdirectTimeVar; /* set to !=0 to indicate direct time available*/
|
||||
TS_EXTERN TSgoodTimeStamps; /* force best time stamps by setting != 0 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/* NTP information - all this is backwards and documentation only */
|
||||
#define VN_SHIFT 2 /* Version - 3 bits */
|
||||
#define VN_version 3<<VN_SHIFT
|
||||
|
||||
#define LI_SHIFT 0 /* Leap Indicator LI - 2 bits */
|
||||
#define LI_no_warning (0x00<<LI_SHIFT)
|
||||
#define LI_61_sec_minute (0x01<<LI_SHIFT)
|
||||
#define LI_59_sec_minute (0x02<<LI_SHIFT)
|
||||
#define LI_alarm_condition (0x03<<LI_SHIFT)
|
||||
|
||||
#define MODE_SHIFT 5 /* Mode MODE - 3 bits */
|
||||
#define MODE_reserved (0x00<<MODE_SHIFT)
|
||||
#define MODE_sym_active (0x01<<MODE_SHIFT)
|
||||
#define MODE_sym_passive (0x02<<MODE_SHIFT)
|
||||
#define MODE_client (0x03<<MODE_SHIFT)
|
||||
#define MODE_server (0x04<<MODE_SHIFT)
|
||||
#define MODE_broadcast (0x05<<MODE_SHIFT)
|
||||
#define MODE_reserved_NTP (0x06<<MODE_SHIFT)
|
||||
#define MODE_reserved_pvt (0x07<<MODE_SHIFT)
|
||||
|
||||
#define STRAT_SHIFT 8 /* Stratum STRAT - 8 bits */
|
||||
#define STRAT_unspecified (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_ascii (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_GPS (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_ATOM (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_address (0x02<<STRAT_SHIFT)
|
||||
|
||||
#define POLL_SHIFT 16 /* eight bits */
|
||||
#define PREC_SHIFT 24 /* eight bits */
|
||||
|
||||
struct TS_ntp {
|
||||
/* unsigned int info; */
|
||||
unsigned char info[4];
|
||||
unsigned int root_delay;
|
||||
unsigned int root_disp;
|
||||
unsigned int reference_id;
|
||||
struct timespec reference_ts;
|
||||
struct timespec originate_ts;
|
||||
struct timespec receive_ts;
|
||||
struct timespec transmit_ts;
|
||||
/* char authenticator[96]; (optional) */
|
||||
};
|
||||
typedef struct TS_ntp TS_NTP;
|
||||
|
||||
|
||||
/* debug macro creation */
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l,f,v) ;
|
||||
#else
|
||||
#ifdef MAKE_DEBUG
|
||||
volatile int MAKE_DEBUG = 0;
|
||||
#define Debug(l,f,v) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#else
|
||||
#define Debug(l,f,v) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
92
src/libCom/osi/os/vxWorks/epicsDynLink.c
Normal file
92
src/libCom/osi/os/vxWorks/epicsDynLink.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* $Id $
|
||||
*
|
||||
* Comments from original version:
|
||||
* On the MIPS processor, all symbols do not have the prepended underscore.
|
||||
* Here we redefine symFindByName to look at the second character of the
|
||||
* name string.
|
||||
*
|
||||
* On various RISC processors (at least MIPS and PPC), symbols do not have
|
||||
* the prepended underscore. Here we redefine symFindByName so that, if the
|
||||
* name lookup fails and if the first character of the name is "_", the
|
||||
* lookup is repeated starting at the second character of the name string.
|
||||
*
|
||||
* 01a,08apr97,bdg created.
|
||||
* 02a,03apr97,npr changed from mips.h into symFindByNameMips.c
|
||||
* 03a,03jun98,wfl changed Mips -> EPICS and avoid architecture knowledge
|
||||
*/
|
||||
|
||||
#include "epicsDynLink.h"
|
||||
|
||||
STATUS symFindByNameEPICS(
|
||||
SYMTAB_ID symTblId,
|
||||
char *name,
|
||||
char **ppvalue,
|
||||
SYM_TYPE *pType )
|
||||
{
|
||||
static int leadingUnderscore = 1;
|
||||
static int init = 0;
|
||||
STATUS status = ERROR;
|
||||
|
||||
if (!init) {
|
||||
char *pSymValue;
|
||||
SYM_TYPE type;
|
||||
status = symFindByName ( symTblId, "symFindByNameEPICS", &pSymValue, &type );
|
||||
if (status==OK) {
|
||||
leadingUnderscore = 0;
|
||||
}
|
||||
init = 1;
|
||||
}
|
||||
|
||||
if (name[0] != '_' || leadingUnderscore) {
|
||||
status = symFindByName ( symTblId, name, ppvalue, pType );
|
||||
}
|
||||
else {
|
||||
status = symFindByName ( symTblId, (name+1), ppvalue, pType );
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
STATUS symFindByNameAndTypeEPICS(
|
||||
SYMTAB_ID symTblId,
|
||||
char *name,
|
||||
char **ppvalue,
|
||||
SYM_TYPE *pType,
|
||||
SYM_TYPE sType,
|
||||
SYM_TYPE mask )
|
||||
{
|
||||
static int leadingUnderscore = 1;
|
||||
static int init = 0;
|
||||
STATUS status = ERROR;
|
||||
|
||||
if (!init) {
|
||||
char *pSymValue;
|
||||
SYM_TYPE type;
|
||||
status = symFindByName (symTblId, "symFindByNameAndTypeEPICS", &pSymValue, &type );
|
||||
if (status==OK) {
|
||||
leadingUnderscore = 0;
|
||||
}
|
||||
init = 1;
|
||||
}
|
||||
|
||||
if (name[0] != '_' || leadingUnderscore) {
|
||||
status = symFindByNameAndType ( symTblId, name, ppvalue, pType, sType, mask );
|
||||
}
|
||||
else if (leadingUnderscore) {
|
||||
status = symFindByNameAndType ( symTblId, (name+1), ppvalue, pType, sType, mask );
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
42
src/libCom/osi/os/vxWorks/epicsDynLink.h
Normal file
42
src/libCom/osi/os/vxWorks/epicsDynLink.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* These routines will eventually need to be made OS independent
|
||||
* (currently this is vxWorks specific)
|
||||
*/
|
||||
|
||||
#ifndef epicsDynLinkh
|
||||
#define epicsDynLinkh
|
||||
|
||||
#ifdef symFindByName
|
||||
#undef symFindByName
|
||||
#endif
|
||||
|
||||
#include "vxWorks.h"
|
||||
#include "symLib.h"
|
||||
#include "sysSymTbl.h"
|
||||
|
||||
STATUS symFindByNameEPICS(
|
||||
SYMTAB_ID symTblId,
|
||||
char *name,
|
||||
char **pvalue,
|
||||
SYM_TYPE *pType);
|
||||
|
||||
STATUS symFindByNameAndTypeEPICS(
|
||||
SYMTAB_ID symTblId,
|
||||
char *name,
|
||||
char **pvalue,
|
||||
SYM_TYPE *pType,
|
||||
SYM_TYPE sType,
|
||||
SYM_TYPE mask);
|
||||
|
||||
#endif /* ifdef epicsDynLinkh */
|
||||
|
||||
106
src/libCom/osi/os/vxWorks/logMsgToErrlog.cpp
Normal file
106
src/libCom/osi/os/vxWorks/logMsgToErrlog.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* route vxWorks logMsg messages into the EPICS logging system
|
||||
*
|
||||
* Author: Jeff Hill
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errnoLib.h>
|
||||
#include <iosLib.h>
|
||||
#include <logLib.h>
|
||||
|
||||
#include "errlog.h"
|
||||
|
||||
// vxCommonLibrary calls logMsgToErrlog so that logMsgToErrlog gets loaded
|
||||
extern "C" {
|
||||
int logMsgToErrlog();
|
||||
}
|
||||
|
||||
int logMsgToErrlog() { return 0;}
|
||||
|
||||
static class errlogDevTimeInit
|
||||
{
|
||||
public:
|
||||
errlogDevTimeInit ();
|
||||
} errlogDevInstance;
|
||||
|
||||
static int errlogOpen ( DEV_HDR *, const char *, int )
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int errlogWrite ( DEV_HDR *, const char * pInBuf, int nbytes )
|
||||
{
|
||||
errlogPrintf ( "%.*s", nbytes, pInBuf );
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
errlogDevTimeInit::errlogDevTimeInit ()
|
||||
{
|
||||
int errlogNo = iosDrvInstall (
|
||||
0, // create not supported
|
||||
0, // remove not supported
|
||||
reinterpret_cast < FUNCPTR > ( errlogOpen ),
|
||||
0, // close is a noop
|
||||
0, // read not supported
|
||||
reinterpret_cast < FUNCPTR > ( errlogWrite ),
|
||||
0 // ioctl not supported
|
||||
);
|
||||
if ( errlogNo == ERROR ) {
|
||||
errlogPrintf (
|
||||
"Unable to install driver routing the vxWorks "
|
||||
"logging system to the EPICS logging system because \"%s\"\n",
|
||||
strerror ( errno ) );
|
||||
return;
|
||||
}
|
||||
DEV_HDR * pDev = static_cast < DEV_HDR * > ( calloc ( 1, sizeof ( *pDev ) ) );
|
||||
if ( ! pDev ) {
|
||||
errlogPrintf (
|
||||
"Unable to create driver data structure for routing the vxWorks "
|
||||
"logging system to the EPICS logging system because \"%s\"\n",
|
||||
strerror ( errno ) );
|
||||
return;
|
||||
}
|
||||
int status = iosDevAdd ( pDev, "/errlog/", errlogNo );
|
||||
if ( status < 0 ) {
|
||||
errlogPrintf (
|
||||
"Unable to install device routing the vxWorks "
|
||||
"logging system to the EPICS logging system because \"%s\"\n",
|
||||
strerror ( errno ) );
|
||||
free ( pDev );
|
||||
return;
|
||||
}
|
||||
int fd = open ( "/errlog/any", O_WRONLY, 0 );
|
||||
if ( fd < 0 ) {
|
||||
errlogPrintf (
|
||||
"Unable to open fd routing the vxWorks "
|
||||
"logging system to the EPICS logging system because \"%s\"\n",
|
||||
strerror ( errno ) );
|
||||
return;
|
||||
}
|
||||
status = logFdAdd ( fd );
|
||||
if ( status != OK) {
|
||||
errlogPrintf (
|
||||
"Unable to install fd routing the vxWorks "
|
||||
"logging system to the EPICS logging system because \"%s\"\n",
|
||||
strerror ( errno ) );
|
||||
close ( fd );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
495
src/libCom/osi/os/vxWorks/module_types.h
Normal file
495
src/libCom/osi/os/vxWorks/module_types.h
Normal file
@@ -0,0 +1,495 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* module_types.h */
|
||||
/* base/include $Id$ */
|
||||
/*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 12-07-88
|
||||
*/
|
||||
|
||||
#ifndef INCLmodule_typesh
|
||||
#define INCLmodule_typesh
|
||||
|
||||
/* Device module types */
|
||||
/*
|
||||
* all devices have corresponding entries in ~operator/db/src/menus.c
|
||||
* changes must be made in both areas to keep the database and drivers in sync
|
||||
*/
|
||||
/* & in comment indicates tested with card 0 */
|
||||
/* % in comment indicates tested with card other than card 0 */
|
||||
/* # in comment indicates that the Nth card has been tested */
|
||||
/* !! never been tested */
|
||||
|
||||
/*
|
||||
* @# If any changes are made to this file, check the procedures
|
||||
* ab_card, and vme_card in signallist.c, and get_address in sigmenu.c.
|
||||
*/
|
||||
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
#define MODULE_TYPES_DEF(MT_DEF_PARM) MT_DEF_PARM
|
||||
#else
|
||||
#define MODULE_TYPES_DEF(MT_DEF_PARM) extern MT_DEF_PARM;
|
||||
#endif
|
||||
|
||||
/* Number of columns used in io_report. */
|
||||
#define IOR_MAX_COLS 4
|
||||
|
||||
/* I/O types */
|
||||
#define IO_AI 0
|
||||
#define IO_AO 1
|
||||
#define IO_BI 2
|
||||
#define IO_BO 3
|
||||
#define IO_SM 4
|
||||
#define IO_WF 5
|
||||
#define IO_TIMER 6
|
||||
#define MAX_IO_TYPE IO_TIMER
|
||||
|
||||
/* bus types */
|
||||
/* must correspond to the values in link types */
|
||||
/* these defines are in ~gta/dbcon/h/link.h */
|
||||
|
||||
|
||||
/* equates for the Allen-Bradley cards. */
|
||||
#define AB_BASE_ADDR 0xc00000 /* base addr of first AB6008SV */
|
||||
#define AB_MAX_LINKS 2 /* number of serial links from VME */
|
||||
#define AB_MAX_ADAPTERS 8 /* number of physical adapters on a link */
|
||||
#define AB_MAX_CARDS 16 /* max number of IO cards per adapter */
|
||||
#define AB_CARD_ADAPTER 16 /* cards per logical adapter */
|
||||
#define AB_CHAN_CARD 16 /* max channels per card */
|
||||
|
||||
/* analog inputs */
|
||||
#define AB1771IL 0 /* &% Allen-Bradley low level analog input */
|
||||
#define AB1771IFE 1 /* &% Allen-Bradley low level analog input */
|
||||
#define AB1771IXE 2 /* &% Allen-Bradley millivolt input */
|
||||
#define XY566SE 3 /* & Xycom 12-bit Single Ended Scanned*/
|
||||
#define XY566DI 4 /* &% Xycom 12-bit Differential Scanned */
|
||||
#define XY566DIL 5 /* &% Xycom 12-bit Differential Latched */
|
||||
#define VXI_AT5_AI 6 /* % AT-5 VXI module's Analog Inputs */
|
||||
#define AB1771IFE_SE 7 /* % A-B IFE in 16 single-ended input mode */
|
||||
#define AB1771IFE_4to20MA 8 /* % A-B IFE in 8 double-ended 4to20Ma */
|
||||
#define DVX2502 9 /* &% DVX_2502 128 chan 16 bit differential */
|
||||
#define AB1771IFE_0to5V 10 /* % A-B IFE in 8 double-ended 4to20Ma */
|
||||
#define KSCV215 11 /* % KSC V215 VXI 16 bit differential */
|
||||
#define AB1771IrPlatinum 12 /* % A-B RTD Platinum */
|
||||
#define AB1771IrCopper 13 /* % A-B RTD Copper */
|
||||
#define MAX_AI_TYPES AB1771IrCopper
|
||||
MODULE_TYPES_DEF(short ai_num_cards[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={12,12,12, 4, 4, 6,32,12,12, 1, 12, 32, 12,12};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ai_num_channels[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 8, 8, 8,32,16,16, 8,16, 8, 127, 8, 32,6,6};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ai_interruptable[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,0,0};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ai_bus[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 4, 4, 4, 2, 2, 2, 2, 4, 4, 2, 4, 2,4,4};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short ai_addrs[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0,0,0,0x6000,0x7000,0xe000, 0xc014,0,0, 0xff00, 0, 0,0,0};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(long ai_memaddrs[MAX_AI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={0,0,0,0x000000,0x040000,0x0c0000, 0,0,0, 0x100000, 0, 0,0,0};
|
||||
#endif
|
||||
|
||||
/* analog outputs */
|
||||
#define AB1771OFE 0 /* &% Allen-Bradley 12 bit Analog Output */
|
||||
#define VMI4100 1 /* & VMIC VMIVME 4100 */
|
||||
#define ZIO085 2 /* & Ziomek 085 */
|
||||
#define VXI_AT5_AO 3 /* !! AT-5 VXI modules analog outputs */
|
||||
#define MAX_AO_TYPES VXI_AT5_AO
|
||||
MODULE_TYPES_DEF(short ao_num_cards[MAX_AO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= {12, 4, 1, 32};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ao_num_channels[MAX_AO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= { 4, 16, 32, 16};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ao_interruptable[MAX_AO_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= { 0, 0, 0, 1};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short ao_bus[MAX_AO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 4, 2, 2, 2};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short ao_addrs[MAX_AO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0,0x4100,0x0800, 0xc000};
|
||||
#endif
|
||||
|
||||
/* binary inputs */
|
||||
#define ABBI_08_BIT 0 /* &% Allen-Bradley generic Binary In 8 bit */
|
||||
#define ABBI_16_BIT 1 /* &% Allen-Bradley generic Binary In 16 bit */
|
||||
#define BB910 2 /* & BURR BROWN MPV 910 (relay) */
|
||||
#define XY210 3 /* &% XYcom 32 bit binary in */
|
||||
#define VXI_AT5_BI 4 /* !! AT-5 VXI modules binary inputs */
|
||||
#define HPE1368A_BI 5 /* !! HP E1368A video switch */
|
||||
#define AT8_FP10S_BI 6 /* !! AT8 FP10 slave fast protect */
|
||||
#define XY240_BI 7 /* !! Xycom 32 bit binary in / 32 bit binary out */
|
||||
#define MAX_BI_TYPES XY240_BI
|
||||
MODULE_TYPES_DEF(short bi_num_cards[MAX_BI_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 12, 12, 4, 4, 32, 32, 8, 2};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bi_num_channels[MAX_BI_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 8, 16, 32, 32, 32, 16, 32, 32};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bi_interruptable[MAX_BI_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 1, 1, 0, 0, 1, 1, 1, 1};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bi_bus[MAX_BI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 4, 4, 2, 2, 2, 2, 2, 2};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short bi_addrs[MAX_BI_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0,0,0xb800,0xa000, 0xc000, 0xc000, 0x0e00, 0xd000};
|
||||
#endif
|
||||
|
||||
/* binary outputs */
|
||||
#define ABBO_08_BIT 0 /* &% Allen-Bradley 8 bit binary out */
|
||||
#define ABBO_16_BIT 1 /* &% Allen-Bradley 16 bit binary out */
|
||||
#define BB902 2 /* &% BURR BROWN MPV 902 (relay) */
|
||||
#define XY220 3 /* &% XYcom 32 bit binary out */
|
||||
#define VXI_AT5_BO 4 /* !! AT-5 VXI modules binary outputs */
|
||||
#define HPE1368A_BO 5 /* !! HP E1368A video switch */
|
||||
#define AT8_FP10M_BO 6 /* !! AT8 FP10 master fast protect */
|
||||
#define XY240_BO 7 /* !! Xycom 32 bit binary in / 32 bit binary out */
|
||||
#define MAX_BO_TYPES XY240_BO
|
||||
MODULE_TYPES_DEF(short bo_num_cards[MAX_BO_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={12, 12, 4, 1, 32, 32, 2, 2};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bo_num_channels[MAX_BO_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 8, 16, 32, 32, 32, 16, 32, 32};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bo_interruptable[MAX_BO_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0, 0, 0, 0, 1, 0, 0, 1 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short bo_bus[MAX_BO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 4, 4, 2, 2, 2, 2, 2, 2 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short bo_addrs[MAX_BO_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0,0,0xd800,0xc800, 0xc000, 0xc000, 0x0c00, 0xd000};
|
||||
#endif
|
||||
|
||||
/* stepper motor drivers */
|
||||
#define CM57_83E 0 /* & Compumotor 57-83E motor controller */
|
||||
#define OMS_6AXIS 1 /* & OMS six axis motor controller */
|
||||
#define MAX_SM_TYPES OMS_6AXIS
|
||||
MODULE_TYPES_DEF(short sm_num_cards[MAX_SM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 8, 8 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short sm_num_channels[MAX_SM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= { 1, 8};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short sm_interruptable[MAX_SM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= { 0, 0 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short sm_bus[MAX_SM_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 2, 2 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short sm_addrs[MAX_SM_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 0x8000, 0xfc00 };
|
||||
#endif
|
||||
|
||||
/* waveforms */
|
||||
#define XY566WF 0 /* & Xycom 566 as a waveform */
|
||||
#define CAMAC_THING 1 /* !! CAMAC waveform digitizer */
|
||||
#define JGVTR1 2 /* & Joerger transient recorder */
|
||||
#define COMET 3 /* !! COMET transient recorder */
|
||||
#define MAX_WF_TYPES COMET
|
||||
MODULE_TYPES_DEF(short wf_num_cards[MAX_WF_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={4, 4, 8, 4};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short wf_num_channels[MAX_WF_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={1, 1, 1, 4};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short wf_interruptable[MAX_WF_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= {0, 0, 0, 0};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short wf_bus[MAX_WF_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={2, 3, 2, 2};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short wf_addrs[MAX_WF_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={0x9000, 0, 0xB000, 0xbc00};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short wf_armaddrs[MAX_WF_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= {0x5400, 0, 0, 0};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(long wf_memaddrs[MAX_WF_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={0x080000, 0, 0xb80000, 0xe0000000};
|
||||
#endif
|
||||
|
||||
|
||||
/* timing cards */
|
||||
#define MZ8310 0 /* &% Mizar Timing Module */
|
||||
#define DG535 1 /* !! GPIB timing instrument */
|
||||
#define VXI_AT5_TIME 2 /* !! AT-5 VXI modules timing channels */
|
||||
#define MAX_TM_TYPES VXI_AT5_TIME
|
||||
MODULE_TYPES_DEF(short tm_num_cards[MAX_TM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 4, 1, 32 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short tm_num_channels[MAX_TM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={10, 1, 10};
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short tm_interruptable[MAX_TM_TYPES+1] )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= { 1, 0, 1 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short tm_bus[MAX_TM_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={ 2, 5, 2 };
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned short tm_addrs[MAX_TM_TYPES+1])
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
={0xf800, 0, 0xc000 };
|
||||
#endif
|
||||
|
||||
/* AT830X clock cards */
|
||||
MODULE_TYPES_DEF(long AT830X_1_addrs )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x0400;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short AT830X_1_num_cards )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 2;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(long AT830X_addrs )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0xaa0000;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(short AT830X_num_cards )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 2;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* system controller cards.
|
||||
* (driver looks for only one card)
|
||||
*/
|
||||
MODULE_TYPES_DEF(long xy010ScA16Base)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x0000;
|
||||
#endif
|
||||
/*
|
||||
* limit the size of the VXI logical address space
|
||||
*
|
||||
* <VXI LA BASE> = <VME SHORT ADDR BASE> + 0xc000
|
||||
*
|
||||
* LA VME address
|
||||
* 0 <VXI LA BASE>
|
||||
* EPICS_VXI_LA_COUNT <VXI LA BASE> + (EPICS_VXI_LA_COUNT-1)*64
|
||||
*/
|
||||
MODULE_TYPES_DEF(unsigned char EPICS_VXI_LA_COUNT)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 32;
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* address ranges for VXI A24 and A32 devices
|
||||
*
|
||||
*/
|
||||
MODULE_TYPES_DEF(char *EPICS_VXI_A24_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= (char *) 0x900000;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned long EPICS_VXI_A24_SIZE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x100000;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(char *EPICS_VXI_A32_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= (char *) 0x90000000;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(unsigned long EPICS_VXI_A32_SIZE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x10000000;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Interrupt vector locations used by the MV167 CPU board.
|
||||
* These are defined in mv167.h
|
||||
*
|
||||
* PCC2_INT_VEC_BASE 0x40 PCC interrupt vector base number
|
||||
* any multiple of 0x10
|
||||
* UTIL_INT_VEC_BASE0 0x50 VMEchip2 utility interrupt
|
||||
* vector base number
|
||||
* any multiple of 0x10
|
||||
* UTIL_INT_VEC_BASE1 0x60 VMEchip2 utility interrupt
|
||||
* vector base number
|
||||
* any multiple of 0x10
|
||||
*
|
||||
* INT_VEC_CD2400_A 0x90 int vec for channel A
|
||||
* INT_VEC_CD2400_B 0x94 int vec for channel B
|
||||
* INT_VEC_CD2400_C 0x98 int vec for channel C
|
||||
* INT_VEC_CD2400_D 0x9c int vec for channel D
|
||||
*
|
||||
* LANC_IRQ_LEVEL 3 LNANC IRQ level
|
||||
* MPCC_IRQ_LEVEL 4 serial comm IRQ level
|
||||
* SYS_CLK_LEVEL 6 interrupt level for sysClk
|
||||
* AUX_CLK_LEVEL 5 interrupt level for auxClk
|
||||
* SCSI_IRQ_LEVEL 2 scsi interrupt level
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* interrupt vector allocation - one for each XY566 DIL card */
|
||||
MODULE_TYPES_DEF(int AI566_VNUM)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xf8; /* Xycom 566 Differential Latched */
|
||||
#endif
|
||||
|
||||
/* interrupt vector allocation - one for each DVX card */
|
||||
MODULE_TYPES_DEF(int DVX_IVEC0)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xd0;
|
||||
#endif
|
||||
|
||||
/* stepper motor interrupt vector - one for each motor */
|
||||
MODULE_TYPES_DEF(int MD_INT_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xf0; /* base of the motor int vector */
|
||||
#endif
|
||||
|
||||
/* I reserve from here up to num_cards * 4 interrupting chans/card - joh */
|
||||
MODULE_TYPES_DEF(int MZ8310_INT_VEC_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xe8;
|
||||
#endif
|
||||
|
||||
/* Allen-Bradley Serial Driver - MAX_AB_LINKS number of vectors */
|
||||
MODULE_TYPES_DEF(int AB_VEC_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0x60;
|
||||
#endif
|
||||
|
||||
/* only one interrupt vector allocated for all Joerger VTR1 boards joh */
|
||||
MODULE_TYPES_DEF(int JGVTR1_INT_VEC)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xe0;
|
||||
#endif
|
||||
|
||||
/* AT830X_1 cards have 1 intr vector for each AT830X_1_num_cards (presently 2) */
|
||||
MODULE_TYPES_DEF(int AT830X_1_IVEC0)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xd4;
|
||||
#endif
|
||||
|
||||
/* AT830X cards have 1 intr vector for each AT830X_num_cards (presently 2) */
|
||||
MODULE_TYPES_DEF(int AT830X_IVEC0)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xd6;
|
||||
#endif
|
||||
|
||||
/* AT8 fast protect interrupt vector base */
|
||||
MODULE_TYPES_DEF(int AT8FP_IVEC_BASE)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xa2;
|
||||
#endif
|
||||
|
||||
|
||||
MODULE_TYPES_DEF(int AT8FPM_IVEC_BASE )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=0xaa;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Addresses and IRQ information used by the XVME402 bitbus cards.
|
||||
*
|
||||
******************************************************************************/
|
||||
MODULE_TYPES_DEF(unsigned short BB_SHORT_OFF )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x1800; /* the first address of link 0's region */
|
||||
#endif
|
||||
#define BB_NUM_LINKS 4 /* max number of BB ports allowed */
|
||||
MODULE_TYPES_DEF(int BB_IVEC_BASE )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0xa0; /* vectored interrupts (2 used for each link) */
|
||||
#endif
|
||||
MODULE_TYPES_DEF(int BB_IRQ_LEVEL )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 5; /* IRQ level */
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Information for the PEP modular Bitbus boards.
|
||||
*
|
||||
******************************************************************************/
|
||||
MODULE_TYPES_DEF(unsigned short PEP_BB_SHORT_OFF )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x1c00;
|
||||
#endif
|
||||
MODULE_TYPES_DEF(int PEP_BB_IVEC_BASE )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0xe8;
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Addresses and IRQ information used by the NI1014 and NI1014D bitbus cards.
|
||||
*
|
||||
******************************************************************************/
|
||||
MODULE_TYPES_DEF(unsigned short NIGPIB_SHORT_OFF)
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 0x5000;/* First address of link 0's region */
|
||||
#endif
|
||||
/* Each link uses 0x0200 bytes */
|
||||
#define NIGPIB_NUM_LINKS 4 /* Max number of NI GPIB ports allowed */
|
||||
MODULE_TYPES_DEF(int NIGPIB_IVEC_BASE )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
= 100; /* Vectored interrupts (2 used for each link) */
|
||||
#endif
|
||||
MODULE_TYPES_DEF(int NIGPIB_IRQ_LEVEL )
|
||||
#ifdef MODULE_TYPES_INIT
|
||||
=5; /* IRQ level */
|
||||
#endif
|
||||
|
||||
#if 0 /* JRW */
|
||||
#define NI1014_LINK_NUM_BASE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* nothing after this endif
|
||||
*/
|
||||
#endif /*INCLmodule_typesh*/
|
||||
185
src/libCom/osi/os/vxWorks/task_params.h
Normal file
185
src/libCom/osi/os/vxWorks/task_params.h
Normal file
@@ -0,0 +1,185 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
/* Parameters for tasks on IOC */
|
||||
/*
|
||||
* Authors: Andy Kozubal, Jeff Hill, and Bob Dalesio
|
||||
* Date: 2-24-89
|
||||
*/
|
||||
|
||||
#ifndef INCtaskLibh
|
||||
#include <taskLib.h>
|
||||
#endif
|
||||
|
||||
#define VXTASKIDSELF 0
|
||||
|
||||
/* Task Names */
|
||||
#define EVENTSCAN_NAME "scanEvent"
|
||||
#define SCANONCE_NAME "scanOnce"
|
||||
#define SMCMD_NAME "smCommand"
|
||||
#define SMRESP_NAME "smResponse"
|
||||
#define ABDONE_NAME "abDone"
|
||||
#define ABSCAN_NAME "abScan"
|
||||
#define ABCOS_NAME "abBiCosScanner"
|
||||
#define MOMENTARY_NAME "momentary"
|
||||
#define WFDONE_NAME "wfDone"
|
||||
#define SEQUENCER_NAME "sequencer"
|
||||
#define BKPT_CONT_NAME "bkptCont"
|
||||
#define SCANNER_NAME "scanner"
|
||||
#define REQ_SRVR_NAME "CA_TCP"
|
||||
#define CA_CLIENT_NAME "CA_client"
|
||||
#define CA_EVENT_NAME "CA_event"
|
||||
#define CAST_SRVR_NAME "CA_UDP"
|
||||
#define CA_REPEATER_NAME "CA_repeater"
|
||||
#define CA_ONLINE_NAME "CA_online"
|
||||
#define TASKWD_NAME "taskwd"
|
||||
#define SMIOTEST_NAME "smInout"
|
||||
#define SMROTTEST_NAME "smRotate"
|
||||
#define EVENT_PEND_NAME "event_task"
|
||||
#define XY240_NAME "xy_240_scan"
|
||||
#define GPIBLINK_NAME "gpibLink"
|
||||
#define BBLINK_NAME "bbLinkTask"
|
||||
#define BBTXLINK_NAME "bbTx"
|
||||
#define BBRXLINK_NAME "bbRx"
|
||||
#define BBWDTASK_NAME "bbwd"
|
||||
#define ERRLOG_NAME "errlog"
|
||||
#define LOG_RESTART_NAME "logRestart"
|
||||
|
||||
/* Task priorities */
|
||||
#define SCANONCE_PRI 129 /* scan one time */
|
||||
/*DO NOT RUN ANY RECORD PROCESSING TASKS AT HIGHER PRIORITY THAN _netTask=50*/
|
||||
#define CALLBACK_PRI_LOW 140 /* callback task - generall callback task */
|
||||
#define CALLBACK_PRI_MEDIUM 135 /* callback task - generall callback task */
|
||||
#define CALLBACK_PRI_HIGH 128 /* callback task - generall callback task */
|
||||
#define EVENTSCAN_PRI 129 /* Event Scanner - Runs on a global event */
|
||||
#define SMCMD_PRI 120 /* Stepper Motor Command Task - Waits for cmds */
|
||||
#define SMRESP_PRI 121 /* Stepper Motor Resp Task - Waits for resps */
|
||||
#define ABCOS_PRI 121 /* Allen-Bradley Binary Input COS io_event wakeup */
|
||||
#define ABDONE_PRI 122 /* Allen-Bradley Resp Task - Interrupt Driven */
|
||||
#define ABSCAN_PRI 123 /* Allen-Bradley Scan Task - Base Rate .1 secs */
|
||||
#define BBLINK_PRI 124
|
||||
#define BBWDTASK_PRI 123 /* BitBus watchdog task */
|
||||
#define BBRXLINK_PRI 124 /* BitBus link task */
|
||||
#define BBTXLINK_PRI 125 /* BitBus link task */
|
||||
#define GPIBLINK_PRI 125 /* GPIB link task */
|
||||
#define MOMENTARY_PRI 126 /* Momentary output - posted from watchdog */
|
||||
#define WFDONE_PRI 127 /* Waveform Task - Base Rate of .1 second */
|
||||
#define PERIODSCAN_PRI 139 /* Periodic Scanners - Slowest rate */
|
||||
#define DB_CA_PRI 149 /*database to channel access*/
|
||||
#define SEQUENCER_PRI 151
|
||||
#define XY240_PRI 160 /* xy 240 dio scanner */
|
||||
#define SCANNER_PRI 170
|
||||
#define REQ_SRVR_PRI 181 /* Channel Access TCP request server*/
|
||||
#define CA_CLIENT_PRI 180 /* Channel Access clients */
|
||||
#define CA_REPEATER_PRI 181 /* Channel Access repeater */
|
||||
#define ERRLOG_PRI CA_REPEATER_PRI /*error logger task*/
|
||||
#define CAST_SRVR_PRI 182 /* Channel Access broadcast server */
|
||||
#define CA_ONLINE_PRI 183 /* Channel Access server online notify */
|
||||
#define TASKWD_PRI 200 /* Watchdog Scan Task - runs every 6 seconds */
|
||||
#define SMIOTEST_PRI 205 /* Stepper Mtr in/out test - runs every .1 sec */
|
||||
#define SMROTTEST_PRI 205 /* Stepper Mtr rotate test - runs every .1 sec */
|
||||
#define LOG_RESTART_PRI 200 /* Log server connection watch dog */
|
||||
|
||||
/* Task delay times (seconds) */
|
||||
#define TASKWD_DELAY 6
|
||||
|
||||
/* Task delay times (tics) */
|
||||
#define ABSCAN_RATE (sysClkRateGet()/6)
|
||||
#define SEQUENCER_DELAY (sysClkRateGet()/5)
|
||||
#define SCANNER_DELAY (sysClkRateGet()/5)
|
||||
#define CA_ONLINE_DELAY (sysClkRateGet()*15)
|
||||
#define LOG_RESTART_DELAY (sysClkRateGet()*30)
|
||||
|
||||
/* Task creation options */
|
||||
#define ERRLOG_OPT VX_FP_TASK
|
||||
#define EVENTSCAN_OPT VX_FP_TASK
|
||||
#define SCANONCE_OPT VX_FP_TASK
|
||||
#define CALLBACK_OPT VX_FP_TASK
|
||||
#define SMCMD_OPT VX_FP_TASK
|
||||
#define SMRESP_OPT VX_FP_TASK
|
||||
#define ABDONE_OPT VX_FP_TASK
|
||||
#define ABCOS_OPT VX_FP_TASK
|
||||
#define ABSCAN_OPT VX_FP_TASK
|
||||
#define MOMENTARY_OPT VX_FP_TASK
|
||||
#define PERIODSCAN_OPT VX_FP_TASK
|
||||
#define WFDONE_OPT VX_FP_TASK
|
||||
#define SEQUENCER_OPT VX_FP_TASK | VX_STDIO
|
||||
#define BKPT_CONT_OPT VX_FP_TASK
|
||||
#define SCANNER_OPT VX_FP_TASK
|
||||
#define REQ_SRVR_OPT VX_FP_TASK
|
||||
#define CAST_SRVR_OPT VX_FP_TASK
|
||||
#define CA_CLIENT_OPT VX_FP_TASK
|
||||
#define CA_REPEATER_OPT VX_FP_TASK
|
||||
#define CA_ONLINE_OPT VX_FP_TASK
|
||||
#define TASKWD_OPT VX_FP_TASK
|
||||
#define SMIOTEST_OPT VX_FP_TASK
|
||||
#define SMROTTEST_OPT VX_FP_TASK
|
||||
#define EVENT_PEND_OPT VX_FP_TASK
|
||||
#define GPIBLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBTXLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBRXLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBWDTASK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define DB_CA_OPT (VX_FP_TASK | VX_STDIO)
|
||||
#define XY_240_OPT (0) /* none */
|
||||
#define LOG_RESTART_OPT (VX_FP_TASK)
|
||||
|
||||
|
||||
/*
|
||||
* Task stack sizes
|
||||
*
|
||||
* (original stack sizes are appropriate for the 68k)
|
||||
* ARCH_STACK_FACTOR allows scaling the stacks on particular
|
||||
* processor architectures
|
||||
*/
|
||||
#if CPU_FAMILY == MC680X0
|
||||
#define ARCH_STACK_FACTOR 1
|
||||
#elif CPU_FAMILY == SPARC
|
||||
#define ARCH_STACK_FACTOR 2
|
||||
#else
|
||||
#define ARCH_STACK_FACTOR 2
|
||||
#endif
|
||||
|
||||
#define ERRLOG_STACK (4000*ARCH_STACK_FACTOR)
|
||||
#define EVENTSCAN_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define SCANONCE_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define CALLBACK_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define SMCMD_STACK (3000*ARCH_STACK_FACTOR)
|
||||
#define SMRESP_STACK (3000*ARCH_STACK_FACTOR)
|
||||
#define ABCOS_STACK (3000*ARCH_STACK_FACTOR)
|
||||
#define ABDONE_STACK (3000*ARCH_STACK_FACTOR)
|
||||
#define ABSCAN_STACK (3000*ARCH_STACK_FACTOR)
|
||||
#define MOMENTARY_STACK (2000*ARCH_STACK_FACTOR)
|
||||
#define PERIODSCAN_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define WFDONE_STACK (9000*ARCH_STACK_FACTOR)
|
||||
#define SEQUENCER_STACK (5500*ARCH_STACK_FACTOR)
|
||||
#define BKPT_CONT_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define SCANNER_STACK (3048*ARCH_STACK_FACTOR)
|
||||
#define RSP_SRVR_STACK (5096*ARCH_STACK_FACTOR)
|
||||
#define REQ_SRVR_STACK (5096*ARCH_STACK_FACTOR)
|
||||
#define CAST_SRVR_STACK (5096*ARCH_STACK_FACTOR)
|
||||
#define CA_CLIENT_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define CA_REPEATER_STACK (5096*ARCH_STACK_FACTOR)
|
||||
#define CA_ONLINE_STACK (3048*ARCH_STACK_FACTOR)
|
||||
#define TASKWD_STACK (2000*ARCH_STACK_FACTOR)
|
||||
#define SMIOTEST_STACK (2000*ARCH_STACK_FACTOR)
|
||||
#define SMROTTEST_STACK (2000*ARCH_STACK_FACTOR)
|
||||
#define EVENT_PEND_STACK (5096*ARCH_STACK_FACTOR)
|
||||
#define TIMESTAMP_STACK (4000*ARCH_STACK_FACTOR)
|
||||
#define GPIBLINK_STACK (5000*ARCH_STACK_FACTOR)
|
||||
#define BBLINK_STACK (5000*ARCH_STACK_FACTOR)
|
||||
#define BBRXLINK_STACK (5000*ARCH_STACK_FACTOR)
|
||||
#define BBTXLINK_STACK (5000*ARCH_STACK_FACTOR)
|
||||
#define BBWDTASK_STACK (5000*ARCH_STACK_FACTOR)
|
||||
#define DB_CA_STACK (11000*ARCH_STACK_FACTOR)
|
||||
#define XY_240_STACK (4096*ARCH_STACK_FACTOR)
|
||||
#define LOG_RESTART_STACK (0x1000*ARCH_STACK_FACTOR)
|
||||
|
||||
227
src/libCom/osi/os/vxWorks/veclist.c
Normal file
227
src/libCom/osi/os/vxWorks/veclist.c
Normal file
@@ -0,0 +1,227 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* $Id$
|
||||
* @(#)veclist.c 1.10
|
||||
*
|
||||
* list fuctions attached to the interrupt vector table
|
||||
*
|
||||
* Created 28Mar89 Jeffrey O. Hill
|
||||
* johill@lanl.gov
|
||||
* (505) 665 1831
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* makefile
|
||||
*
|
||||
*
|
||||
* V5VW = /.../vx/v502b
|
||||
*
|
||||
* veclist.o:
|
||||
* cc68k -c -DCPU_FAMILY=MC680X0 -I$(V5VW)/h veclist.c
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "vxWorks.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "intLib.h"
|
||||
#include "vxLib.h"
|
||||
#include "iv.h"
|
||||
#include "ctype.h"
|
||||
#include "sysSymTbl.h"
|
||||
|
||||
static char *sccsID =
|
||||
"@(#) $Id$";
|
||||
|
||||
/*
|
||||
*
|
||||
* VME bus dependent
|
||||
*
|
||||
*/
|
||||
#define NVEC 0x100
|
||||
|
||||
static char *ignore_list[] = {"_excStub","_excIntStub"};
|
||||
|
||||
int veclist(int);
|
||||
int cISRTest(FUNCPTR proutine, FUNCPTR *ppisr, void **pparam);
|
||||
static void *fetch_pointer(unsigned char *);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* veclist()
|
||||
*
|
||||
*/
|
||||
int veclist(int all)
|
||||
{
|
||||
int vec;
|
||||
int value;
|
||||
SYM_TYPE type;
|
||||
char name[MAX_SYS_SYM_LEN];
|
||||
char function_type[10];
|
||||
FUNCPTR proutine;
|
||||
FUNCPTR pCISR;
|
||||
int cRoutine;
|
||||
void *pparam;
|
||||
int status;
|
||||
unsigned i;
|
||||
|
||||
for(vec=0; vec<NVEC; vec++){
|
||||
proutine = intVecGet((FUNCPTR *)INUM_TO_IVEC(vec));
|
||||
|
||||
status = cISRTest(proutine, &pCISR, &pparam);
|
||||
if(status == OK){
|
||||
cRoutine = TRUE;
|
||||
proutine = pCISR;
|
||||
strcpy(function_type, "C");
|
||||
}
|
||||
else{
|
||||
cRoutine = FALSE;
|
||||
strcpy(function_type, "MACRO");
|
||||
pCISR = NULL;
|
||||
}
|
||||
|
||||
status = symFindByValue(
|
||||
sysSymTbl,
|
||||
(int)proutine,
|
||||
name,
|
||||
&value,
|
||||
&type);
|
||||
if(status<0 || value != (int)proutine){
|
||||
sprintf(name, "0x%X", (unsigned int) proutine);
|
||||
}
|
||||
else if(!all){
|
||||
int match = FALSE;
|
||||
|
||||
for(i=0; i<NELEMENTS(ignore_list); i++){
|
||||
if(!strcmp(ignore_list[i],name)){
|
||||
match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(match){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
printf( "vec 0x%02X %5s ISR %s",
|
||||
vec,
|
||||
function_type,
|
||||
name);
|
||||
if(cRoutine){
|
||||
printf("(0x%X)", (unsigned int) pparam);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* cISRTest()
|
||||
*
|
||||
* test to see if a C routine is attached
|
||||
* to this interrupt vector
|
||||
*/
|
||||
#define ISR_PATTERN 0xaaaaaaaa
|
||||
#define PARAM_PATTERN 0x55555555
|
||||
int cISRTest(FUNCPTR proutine, FUNCPTR *ppisr, void **pparam)
|
||||
{
|
||||
static FUNCPTR handler = NULL;
|
||||
STATUS status;
|
||||
unsigned char *pchk;
|
||||
unsigned char *pref;
|
||||
unsigned char val;
|
||||
int found_isr;
|
||||
int found_param;
|
||||
|
||||
if(handler == NULL){
|
||||
#if CPU_FAMILY != PPC
|
||||
handler = (FUNCPTR) intHandlerCreate(
|
||||
(FUNCPTR) ISR_PATTERN,
|
||||
PARAM_PATTERN);
|
||||
#endif
|
||||
if(handler == NULL){
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
found_isr = FALSE;
|
||||
found_param = FALSE;
|
||||
pchk = (unsigned char *) proutine;
|
||||
pref = (unsigned char *) handler;
|
||||
for( ;
|
||||
found_isr==FALSE || found_param==FALSE;
|
||||
pchk++, pref++){
|
||||
|
||||
status = vxMemProbe(
|
||||
(char *) pchk,
|
||||
READ,
|
||||
sizeof(val),
|
||||
(char *) &val);
|
||||
if(status < 0){
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if(val != *pref){
|
||||
if(*pref == (unsigned char) ISR_PATTERN){
|
||||
*ppisr = (FUNCPTR) fetch_pointer(pchk);
|
||||
pref += sizeof(*ppisr)-1;
|
||||
pchk += sizeof(*ppisr)-1;
|
||||
found_isr = TRUE;
|
||||
}
|
||||
else if(*pref == (unsigned char) PARAM_PATTERN){
|
||||
*pparam = fetch_pointer(pchk);
|
||||
pref += sizeof(*pparam)-1;
|
||||
pchk += sizeof(*pparam)-1;
|
||||
found_param = TRUE;
|
||||
}
|
||||
else{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* fetch_pointer()
|
||||
*
|
||||
* fetch pointer given low byte with correct byte ordering
|
||||
*
|
||||
*/
|
||||
struct char_array{
|
||||
unsigned char byte[4];
|
||||
};
|
||||
union pointer{
|
||||
void *ptr_overlay;
|
||||
struct char_array char_overlay;
|
||||
};
|
||||
|
||||
LOCAL
|
||||
void *fetch_pointer(unsigned char *plow_byte)
|
||||
{
|
||||
union pointer p;
|
||||
size_t i;
|
||||
|
||||
for(i=0; i < sizeof(p); i++){
|
||||
p.char_overlay.byte[i] = plow_byte[i];
|
||||
}
|
||||
|
||||
return p.ptr_overlay;
|
||||
}
|
||||
35
src/libCom/osi/os/vxWorks/vxComLibrary.c
Normal file
35
src/libCom/osi/os/vxWorks/vxComLibrary.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*vxComLibrary.c */
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* Author: Marty Kraimer
|
||||
* August 2003
|
||||
*/
|
||||
|
||||
/* The purpose of this module is to force various vxWorks specific
|
||||
* modules top be loaded
|
||||
*/
|
||||
|
||||
extern void iocClockInit(void);
|
||||
#include "drvTS.h"
|
||||
#include "epicsDynLink.h"
|
||||
extern int logMsgToErrlog(void);
|
||||
extern int veclist(int);
|
||||
|
||||
void vxComLibrary(int callit)
|
||||
{
|
||||
|
||||
|
||||
if(callit) iocClockInit();
|
||||
if(callit) TSinit();
|
||||
if(callit) symFindByNameEPICS(0,0,0,0);
|
||||
if(callit) logMsgToErrlog();
|
||||
if(callit) veclist(0);
|
||||
}
|
||||
Reference in New Issue
Block a user