📄 vmeuniverse.h
字号:
* port: port number 0..3 (0..7 for a UniverseII) * * address_space: vxWorks compliant addressing mode identifier * (see vme.h). The most important are: * 0x0d - A32, Sup, Data * 0x3d - A24, Sup, Data * 0x2d - A16, Sup, Data * additionally, the value 0 is accepted; it will * disable this port. * vme_address: address on the vme_bus of this port. * local_address: address on the pci_bus of this port. * length: size of this port. * * NOTE: the addresses and length parameters must be aligned on a * 2^16 byte (0x10000) boundary, except for port 4 (only available * on a UniverseII), where the alignment can be 4k (4096). * * RETURNS: 0 on success, -1 on failure. Error messages printed to stderr. */intvmeUniverseMasterPortCfg( unsigned long port, unsigned long address_space, unsigned long vme_address, unsigned long local_address, unsigned long length);/* translate an address through the bridge * * vmeUniverseXlateAddr(0,0,addr,as,&result) * yields a VME a address that reflects * a local memory location as seen from the VME bus through the universe * VME slave. * * likewise does vmeUniverseXlateAddr(1,0,addr,as,&result) * translate a VME bus addr (through the VME master) to the * PCI side of the bridge. * * a valid address space modifier must be specified. * * The 'reverse' parameter may be used to find a reverse * mapping, i.e. the pci address in a master window can be * found if the respective vme address is known etc. * * RETURNS: translated address in *pbusAdrs / *plocalAdrs * * 0: success * -1: address/modifier not found in any bridge port * -2: invalid modifier */intvmeUniverseXlateAddr( int master, /* look in the master windows */ int reverse, /* reverse mapping; for masters: map local to VME */ unsigned long as, /* address space */ unsigned long addr, /* address to look up */ unsigned long *paOut/* where to put result */ );/* configure a VME slave (PCI master) port */intvmeUniverseSlavePortCfg( unsigned long port, unsigned long address_space, unsigned long vme_address, unsigned long local_address, unsigned long length);/* start a (direct, not linked) DMA transfer * * NOTE: DCTL and DGCS must be set up * prior to calling this routine */intvmeUniverseStartDMA( unsigned long local_addr, unsigned long vme_addr, unsigned long count);/* read a register in PCI memory space * (offset being one of the declared constants) */unsigned longvmeUniverseReadReg(unsigned long offset);/* write a register in PCI memory space */voidvmeUniverseWriteReg(unsigned long value, unsigned long offset);/* convert an array of unsigned long values to LE (as needed * when the universe reads e.g. DMA descriptors from PCI) */voidvmeUniverseCvtToLE(unsigned long *ptr, unsigned long num);/* reset the VME bus */static inline voidvmeUniverseResetBus(void){ vmeUniverseWriteReg( vmeUniverseReadReg(UNIV_REGOFF_MISC_CTL) | UNIV_MISC_CTL_SW_SYSRST, UNIV_REGOFF_MISC_CTL);}#ifdef __rtems__/* VME Interrupt Handler functionality *//* we dont use the current RTEMS/BSP interrupt API for the * following reasons: * * - RTEMS/BSP API does not pass an argument to the ISR :-( :-( * - no separate vector space for VME vectors. Some vectors would * have to overlap with existing PCI/ISA vectors. * - RTEMS/BSP API allocates a structure for every possible vector * - the irq_on(), irq_off() functions add more bloat than helping. * They are (currently) only used by the framework to disable * interrupts at the device level before removing a handler * and to enable interrupts after installing a handler. * These operations may as well be done by the driver itself. * * Hence, we maintain our own (VME) handler table and hook our PCI * handler into the standard RTEMS/BSP environment. Our handler then * dispatches VME interrupts. */typedef void (*VmeUniverseISR) (void *usrArg, unsigned long vector);/* install a handler for a VME vector * RETURNS 0 on success, nonzero on failure. */intvmeUniverseInstallISR(unsigned long vector, VmeUniverseISR handler, void *usrArg);/* remove a handler for a VME vector. The vector and usrArg parameters * must match the respective parameters used when installing the handler. * RETURNS 0 on success, nonzero on failure. */intvmeUniverseRemoveISR(unsigned long vector, VmeUniverseISR handler, void *usrArg);/* query for the currently installed ISR and usr parameter at a given vector * RETURNS: ISR or 0 (vector too big or no ISR installed) */VmeUniverseISRvmeUniverseISRGet(unsigned long vector, void **parg);/* utility routines to enable/disable a VME IRQ level * * RETURNS 0 on success, nonzero on failure */intvmeUniverseIntEnable(unsigned int level);intvmeUniverseIntDisable(unsigned int level);/* use these special vectors to connect a handler to the * universe specific interrupts (such as "DMA done", * VOWN, error irqs etc.) * NOTE: The wrapper clears all status LINT bits (except * for regular VME irqs). Also note that it is the user's * responsibility to enable the necessary interrupts in * LINT_EN * * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * DO NOT CHANGE THE ORDER OF THESE VECTORS - THE DRIVER * DEPENDS ON IT * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * */#define UNIV_VOWN_INT_VEC 256#define UNIV_DMA_INT_VEC 257#define UNIV_LERR_INT_VEC 258#define UNIV_VERR_INT_VEC 259#define UNIV_VME_SW_IACK_INT_VEC 260#define UNIV_PCI_SW_INT_VEC 261#define UNIV_SYSFAIL_INT_VEC 262#define UNIV_ACFAIL_INT_VEC 263#define UNIV_MBOX0_INT_VEC 264#define UNIV_MBOX1_INT_VEC 265#define UNIV_MBOX2_INT_VEC 266#define UNIV_MBOX3_INT_VEC 267#define UNIV_LM0_INT_VEC 268#define UNIV_LM1_INT_VEC 269#define UNIV_LM2_INT_VEC 270#define UNIV_LM3_INT_VEC 271#define UNIV_NUM_INT_VECS 272/* the universe interrupt handler is capable of routing all sorts of * (VME) interrupts to 8 different lines (some of) which may be hooked up * in a (board specific) way to a PIC. * * This driver only supports at most two lines. It routes the 7 VME * interrupts to the main line and optionally, it routes the 'special' * interrupts generated by the universe itself (DMA done, VOWN etc.) * to a second line. If no second line is available, all IRQs are routed * to the main line. * * Because the driver has no way to figure out which lines are actually * wired to the PIC, this information has to be provided when installing * the manager. * * Hence the manager sets up routing VME interrupts to 1 or 2 universe * OUTPUTS. However, it must also be told to which PIC INPUTS they * are wired. * Optionally, the first PIC input line can be read from PCI config space * but the second must be passed to this routine. Note that the info read * from PCI config space is wrong for many boards! * * PARAMETERS: * vmeIrqUnivOut: to which output pin (of the universe) should the 7 * VME irq levels be routed. * vmeIrqPicLine: specifies to which PIC input the 'main' output is * wired. If passed a value < 0, the driver reads this * information from PCI config space ("IRQ line"). * specialIrqUnivOut: to which output pin (of the universe) should the * internally irqs be routed. Use 'vmeIRQunivOut' * if < 0. * specialIrqPicLine: specifies to which PIC input the 'special' output * pin is wired. The wiring of the 'vmeIRQunivOut' to * the PIC is determined by reading PCI config space. * * RETURNS: 0 on success, -1 on failure. * */intvmeUniverseInstallIrqMgr(int vmeIrqUnivOut, int vmeIrqPicLine, int specialIrqUnivOut, int specialIrqPicLine);#endif#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -