Index: c/src/lib/libbsp/powerpc/ChangeLog
===================================================================
--- c/src/lib/libbsp/powerpc/ChangeLog	(revision 79262a320ad64f0f43412eee95a2ccd497cc2456)
+++ c/src/lib/libbsp/powerpc/ChangeLog	(revision 8388ea76290694e482434345aa2a0bd122cb56a5)
@@ -1,2 +1,8 @@
+2007-12-08	Till Straumann <strauman@slac.stanford.edu>
+
+	* Makefile.am: merged shared/vme/vme_universe.c and
+	shared/vme/vme_universe_dma.c into one file.
+	Added support for Tsi148 driver (DMA).
+
 2007-12-08	Till Straumann <strauman@slac.stanford.edu>
 
Index: c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c	(revision 79262a320ad64f0f43412eee95a2ccd497cc2456)
+++ c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c	(revision 8388ea76290694e482434345aa2a0bd122cb56a5)
@@ -1,7 +1,15 @@
 /*$Id$*/
+
+/* Implementation of the VME.h and VMEDMA.h APIs for the BSP using the
+ * vmeUniverse/vmeTsi148 drivers
+ *
+ * This file is named vme_universe.c for historic reasons.
+ */
+
 
 #include <rtems.h>
 #include <bsp.h>
 #include <bsp/VME.h>
+#include <bsp/VMEDMA.h>
 #include <bsp/VMEConfig.h>
 #include <bsp/irq.h>
@@ -17,4 +25,5 @@
 #define _VME_TSI148_DECLARE_SHOW_ROUTINES
 #include <bsp/vmeTsi148.h>
+#include <bsp/vmeTsi148DMA.h>
 #endif
 
@@ -22,8 +31,11 @@
 #define _VME_UNIVERSE_DECLARE_SHOW_ROUTINES
 #include <bsp/vmeUniverse.h>
+#include <bsp/vmeUniverseDMA.h>
 #if     !defined(BSP_VME_INSTALL_IRQ_MGR) && defined(BSP_VME_UNIVERSE_INSTALL_IRQ_MGR)
 #define BSP_VME_INSTALL_IRQ_MGR BSP_VME_UNIVERSE_INSTALL_IRQ_MGR
 #endif
 #endif
+
+#include <bsp/bspVmeDmaList.h>
 
 /* Wrap BSP VME calls around driver calls - we do this so EPICS doesn't have to
@@ -93,4 +105,14 @@
 } VMEOpsRec, *VMEOps;
 
+/* two separate 'ops' structs for historic reasons */
+typedef struct DmaOpsRec_ {
+	int				(*setup)(int, uint32_t, uint32_t, void *);
+	int				(*start)(int, uint32_t, uint32_t, uint32_t);
+	uint32_t		(*status)(int);
+	VMEDmaListClass	listClass;
+	int				nChannels;
+	int				*vectors;
+} DmaOpsRec, *DmaOps;
+
 #ifdef _VME_DRIVER_UNIVERSE
 static VMEOpsRec uniOpsRec = {
@@ -109,4 +131,15 @@
 	                    VMEUNIVERSE_IRQ_MGR_FLAG_PW_WORKAROUND,
 };
+
+static int uniVecs[] = { UNIV_DMA_INT_VEC };
+
+static DmaOpsRec uniDmaOps = {
+	setup:				vmeUniverseDmaSetup,
+	start:				vmeUniverseDmaStart,
+	status:				vmeUniverseDmaStatus,
+	listClass:			&vmeUniverseDmaListClass,
+	nChannels:			1,
+	vectors:			uniVecs,
+};
 #endif
 
@@ -126,7 +159,22 @@
 	irq_mgr_flags:      VMETSI148_IRQ_MGR_FLAG_SHARED,
 };
-#endif
-
-static VMEOps theOps = 0;
+
+static int tsiVecs[] = {
+	TSI_DMA_INT_VEC,
+	TSI_DMA1_INT_VEC,
+};
+
+static DmaOpsRec tsiDmaOps = {
+	setup:				vmeTsi148DmaSetup,
+	start:				vmeTsi148DmaStart,
+	status:				vmeTsi148DmaStatus,
+	listClass:			&vmeTsi148DmaListClass,
+	nChannels:			2,
+	vectors:			tsiVecs,
+};
+#endif
+
+static VMEOps theOps    = 0;
+static DmaOps theDmaOps = 0;
 
 int
@@ -207,4 +255,94 @@
 {
 	theOps->inbound_p_show(f);
+}
+
+int
+BSP_VMEDmaSetup(int channel, uint32_t bus_mode, uint32_t xfer_mode, void *custom_setup)
+{
+	return theDmaOps->setup(channel, bus_mode, xfer_mode, custom_setup);
+}
+
+int
+BSP_VMEDmaStart(int channel, uint32_t pci_addr, uint32_t vme_addr, uint32_t n_bytes)
+{
+	return theDmaOps->start(channel, pci_addr, vme_addr, n_bytes);
+}
+
+uint32_t
+BSP_VMEDmaStatus(int channel)
+{
+	return theDmaOps->status(channel);
+}
+
+BSP_VMEDmaListDescriptor
+BSP_VMEDmaListDescriptorSetup(
+		BSP_VMEDmaListDescriptor d,
+		uint32_t                 attr_mask,
+		uint32_t				 xfer_mode,
+		uint32_t                 pci_addr,
+		uint32_t                 vme_addr,
+		uint32_t                 n_bytes)
+{
+VMEDmaListClass	pc;
+	if ( !d ) {
+		if ( ! (pc = theDmaOps->listClass) ) {
+			pc = (theDmaOps = selectOps())->listClass;	
+		}
+		return BSP_VMEDmaListDescriptorNewTool(
+					pc,
+					attr_mask,
+					xfer_mode,
+					pci_addr,
+					vme_addr,
+					n_bytes);
+					
+	}
+	return BSP_VMEDmaListDescriptorSetupTool(d, attr_mask, xfer_mode, pci_addr, vme_addr, n_bytes);
+}
+
+int
+BSP_VMEDmaListStart(int channel, BSP_VMEDmaListDescriptor list)
+{
+	return BSP_VMEDmaListDescriptorStartTool(0, channel, list);
+}
+
+/* NOT thread safe! */
+int
+BSP_VMEDmaInstallISR(int channel, BSP_VMEDmaIRQCallback cb, void *usr_arg)
+{
+int vec;
+BSP_VME_ISR_t curr;
+void          *carg;
+
+	if ( channel < 0 || channel >= theDmaOps->nChannels )
+		return -1;
+
+	vec = theDmaOps->vectors[channel];
+
+	curr = BSP_getVME_isr(vec, &carg);
+
+	if ( cb && curr ) {
+		/* IRQ currently in use */
+		return -1;
+	}
+
+	if ( !cb && !curr ) {
+		/* Allow uninstall if no handler is currently installed;
+		 * just make sure IRQ is disabled
+		 */
+		BSP_disableVME_int_lvl(vec);
+		return 0;
+	}
+	
+	if ( cb ) {
+		if ( BSP_installVME_isr(vec, (BSP_VME_ISR_t)cb, usr_arg) )
+			return -4;
+		BSP_enableVME_int_lvl(vec);
+	} else {
+		BSP_disableVME_int_lvl(vec);
+		if ( BSP_removeVME_isr(vec, curr, carg) )
+			return -4;
+	}
+	return 0;
 }
 
Index: src/lib/libbsp/powerpc/shared/vme/vme_universe_dma.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/vme/vme_universe_dma.c	(revision 79262a320ad64f0f43412eee95a2ccd497cc2456)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/* $Id$ */
-
-/* Implementation of the VMEDMA.h API for the BSP using the vmeUniverse driver */
-
-/* 
- * Authorship
- * ----------
- * This software was created by
- *     Till Straumann <strauman@slac.stanford.edu>, 2006, 2007
- * 	   Stanford Linear Accelerator Center, Stanford University.
- * 
- * Acknowledgement of sponsorship
- * ------------------------------
- * This software was produced by
- *     the Stanford Linear Accelerator Center, Stanford University,
- * 	   under Contract DE-AC03-76SFO0515 with the Department of Energy.
- * 
- * Government disclaimer of liability
- * ----------------------------------
- * Neither the United States nor the United States Department of Energy,
- * nor any of their employees, makes any warranty, express or implied, or
- * assumes any legal liability or responsibility for the accuracy,
- * completeness, or usefulness of any data, apparatus, product, or process
- * disclosed, or represents that its use would not infringe privately owned
- * rights.
- * 
- * Stanford disclaimer of liability
- * --------------------------------
- * Stanford University makes no representations or warranties, express or
- * implied, nor assumes any liability for the use of this software.
- * 
- * Stanford disclaimer of copyright
- * --------------------------------
- * Stanford University, owner of the copyright, hereby disclaims its
- * copyright and all other rights in this software.  Hence, anyone may
- * freely use it for any purpose without restriction.  
- * 
- * Maintenance of notices
- * ----------------------
- * In the interest of clarity regarding the origin and status of this
- * SLAC software, this and all the preceding Stanford University notices
- * are to remain affixed to any copy or derivative of this software made
- * or distributed by the recipient and are to be affixed to any copy of
- * software made or distributed by the recipient that contains a copy or
- * derivative of this software.
- * 
- * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
- */ 
-
-#include <stdint.h>
-#include <rtems.h>
-#include <bsp.h>
-#include <bsp/VME.h>
-#include <bsp/VMEDMA.h>
-#include <bsp/vmeUniverse.h>
-#include <bsp/vmeUniverseDMA.h>
-#include <bsp/bspVmeDmaList.h>
-
-int
-BSP_VMEDmaSetup(int channel, uint32_t bus_mode, uint32_t xfer_mode, void *custom_setup)
-{
-	return vmeUniverseDmaSetup(channel, bus_mode, xfer_mode, custom_setup);
-}
-
-int
-BSP_VMEDmaStart(int channel, uint32_t pci_addr, uint32_t vme_addr, uint32_t n_bytes)
-{
-	return vmeUniverseDmaStart(channel, pci_addr, vme_addr, n_bytes);
-}
-
-uint32_t
-BSP_VMEDmaStatus(int channel)
-{
-	return vmeUniverseDmaStatus(channel);
-}
-
-BSP_VMEDmaListDescriptor
-BSP_VMEDmaListDescriptorSetup(
-		BSP_VMEDmaListDescriptor d,
-		uint32_t                 attr_mask,
-		uint32_t				 xfer_mode,
-		uint32_t                 pci_addr,
-		uint32_t                 vme_addr,
-		uint32_t                 n_bytes)
-{
-VMEDmaListClass	pc;
-	if ( !d ) {
-		pc = &vmeUniverseDmaListClass;
-
-		return BSP_VMEDmaListDescriptorNewTool(
-					pc,
-					attr_mask,
-					xfer_mode,
-					pci_addr,
-					vme_addr,
-					n_bytes);
-					
-	}
-	return BSP_VMEDmaListDescriptorSetupTool(d, attr_mask, xfer_mode, pci_addr, vme_addr, n_bytes);
-}
-
-int
-BSP_VMEDmaListStart(int channel, BSP_VMEDmaListDescriptor list)
-{
-	return BSP_VMEDmaListDescriptorStartTool(0, channel, list);
-}
-
-/* NOT thread safe! */
-int
-BSP_VMEDmaInstallISR(int channel, BSP_VMEDmaIRQCallback cb, void *usr_arg)
-{
-int vec;
-BSP_VME_ISR_t curr;
-void          *carg;
-
-	if ( channel != 0 )
-		return -1;
-
-	vec = UNIV_DMA_INT_VEC;
-
-	curr = BSP_getVME_isr(vec, &carg);
-
-	if ( cb && curr ) {
-		/* IRQ currently in use */
-		return -1;
-	}
-
-	if ( !cb && !curr ) {
-		/* Allow uninstall if no handler is currently installed;
-		 * just make sure IRQ is disabled
-		 */
-		BSP_disableVME_int_lvl(vec);
-		return 0;
-	}
-		
-	if ( cb ) {
-		if ( BSP_installVME_isr(vec, (BSP_VME_ISR_t)cb, usr_arg) )
-			return -4;
-		BSP_enableVME_int_lvl(vec);
-	} else {
-		BSP_disableVME_int_lvl(vec);
-		if ( BSP_removeVME_isr(vec, curr, carg) )
-			return -4;
-	}
-	return 0;
-}
