devLib2
2.12
|
When working with a CSR/CR device the first step is to find the identifiers for the board. This should be included in vendor documentation, and can be verified by probing the appropriate VME slot at runtime. The library functions vmecsrdump(lvl) and vmecsrprint(slot,lvl) can be used for this. See the IOC shell section for detail on these functions.
Including this identifying information in your code provides an important safe guard against user mis-configuration. This provides an easy way to prevent your code from trying to access the wrong type of device.
To initialize you must know its slot number. While it is possible to automatically detect cards it is preferable to have a user defined mapping between physical id (slot#) and logical id (Asyn port, device ID, etc.). This allows for consistent naming even if cards are added or removed from the system.
For EPICS drivers initialization will usually be done with an IOC shell function. For example:
Would set card "dac" to be the card in slot 5. This imaginary card is given an A24 base address of 0x210000, and set to generate interrupt vector 0x60 at level 4.
Below is an example implementation of myVMECardSetup().
The first step is to probe the VME slot and get the CSR base address. If the slot were empty or populated with an unsupported card then we would abort here.
Assuming the card supports full jumperless configuration then then base address will be programmed using the CSR space. While newer VME64x cards have standard base address registers for this, older VME64 cards do not. For these card the vendor should document the correct way to set the base address.
Once the A24 base address is set we map it into the process' address space with the standard devLib mapping call.
Always attach the interrupt handler before enabling interrupts.
Neither VME64 or VME64x specifies standard registers for interrupt level or vector code. Vendor documention must specify how to set this.
.Note
This may not be done in the CSR space, but rather in another address space.