source: rtems/c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c @ 2b0a037

Last change on this file since 2b0a037 was 2b0a037, checked in by Till Straumann <strauman@…>, on 01/16/07 at 23:09:50

2007-01-16 Till Straumann <strauman@…>

  • ep1a/vme/vmeconfig.c, mvme5500/pci/pcifinddevice.c,
  • mvme5500/startup/pgtbl_activate.c, mvme5500/vectors/bspException.h,
  • mvme5500/vectors/exceptionhandler.c, mvme5500/vme/VME.h,
  • mvme5500/vme/vmeconfig.c, score603e/vme/vmeconfig.c, shared/pci/pcifinddevice.c,
  • shared/startup/pgtbl_activate.c, shared/startup/pgtbl_setup.c,
  • shared/startup/probeMemEnd.c, shared/startup/sbrk.c, shared/vme/VME.h,
  • shared/vme/VMEConfig.h, shared/vme/vme_universe.c, shared/vme/vmeconfig.c: Added SLAC/Stanford Authorship Note / Copyright + Liability Disclaimer.
  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*$Id$*/
2
3#include <rtems.h>
4#include <bsp.h>
5#include <bsp/VME.h>
6#include <bsp/VMEConfig.h>
7#include <bsp/irq.h>
8#define __INSIDE_RTEMS_BSP__
9#include <bsp/vmeUniverse.h>
10
11/* Wrap BSP VME calls around driver calls - we do this so EPICS doesn't have to
12 * include bridge-specific headers. This file provides the necessary glue
13 * to make VME.h and vmeconfig.c independent of the bridge chip.
14 */
15
16/*
17 * Authorship
18 * ----------
19 * This software was created by
20 *     Till Straumann <strauman@slac.stanford.edu>, 9/2005,
21 *         Stanford Linear Accelerator Center, Stanford University.
22 *
23 * Acknowledgement of sponsorship
24 * ------------------------------
25 * This software was produced by
26 *     the Stanford Linear Accelerator Center, Stanford University,
27 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
28 *
29 * Government disclaimer of liability
30 * ----------------------------------
31 * Neither the United States nor the United States Department of Energy,
32 * nor any of their employees, makes any warranty, express or implied, or
33 * assumes any legal liability or responsibility for the accuracy,
34 * completeness, or usefulness of any data, apparatus, product, or process
35 * disclosed, or represents that its use would not infringe privately owned
36 * rights.
37 *
38 * Stanford disclaimer of liability
39 * --------------------------------
40 * Stanford University makes no representations or warranties, express or
41 * implied, nor assumes any liability for the use of this software.
42 *
43 * Stanford disclaimer of copyright
44 * --------------------------------
45 * Stanford University, owner of the copyright, hereby disclaims its
46 * copyright and all other rights in this software.  Hence, anyone may
47 * freely use it for any purpose without restriction. 
48 *
49 * Maintenance of notices
50 * ----------------------
51 * In the interest of clarity regarding the origin and status of this
52 * SLAC software, this and all the preceding Stanford University notices
53 * are to remain affixed to any copy or derivative of this software made
54 * or distributed by the recipient and are to be affixed to any copy of
55 * software made or distributed by the recipient that contains a copy or
56 * derivative of this software.
57 *
58 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
59 */
60
61int
62BSP_vme2local_adrs(unsigned long am, unsigned long vmeaddr, unsigned long *plocaladdr)
63{
64int rval=vmeUniverseXlateAddr(1,0,am,vmeaddr,plocaladdr);
65        *plocaladdr+=PCI_MEM_BASE;
66        return rval;
67}
68
69int
70BSP_local2vme_adrs(unsigned long am, unsigned long localaddr, unsigned long *pvmeaddr)
71{
72        return vmeUniverseXlateAddr(0, 0, am,localaddr+PCI_DRAM_OFFSET,pvmeaddr);
73}
74
75
76int
77BSP_installVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg)
78{
79        return vmeUniverseInstallISR(vector, handler, arg);
80}
81
82int
83BSP_removeVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg)
84{
85        return vmeUniverseRemoveISR(vector, handler, arg);
86}
87
88/* retrieve the currently installed ISR for a given vector */
89BSP_VME_ISR_t
90BSP_getVME_isr(unsigned long vector, void **parg)
91{
92        return vmeUniverseISRGet(vector, parg);
93}
94
95int
96BSP_enableVME_int_lvl(unsigned int level)
97{
98        return vmeUniverseIntEnable(level);
99}
100
101int
102BSP_disableVME_int_lvl(unsigned int level)
103{
104        return vmeUniverseIntDisable(level);
105}
106
107int
108BSP_VMEOutboundPortCfg(
109        unsigned long port,
110        unsigned long address_space,
111        unsigned long vme_address,
112        unsigned long pci_address,
113        unsigned long size)
114{
115        return vmeUniverseMasterPortCfg(port, address_space, vme_address, pci_address, size);
116}
117
118int
119BSP_VMEInboundPortCfg(
120        unsigned long port,
121        unsigned long address_space,
122        unsigned long vme_address,
123        unsigned long pci_address,
124        unsigned long size)
125{
126        return vmeUniverseSlavePortCfg(port, address_space, vme_address, pci_address, size);
127}
128
129void
130BSP_VMEOutboundPortsShow(FILE *f)
131{
132        vmeUniverseMasterPortsShow(f);
133}
134
135void
136BSP_VMEInboundPortsShow(FILE *f)
137{
138        vmeUniverseSlavePortsShow(f);
139}
140
141
142int BSP_VMEInit()
143{
144  if ( vmeUniverseInit() ) {
145        /*  maybe no VME at all - or no universe ... */
146        return -1;
147  }
148  vmeUniverseReset();
149  return 0;
150}
151
152int BSP_VMEIrqMgrInstall()
153{
154#ifndef BSP_VME_UNIVERSE_INSTALL_IRQ_MGR
155  /* No map; use first line only and obtain PIC wire from PCI config */
156  vmeUniverseInstallIrqMgrAlt(
157        VMEUNIVERSE_IRQ_MGR_FLAG_SHARED, /* use shared IRQs */
158        0, -1,  /* Universe pin0 -> PIC line from config space */
159        -1      /* terminate list  */
160  );
161
162#else
163  BSP_VME_UNIVERSE_INSTALL_IRQ_MGR;
164#endif
165#if defined(BSP_PCI_VME_DRIVER_DOES_EOI) && defined(BSP_PIC_DO_EOI)
166  if (vmeUniverse0PciIrqLine<0)
167        BSP_panic("Unable to get universe interrupt line info from PCI config");
168  _BSP_vme_bridge_irq = vmeUniverse0PciIrqLine;
169#endif
170  return 0;
171}
Note: See TracBrowser for help on using the repository browser.