1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | |
---|
5 | The vmeUniverse driver needs some support from the BSP for |
---|
6 | |
---|
7 | a) PCI configuration space access |
---|
8 | b) PCI interrupt acknowledgement |
---|
9 | c) PCI interrupt handler installation |
---|
10 | |
---|
11 | The driver was developed using the powerpc/shared/ BSP |
---|
12 | (it also supports vxWorks) and by default uses that BSP's |
---|
13 | a) PCI access API |
---|
14 | b,c) irq handling API (AKA 'new' style BSP_install_rtems_irq_handler() |
---|
15 | API). |
---|
16 | |
---|
17 | Some hooks exist in the driver to ease porting to other BSPs. |
---|
18 | The following information has been assembled when answering a |
---|
19 | question regarding a ppcn_60x BSP port: |
---|
20 | |
---|
21 | I looked through the ppcn_60x BSP. Here's what I found: |
---|
22 | |
---|
23 | - this BSP does NOT adhere to neither the 'old' nor the 'new' API |
---|
24 | but provides its own (startup/setvec.c: set_vector()). |
---|
25 | - the BSP has a 'driver' for vmeUniverse although mine is far more |
---|
26 | complete (including support for VME interrupts, DMA etc.). |
---|
27 | - Porting my driver to your BSP should not be too hard: |
---|
28 | |
---|
29 | 1) vmeUniverse needs PCI configuration space support from the |
---|
30 | BSP: |
---|
31 | a) a routine 'pciFindDevice' (need to be macro-aliased |
---|
32 | to the proper routine/wrapper of your BSP) who scans |
---|
33 | PCI config space for the universe bridge. |
---|
34 | You could add 'libbsp/powerpc/shared/pci/pcifinddevice.c' |
---|
35 | to your BSP substituting the pci_read_config_xxx calls |
---|
36 | by the ones present on your BSP (see step 2)) |
---|
37 | b) routines to read PCI config registers (byte and longword) |
---|
38 | [on your BSP these are PCIConfigRead32/PCIConfigRead8; |
---|
39 | hence you could replace the macros on top with |
---|
40 | #define pciConfigInLong PCIConfigRead32 |
---|
41 | 2) vmeUniverse needs to know how to acknowledge a PCI interrupt |
---|
42 | In your case, nothing needs to be done |
---|
43 | #define BSP_PIC_DO_EOI do {} while (0) |
---|
44 | 3) Install the VME ISR dispatcher: replace the 'new' style |
---|
45 | interrupt installer (BSP_install_rtems_irq_handler()) by |
---|
46 | a proper call to 'set_vector()' |
---|
47 | 4) I might have missed something... |
---|
48 | |
---|
49 | I attach the latest version of the vmeUniverse driver in case you want |
---|
50 | to try to do the port (should be easy). |
---|
51 | |
---|
52 | For the sake of ease of maintenance, I just added a few hooks making it |
---|
53 | possible to override some things without having to modify the driver code. |
---|
54 | |
---|
55 | 1,2) PCI config space access macros may be overriden via CFLAGS |
---|
56 | when compiling vmeUniverse.c, hence: |
---|
57 | CFLAGS += -DBSP_PIC_DO_EOI=do{}while(0) |
---|
58 | CFLAGS += -DBSP_PCI_CONFIG_IN_LONG=PCIConfigRead32 |
---|
59 | CFLAGS += -DBSP_PCI_CONFIG_IN_BYTE=PCIConfigRead8 |
---|
60 | (you still need to supply BSP_pciFindDevice) |
---|
61 | 3) create your own version of vmeUniverseInstallIrqMgr(): |
---|
62 | copy to a separate file and replace |
---|
63 | BSP_rtems_install_irq_handler() by a proper call to set_vector. |
---|
64 | |
---|
65 | 4) Send me email :-) |
---|
66 | |
---|
67 | USAGE NOTE: To fully initialize the driver, the following steps can/must |
---|
68 | be performed: |
---|
69 | |
---|
70 | vmeUniverseInit(); /* MANDATORY: Driver Initialization */ |
---|
71 | vmeUniverseReset(); /* OPTIONAL: Reset most registers to a known state; |
---|
72 | * if this step is omitted, firmware setup is |
---|
73 | * preserved |
---|
74 | */ |
---|
75 | vmeUniverseMasterPortCfg(...); /* OPTIONAL: setup the master windows |
---|
76 | * (current setup preserved if omitted) |
---|
77 | */ |
---|
78 | vmeUniverseSlavePortCfg(...); /* OPTIONAL: setup the slave windows |
---|
79 | * (current setup preserved if omitted) |
---|
80 | */ |
---|
81 | vmeUniverseInstallIrqMgr(); /* NEEDED FOR VME INTERRUPT SUPPRORT |
---|
82 | * initialize the interrupt manager. |
---|
83 | * NOTE: you need to call your own |
---|
84 | * version of this routine here |
---|
85 | */ |
---|
86 | |
---|
87 | For an example of init/setup, consult libbsp/powerpc/shared/vme/vmeconfig.c |
---|
88 | |
---|