120 likes | 125 Views
This article provides a quick tour of the EPICS Device Support Library API, including motivating factors, address and interrupt mapping, device driver portability, and code examples.
E N D
EPICS Device Support Library • Motivating factors • Quick tour of the API • Some examples
Motivating Factors • Detect conflicting use of memory mapped IO and interrupt resources • Print address maps and interrupt vector maps • Abstract interface improves portability of device drivers
Type Codes for Address Spaces We Use 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;
Register / Map Address Range of Memory Mapped IO long devRegisterAddress( const char *pOwnerName, epicsAddressType addrType, void *baseAddress, unsigned long size, /* bytes */ void **pLocalAddress);
Unregister Address Range of Memory Mapped IO long devUnregisterAddress( epicsAddressType addrType, void *baseAddress, const char *pOwnerName);
Type Codes For Interrupt Vector Spaces typedef enum {intCPU, intVME, intVXI} epicsInterruptType;
Connect to an Interrupt long devConnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, void (*pFunction)(), void *parameter)
Disconnect from an Interrupt /* * * 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 devDisconnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, void (*pFunction)());
Enable and Disable Interrupt Levels long devEnableInterruptLevel( epicsInterruptType intType, unsigned level); long devDisableInterruptLevel( epicsInterruptType intType, unsigned level);
Print Address Map long devAddressMap(void)
Print Interrupt Vector Map veclist()
Examples (Unfortunately Only a Few in EPICS Base) <epics>\base\src\drv\ansi\drvAb.c(895): status = devRegisterAddress("drvAb",atVMEA24,(void *)p6008, <epics>\base\src\drv\ansi\drvEpvxi.c(513): status = devRegisterAddress( <epics>\base\src\drv\ansi\drvEpvxi.c(525): status = devRegisterAddress( <epics>\base\src\drv\old\drvBitBus.c(317): if (devRegisterAddress("Xycom Bitbus", atVMEA16, (void*)BaseAddr, sizeof(XycomBBRegsStruct), NULL) != 0) <epics>\base\src\drv\old\drvBitBus.c(327): if (devRegisterAddress("PEP Bitbus", atVMEA16, (void*)BaseAddr, sizeof(PepBBRegsStruct), NULL) != 0)