32 typedef void myISR (
void *pParam);
39 static char *defaultHandlerNames[] = {
42 "unsolicitedHandlerEPICS"};
47 static myISR *isrFetch(
unsigned vectorNumber);
58 int cISRTest(
void (*)(),
void (**)(),
void **);
65 # define VME_AM_CSR (0x2f) 77 #define EPICSAddrTypeNoConvert -1 89 static void initHandlerAddrList(
void);
97 size_t logicalAddress,
size_t size,
volatile void **ppPhysicalAddress);
103 static long vxDevReadProbe (
unsigned wordSize,
volatile const void *ptr,
void *pValue);
109 static long vxDevWriteProbe (
unsigned wordSize,
volatile void *ptr,
const void *pValue);
111 static void *devA24Malloc(
size_t size);
112 static void devA24Free(
void *pBlock);
115 static int (*sysIntEnableFunc)(int) =
NULL;
116 static int (*sysIntDisableFunc)(int) =
NULL;
117 static int (*sysIntEnablePICFunc)(int) =
NULL;
118 static int (*sysIntDisablePICFunc)(int) =
NULL;
120 static long devInit(
void)
129 static long vxDevConnectInterruptVME (
130 unsigned vectorNumber,
134 static long vxDevDisconnectInterruptVME (
135 unsigned vectorNumber,
139 static long vxDevEnableInterruptLevelVME (
unsigned level);
141 static long vxDevDisableInterruptLevelVME (
unsigned level);
143 static int vxDevInterruptInUseVME (
unsigned vectorNumber);
149 vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe,
150 vxDevConnectInterruptVME, vxDevDisconnectInterruptVME,
151 vxDevEnableInterruptLevelVME, vxDevDisableInterruptLevelVME,
152 devA24Malloc,devA24Free,devInit,vxDevInterruptInUseVME
161 static long vxDevConnectInterruptVME (
162 unsigned vectorNumber,
173 (
void *)INUM_TO_IVEC(vectorNumber),
194 static long vxDevDisconnectInterruptVME (
195 unsigned vectorNumber,
202 # if CPU_FAMILY == PPC 210 psub = isrFetch(vectorNumber);
211 if(psub != pFunction){
216 (
void *)INUM_TO_IVEC(vectorNumber),
229 static long vxDevEnableInterruptLevelVME (
unsigned level)
231 if (sysIntEnableFunc) {
233 s = sysIntEnableFunc (level);
248 if (sysIntEnablePICFunc) {
250 s = sysIntEnablePICFunc (level);
265 if (sysIntDisablePICFunc) {
267 s = sysIntDisablePICFunc (level);
281 static long vxDevDisableInterruptLevelVME (
unsigned level)
283 if (sysIntDisableFunc) {
285 s = sysIntDisableFunc (level);
299 size_t logicalAddress,
size_t size,
volatile void **ppPhysicalAddress)
303 if (ppPhysicalAddress==
NULL) {
309 *ppPhysicalAddress = (
void *) logicalAddress;
314 (
char *) logicalAddress, (
char **)ppPhysicalAddress);
327 static long vxDevReadProbe (
unsigned wordSize,
volatile const void *ptr,
void *pValue)
331 status = vxMemProbe ((
char *)ptr, VX_READ, wordSize, (
char *) pValue);
343 static long vxDevWriteProbe (
unsigned wordSize,
volatile void *ptr,
const void *pValue)
347 status = vxMemProbe ((
char *)ptr, VX_WRITE, wordSize, (
char *) pValue);
358 static myISR *isrFetch(
unsigned vectorNumber)
368 psub = (
myISR *) intVecGet((FUNCPTR *)INUM_TO_IVEC(vectorNumber));
378 s =
cISRTest(psub, &pCISR, &pParam);
390 static int vxDevInterruptInUseVME (
unsigned vectorNumber)
392 #if CPU_FAMILY == PPC 401 initHandlerAddrList();
405 psub = isrFetch (vectorNumber);
410 for (i=0; i<
NELEMENTS(defaultHandlerAddr); i++) {
411 if (defaultHandlerAddr[i] == psub) {
438 "%s: line=%d: Interrupt to EPICS disconnected vector = 0X %X",
447 #if CPU_FAMILY != PPC 455 void initHandlerAddrList(
void)
459 for (i=0; i<
NELEMENTS(defaultHandlerNames); i++) {
461 if(!defaultHandlerAddr[i]) {
466 "initHandlerAddrList() %s not in sym table",
467 defaultHandlerNames[i]);
479 static void * (*A24MallocFunc)(size_t) =
NULL;
480 static void (*A24FreeFunc)(
void *) =
NULL;
482 static void *devA24Malloc(
size_t size)
484 static int UsingBSP = 0;
487 if (A24MallocFunc ==
NULL)
492 A24MallocFunc = malloc;
498 A24MallocFunc = malloc;
505 ret = A24MallocFunc(size);
507 if ((ret ==
NULL) && (UsingBSP))
513 static void devA24Free(
void *pBlock)
epicsAddressType
The available bus address types.
#define errMessage(S, PM)
void unsolicitedHandlerEPICS(int vectorNumber)
int cISRTest(void(*)(), void(**)(), void **)
long devDisableInterruptLevelISA(unsigned level)
#define S_dev_noMemory
Memory allocation failed.
#define S_dev_noDevice
No device at specified address.
void errPrintf(long status, const char *pFileName, int lineno, const char *pformat,...)
int devInterruptInUseVME(unsigned level)
Determine if a VME interrupt vector is in use.
#define S_dev_vectorNotInUse
Interrupt vector not in use by caller.
#define S_dev_intDissFail
Unable to disable interrupt level.
#define S_dev_vecInstlFail
Interrupt vector install failed.
long devEnableInterruptLevelISA(unsigned level)
devLibVME * pdevLibVME
Pointer to the entry table used by devLibVME routines.
int EPICStovxWorksAddrType[]
#define S_dev_vectorInUse
Interrupt vector in use.
A table of function pointers for devLibVME implementations.
LIBCOM_API void *epicsStdCall epicsFindSymbol(const char *name)
#define S_dev_intEnFail
Unable to enable interrupt level.
#define EPICSAddrTypeNoConvert
#define S_dev_badArgument
Bad function argument.
#define S_dev_addrMapFail
Unable to map address.
#define S_dev_internal
Internal failure.
API for accessing hardware devices, mosty over VMEbus.