1 | #ifndef RTEMS_BSP_VME_UNIVERSE_H |
---|
2 | #define RTEMS_BSP_VME_UNIVERSE_H |
---|
3 | /* $Id$ */ |
---|
4 | |
---|
5 | /* SVGM et al. BSP's VME support */ |
---|
6 | /* Author: Till Straumann, <strauman@slac.stanford.edu> */ |
---|
7 | |
---|
8 | /* pull in bsp.h */ |
---|
9 | #include <bsp.h> |
---|
10 | /* our VME bridge */ |
---|
11 | #include <bsp/vmeUniverse.h> |
---|
12 | /* our address space configuration */ |
---|
13 | #include <bsp/VMEConfig.h> |
---|
14 | |
---|
15 | /* VME related declarations */ |
---|
16 | /* how to map a VME address to the CPU local bus. |
---|
17 | * Note that this traverses two bridges: |
---|
18 | * the grackle and the universe. For the |
---|
19 | * Universe, there is a lookup procedure while |
---|
20 | * we assume a 1:1 mapping for the grackle... |
---|
21 | */ |
---|
22 | |
---|
23 | /* NOTE about the fast mapping macros: |
---|
24 | * using these macros is only safe if the user app |
---|
25 | * does _NOT_ change the universe mappings! |
---|
26 | * While changing the PCI windows probably doesn't |
---|
27 | * make much sense (involves changing the MMU/DBATs as well), |
---|
28 | * The user might wish to change the VME address |
---|
29 | * layout, i.e. by remapping _VME_A32_WIN0_ON_VME |
---|
30 | * and _VME_DRAM_OFFSET... |
---|
31 | * Hence, using the A24 and A16 macros is probably safe. |
---|
32 | */ |
---|
33 | |
---|
34 | #define BSP_vme_init() \ |
---|
35 | vmeUniverseInit |
---|
36 | |
---|
37 | /* translate through host bridge and vme master window of vme bridge */ |
---|
38 | static inline int |
---|
39 | BSP_vme2local_adrs(unsigned am, unsigned long vmeaddr, unsigned long *plocaladdr) |
---|
40 | { |
---|
41 | int rval=vmeUniverseXlateAddr(1,0,am,vmeaddr,plocaladdr); |
---|
42 | *plocaladdr+=PCI_MEM_BASE; |
---|
43 | return rval; |
---|
44 | } |
---|
45 | |
---|
46 | /* when using this macro, the universe setup MUST NOT BE |
---|
47 | * CHANGED by the application... |
---|
48 | */ |
---|
49 | #define BSP_vme2local_A32_fast(vmeaddr) \ |
---|
50 | ((vmeaddr)-_VME_A32_WIN0_ON_VME + _VME_A32_WIN0_ON_PCI + PCI_MEM_BASE) |
---|
51 | #define BSP_vme2local_A24_fast(vmeaddr) \ |
---|
52 | (((vmeaddr)&0x7ffffff)+_VME_A24_ON_PCI + PCI_MEM_BASE) |
---|
53 | #define BSP_vme2local_A16_fast(vmeaddr) \ |
---|
54 | (((vmeaddr)&0xffff)+_VME_A16_ON_PCI + PCI_MEM_BASE) |
---|
55 | |
---|
56 | /* how a CPU address is mapped to the VME bus (if at all) |
---|
57 | */ |
---|
58 | static inline int |
---|
59 | BSP_local2vme_adrs(unsigned am, unsigned long localaddr, unsigned long *pvmeaddr) |
---|
60 | { |
---|
61 | return vmeUniverseXlateAddr(0, 0, am,localaddr+PCI_DRAM_OFFSET,pvmeaddr); |
---|
62 | } |
---|
63 | |
---|
64 | #define BSP_localdram2vme_fast(localaddr) \ |
---|
65 | ((localaddr)+_VME_DRAM_OFFSET) |
---|
66 | |
---|
67 | /* interrupt handlers and levels */ |
---|
68 | typedef void (*BSP_VME_ISR_t)(void *usrArg, unsigned long vector); |
---|
69 | |
---|
70 | #define BSP_installVME_isr(vector, handler, arg) \ |
---|
71 | vmeUniverseInstallISR(vector, handler, arg) |
---|
72 | |
---|
73 | #define BSP_removeVME_isr(vector, handler, arg) \ |
---|
74 | vmeUniverseRemoveISR(vector, handler, arg) |
---|
75 | |
---|
76 | /* retrieve the currently installed ISR for a given vector */ |
---|
77 | #define BSP_getVME_isr(vector, parg) \ |
---|
78 | vmeUniverseISRGet(vector, parg) |
---|
79 | |
---|
80 | #define BSP_enableVME_int_lvl(level) \ |
---|
81 | vmeUniverseIntEnable(level) |
---|
82 | |
---|
83 | #define BSP_disableVME_int_lvl(level) \ |
---|
84 | vmeUniverseIntDisable(level) |
---|
85 | |
---|
86 | /* Tell the interrupt manager that the universe driver |
---|
87 | * already called openpic_eoi() and that this step hence |
---|
88 | * must be omitted. |
---|
89 | */ |
---|
90 | #define BSP_PCI_VME_DRIVER_DOES_EOI |
---|
91 | extern int _BSP_vme_bridge_irq; |
---|
92 | /* don't reference vmeUniverse0PciIrqLine directly here - leave it up to |
---|
93 | * bspstart() to set BSP_vme_bridge_irq. That way, we can generate variants |
---|
94 | * of the BSP with / without the universe driver... |
---|
95 | */ |
---|
96 | #define BSP_PCI_VME_BRIDGE_IRQ _BSP_vme_bridge_irq |
---|
97 | |
---|
98 | #endif |
---|