[svn-commits] sruffell: branch linux/sruffell/staging r6502 - in /linux/team/sruffell/stagi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 27 11:00:10 CDT 2009


Author: sruffell
Date: Mon Apr 27 11:00:06 2009
New Revision: 6502

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6502
Log:
voicebus: Move common vpmadt032 interface into voicebus module.

The voicebus library was previously linked into both the wcte12xp and wctdm24xxp
drivers.  It is now broken out into it's own module and the common parts of the
vpmadt032 interface are now located in that module to reduce duplication between
the wcte12xp and wctdm24xxp drivers.

Added:
    linux/team/sruffell/staging/drivers/dahdi/voicebus/
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.c
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.c
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c   (with props)
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakCust.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakHpi.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakHpi.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/Kbuild   (with props)
    linux/team/sruffell/staging/drivers/dahdi/voicebus/gpakErrs.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/gpakErrs.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/gpakenum.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/gpakenum.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/voicebus.c
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/voicebus.c
    linux/team/sruffell/staging/drivers/dahdi/voicebus/voicebus.h
      - copied, changed from r6501, linux/team/sruffell/staging/drivers/dahdi/voicebus.h
    linux/team/sruffell/staging/drivers/dahdi/voicebus/vpmadtreg.c   (with props)
    linux/team/sruffell/staging/drivers/dahdi/voicebus/vpmadtreg.h   (with props)
    linux/team/sruffell/staging/drivers/dahdi/vpmadt032_loader/
    linux/team/sruffell/staging/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c   (with props)
Removed:
    linux/team/sruffell/staging/drivers/dahdi/voicebus.c
    linux/team/sruffell/staging/drivers/dahdi/voicebus.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.c
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakCust.c
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakCust.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakHpi.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/gpakErrs.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/gpakenum.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/voicebus.c
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.c
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.h
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakErrs.h
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/gpakenum.h
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/voicebus.c
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/vpmadt032.c
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/vpmadt032.h
Modified:
    linux/team/sruffell/staging/Makefile
    linux/team/sruffell/staging/drivers/dahdi/Kbuild
    linux/team/sruffell/staging/drivers/dahdi/Kconfig
    linux/team/sruffell/staging/drivers/dahdi/adt_lec.c
    linux/team/sruffell/staging/drivers/dahdi/firmware/Makefile
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/Kbuild
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/Kbuild
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/staging/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/sruffell/staging/Makefile
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/Makefile?view=diff&rev=6502&r1=6501&r2=6502
==============================================================================
--- linux/team/sruffell/staging/Makefile (original)
+++ linux/team/sruffell/staging/Makefile Mon Apr 27 11:00:06 2009
@@ -1,7 +1,7 @@
 #
 # Makefile for DAHDI Linux kernel modules
 #
-# Copyright (C) 2001-2008 Digium, Inc.
+# Copyright (C) 2001-2009 Digium, Inc.
 #
 #
 
@@ -98,7 +98,7 @@
 	fi
 	@rm -f $@.tmp
 
-prereq: include/dahdi/version.h
+prereq: include/dahdi/version.h firmware-loaders
 
 stackcheck: checkstack modules
 	./checkstack kernel/*.ko kernel/*/*.ko
@@ -130,6 +130,9 @@
 
 uninstall-firmware:
 	$(MAKE) -C drivers/dahdi/firmware hotplug-uninstall DESTDIR=$(DESTDIR)
+
+firmware-loaders:
+	$(MAKE) -C drivers/dahdi/firmware firmware-loaders
 
 install-include:
 	for hdr in $(INST_HEADERS); do \
@@ -233,6 +236,7 @@
 dist-clean: clean
 	@rm -f include/dahdi/version.h
 	@$(MAKE) -C drivers/dahdi/firmware dist-clean
+	@rm -f drivers/dahdi/vpmadt032_loader/*.o_shipped
 
 firmware-download:
 	@$(MAKE) -C drivers/dahdi/firmware all
@@ -245,6 +249,6 @@
 README.html: README
 	$(ASCIIDOC_CMD) -o $@ $<
 
-.PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm
+.PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm firmware-loaders
 
 FORCE:

Modified: linux/team/sruffell/staging/drivers/dahdi/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/Kbuild?view=diff&rev=6502&r1=6501&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/Kbuild (original)
+++ linux/team/sruffell/staging/drivers/dahdi/Kbuild Mon Apr 27 11:00:06 2009
@@ -10,6 +10,7 @@
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP)	+= wctdm24xxp/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE12XP)		+= wcte12xp/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM)		+= wctdm.o
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VOICEBUS)		+= voicebus/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCB4XXP)		+= wcb4xxp/
 
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT1XXP)		+= wct1xxp.o
@@ -64,6 +65,32 @@
 
 dahdi-objs := dahdi-base.o
 
+###############################################################################
+# VPMADT032 Loader
+###############################################################################
+
+dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o 
+
+ifeq ($(ARCH),i386)
+  ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_x86_32.o_shipped),)
+    VPMADT032_LOADER_PRESENT=yes
+    dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_x86_32.o
+    obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)	+= dahdi_vpmadt032_loader.o
+  endif
+else
+  ifeq ($(ARCH),x86_64)
+    ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_x86_64.o_shipped),)
+       VPMADT032_LOADER_PRESENT=yes
+       dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_x86_64.o
+       obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)	+= dahdi_vpmadt032_loader.o
+    endif
+  endif
+endif
+
+###############################################################################
+# HPEC Support 
+###############################################################################
+
 dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
 CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec
 

Modified: linux/team/sruffell/staging/drivers/dahdi/Kconfig
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/Kconfig?view=diff&rev=6502&r1=6501&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/Kconfig (original)
+++ linux/team/sruffell/staging/drivers/dahdi/Kconfig Mon Apr 27 11:00:06 2009
@@ -123,9 +123,24 @@
 
 	  If unsure, say Y.
 
+config DAHDI_VOICEBUS
+	tristate "VoiceBus(tm) Interface Library"
+	depends on PCI
+	default DAHDI
+	---help---
+	   This driver provides the common interface for telephony cards that
+	   use the VoiceBus(tm) interface.  It also contains common supporting
+	   libraries for the VPMADT032 hardware echo cancelation module that
+	   is available for the VoiceBus cards.
+
+	   To compile this driver as a module, choose M here: the module will
+	   be called voicebus.
+
+	   If unsure, say Y.
+
 config DAHDI_WCTDM24XXP
 	tristate "Digium Wildcard VoiceBus analog card Support"
-	depends on DAHDI && PCI
+	depends on DAHDI && DAHDI_VOICEBUS
 	default DAHDI
 	---help---
 	  This driver provides support for the following Digium
@@ -145,7 +160,7 @@
 
 config DAHDI_WCTE12XP
 	tristate "Digium Wildcard VoiceBus digital card Support"
-	depends on DAHDI && PCI
+	depends on DAHDI && DAHDI_VOICEBUS
 	default DAHDI
 	---help---
 	  This driver provides support for the following Digium

Modified: linux/team/sruffell/staging/drivers/dahdi/adt_lec.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/adt_lec.c?view=diff&rev=6502&r1=6501&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/adt_lec.c (original)
+++ linux/team/sruffell/staging/drivers/dahdi/adt_lec.c Mon Apr 27 11:00:06 2009
@@ -1,7 +1,7 @@
 /*
  * ADT Line Echo Canceller Parameter Parsing
  *
- * Copyright (C) 2008 Digium, Inc.
+ * Copyright (C) 2008-2009 Digium, Inc.
  *
  * Kevin P. Fleming <kpfleming at digium.com>
  *
@@ -33,7 +33,8 @@
 	params->tap_length = tap_length;
 }
 
-static int adt_lec_parse_params(struct adt_lec_params *params, struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+static int adt_lec_parse_params(struct adt_lec_params *params,
+	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
 {
 	unsigned int x;
 	char *c;

Modified: linux/team/sruffell/staging/drivers/dahdi/firmware/Makefile
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/firmware/Makefile?view=diff&rev=6502&r1=6501&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/firmware/Makefile (original)
+++ linux/team/sruffell/staging/drivers/dahdi/firmware/Makefile Mon Apr 27 11:00:06 2009
@@ -3,7 +3,7 @@
 # 
 # Makefile for firmware downloading/installation
 #
-# Copyright (C) 2007-2008, Digium, Inc.
+# Copyright (C) 2007-2009, Digium, Inc.
 #
 # Joshua Colp <jcolp at digium.com>
 #
@@ -11,16 +11,17 @@
 # the GNU General Public License
 #
 
-.PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object
+.PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object firmware-loaders
 
 OCT6114_064_VERSION:=1.05.01
 OCT6114_128_VERSION:=1.05.01
 TC400M_VERSION:=MR6.12
-VPMADT032_VERSION:=1.07
+VPMADT032_VERSION:=1.17.0
 
-FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
+#FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
+FIRMWARE_URL:=http://kilby.digium.internal
 
-ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-VPMADT032
+ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M
 
 # Firmware files should use the naming convention: dahdi-fw-<base name>-<sub name>-<version> or dahdi-fw-<base name>-<version>
 # First example: dahdi-fw-oct6114-064-1.05.01
@@ -32,13 +33,13 @@
 FIRMWARE:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz)
-FIRMWARE:=$(FIRMWARE:FIRMWARE-VPMADT032=dahdi-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz)
+
+FWLOADERS:=dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
 
 # Build a list of object files if hotplug will not be used
 OBJECT_FILES:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=dahdi-fw-tc400m.o)
-OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMADT032=dahdi-fw-vpmadt032.o)
 
 # Force usage of wget, for now
 DOWNLOAD=wget
@@ -55,6 +56,7 @@
 dist-clean: clean
 	rm -f dahdi-fw-*.bin
 	rm -f dahdi-fw-*.tar.gz
+	rm -f dahdi-fwload-*.tar.gz
 	rm -f make_firmware_object
 
 # Clean up anything we built
@@ -69,6 +71,14 @@
 		if test ! -f $@; then exit 1; fi; \
 		(cat $@ | gzip -d | tar -xof -) \
 	fi
+
+firmware-loaders: $(FWLOADERS)
+
+.PHONY: dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
+dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz:
+	@if test ! -f $@; then echo "Attempting to download $@"; $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \
+	if test ! -f $@; then exit 1; fi; \
+	(cd ../../..; cat drivers/dahdi/firmware/$@ | gzip -d | tar -xof -) 
 
 # Create object files suitable for linking against
 object-build: $(FIRMWARE) $(OBJECT_FILES)
@@ -111,17 +121,6 @@
 else
 	@echo "Firmware dahdi-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)"
 endif
-ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
-	@echo "Installing dahdi-fw-vpmadt032.bin to hotplug firmware directories"
-	@install -m 644 dahdi-fw-vpmadt032.bin $(DESTDIR)/usr/lib/hotplug/firmware
-	@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-*
-	@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION)
-	@install -m 644 dahdi-fw-vpmadt032.bin $(DESTDIR)/lib/firmware
-	@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-*
-	@touch $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION)
-else
-	@echo "Firmware dahdi-fw-vpmadt032.bin is already installed with required version $(VPMADT032_VERSION)"
-endif
 
 # Uninstall any installed dahdi firmware images from hotplug firmware directories
 hotplug-uninstall:
@@ -154,8 +153,3 @@
 dahdi-fw-tc400m.o: dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz dahdi-fw-tc400m.bin make_firmware_object
 	@echo Making firmware object file for dahdi-fw-tc400m.bin
 	./make_firmware_object dahdi-fw-tc400m.bin $@
-
-# Build object file of a VPMADT032 firmware image for linking
-dahdi-fw-vpmadt032.o: dahdi-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz dahdi-fw-vpmadt032.bin make_firmware_object
-	@echo Making firmware object file for dahdi-fw-vpmadt032.bin
-	./make_firmware_object dahdi-fw-vpmadt032.bin $@

Copied: linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.c (from r6501, linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.c)
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.c?view=diff&rev=6502&p1=linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.c&r1=6501&p2=linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.c&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/wcte12xp/GpakApi.c (original)
+++ linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.c Mon Apr 27 11:00:06 2009
@@ -16,6 +16,7 @@
  *
  * This program has been released under the terms of the GPL version 2 by
  * permission of Adaptive Digital Technologies, Inc.
+ *
  */
 
 /*
@@ -31,14 +32,10 @@
  * this program for more details.
  */
 
-#include <dahdi/kernel.h>
-
 #include "GpakHpi.h"
-#include "vpmadt032.h"
+#include "GpakCust.h"
 #include "GpakApi.h"
 #include "gpakenum.h"
-
-#ifdef VPM_SUPPORT
 
 /* DSP to Host interface block offsets. */
 #define REPLY_MSG_PNTR_OFFSET 0     /* I/F blk offset to Reply Msg Pointer */
@@ -127,11 +124,6 @@
     DSP_WORD DspStatus;      /* DSP Status */
     DSP_WORD DspChannels;    /* number of DSP channels */
     DSP_WORD  Temp[2];
-#if 0
-    DSP_WORD DspConfs;       /* number of DSP conferences */
-    DSP_ADDRESS PktBufrMem;  /* address of Packet Buffer */
-    unsigned short int i;    /* loop index / counter */
-#endif
 
     /* Read the pointer to the Interface Block. */
     gpakReadDspMemory(DspId, DSP_IFBLK_ADDRESS, 2, Temp);
@@ -164,38 +156,6 @@
             MaxChannels[DspId] = MAX_CHANNELS;
         else
             MaxChannels[DspId] = (unsigned short int) DspChannels;
-#if 0
-        /* read the number of configured DSP conferences */
-        gpakReadDspMemory(DspId, IfBlockPntr + NUM_CONFERENCES_OFFSET, 1,
-                          &DspConfs);
-        if (DspConfs > MAX_CONFS)
-            MaxConfs[DspId] = MAX_CONFS;
-        else
-            MaxConfs[DspId] = (unsigned short int) DspConfs;
-
-
-        /* read the number of configured DSP packet channels */
-        gpakReadDspMemory(DspId, IfBlockPntr + NUM_PKT_CHANNELS_OFFSET, 1,
-                          &DspChannels);
-        if (DspChannels > MAX_PKT_CHANNELS)
-            MaxPktChannels[DspId] = MAX_PKT_CHANNELS;
-        else
-            MaxPktChannels[DspId] = (unsigned short int) DspChannels;
-
-
-        /* read the pointer to the circular buffer infor struct table */
-        gpakReadDspMemory(DspId, IfBlockPntr + PKT_BUFR_MEM_OFFSET, 2, Temp);
-        RECONSTRUCT_LONGWORD(PktBufrMem, Temp);
-
-
-        /* Determine the addresses of each channel's Packet buffers. */
-        for (i = 0; i < MaxPktChannels[DspId]; i++)
-        {
-            pPktInBufr[DspId][i] = PktBufrMem;
-            pPktOutBufr[DspId][i] = PktBufrMem + CIRC_BUFFER_INFO_STRUCT_SIZE;
-            PktBufrMem += (CIRC_BUFFER_INFO_STRUCT_SIZE*2);
-        }
-#endif
 
         /* read the pointer to the event fifo info struct */
         gpakReadDspMemory(DspId, IfBlockPntr + EVENT_MSG_PNTR_OFFSET, 2, Temp);
@@ -509,7 +469,7 @@
  */
 gpakConfigPortStatus_t gpakConfigurePorts(
     unsigned short int DspId,       /* DSP Id (0 to MaxDSPCores-1) */
-    GpakPortConfig_t *pPortConfig,  /* pointer to Port Config info */
+    const GpakPortConfig_t *pPortConfig,  /* pointer to Port Config info */
     GPAK_PortConfigStat_t *pStatus  /* pointer to Port Config Status */
     )
 {
@@ -560,7 +520,7 @@
                     ((pPortConfig->RxFrameSyncPolarity2 << 4) & 0x0010) |
                     ((pPortConfig->TxFrameSyncPolarity2 << 3) & 0x0008) |
                     ((pPortConfig->CompandingMode2 << 1) & 0x0006) |
-                    (pPortConfig->SerialWordSize1 & 0x0001));
+                    (pPortConfig->SerialWordSize2 & 0x0001));
 
     MsgBuffer[12] = (DSP_WORD)
                    (((pPortConfig->DxDelay3 << 11) & 0x0800) |
@@ -608,6 +568,7 @@
     else
         return (CpsParmError);
 }
+EXPORT_SYMBOL(gpakConfigurePorts);
 
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -672,7 +633,7 @@
                        ((pChanConfig->SoftwareCompand & 3) << 2) |
                         (pChanConfig->EcanEnableB << 1) | 
                         (pChanConfig->EcanEnableA & 1)
-						);
+                        );
                         
         MsgBuffer[7]   = (DSP_WORD)
                          pChanConfig->EcanParametersA.EcanTapLength;       
@@ -733,7 +694,22 @@
         MsgBuffer[34]  = (DSP_WORD)
                          pChanConfig->EcanParametersB.EcanFirSegmentLen;   
 
-        MsgLength = 70; // byte number == 35*2 
+        MsgBuffer[35] = (DSP_WORD)
+                       (
+                       ((pChanConfig->EcanParametersB.EcanReconvergenceCheckEnable <<5) & 0x20)  |
+                       ((pChanConfig->EcanParametersA.EcanReconvergenceCheckEnable <<4) & 0x10)  |
+                       ((pChanConfig->EcanParametersB.EcanTandemOperationEnable <<3) & 0x8)  |
+                       ((pChanConfig->EcanParametersA.EcanTandemOperationEnable <<2) & 0x4)  |
+                       ((pChanConfig->EcanParametersB.EcanMixedFourWireMode << 1) & 0x2) | 
+                        (pChanConfig->EcanParametersA.EcanMixedFourWireMode & 1)
+                        );
+        MsgBuffer[36]  = (DSP_WORD)
+                         pChanConfig->EcanParametersA.EcanMaxDoubleTalkThres;   
+
+        MsgBuffer[37]  = (DSP_WORD)
+                         pChanConfig->EcanParametersB.EcanMaxDoubleTalkThres;   
+
+        MsgLength = 76; // byte number == 38*2 
         break;
 
 
@@ -760,6 +736,7 @@
     else
         return (CcsParmError);
 }
+EXPORT_SYMBOL(gpakConfigureChannel);
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * gpakTearDownChannel - Tear Down a DSP's Channel.
@@ -852,6 +829,7 @@
         return (AcParmError);
 
 }
+EXPORT_SYMBOL(gpakAlgControl);
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * gpakReadEventFIFOMessage - read from the event fifo
@@ -889,9 +867,6 @@
     DSP_WORD TakeIndex;     /* event fifo take index */
     DSP_WORD WordsReady;    /* number words ready for read out of event fifo */
     DSP_WORD EventError;    /* flag indicating error with event fifo msg  */
-#if 0
-    DSP_WORD *pDebugData;   /* debug data buffer pointer in event data struct */
-#endif
 
     /* Make sure the DSP Id is valid. */
     if (DspId >= MAX_DSP_CORES)
@@ -911,7 +886,7 @@
     EventInfoAddress = pEventFifoAddress[DspId];
     gpakReadDspMemory(DspId, EventInfoAddress, CIRC_BUFFER_INFO_STRUCT_SIZE, 
                                                                  WordBuffer);
-	RECONSTRUCT_LONGWORD(BufrBaseAddress, ((DSP_WORD *)&WordBuffer[CB_BUFR_BASE]));
+    RECONSTRUCT_LONGWORD(BufrBaseAddress, ((DSP_WORD *)&WordBuffer[CB_BUFR_BASE]));
     BufrSize = WordBuffer[CB_BUFR_SIZE];
     PutIndex = WordBuffer[CB_BUFR_PUT_INDEX];
     TakeIndex = WordBuffer[CB_BUFR_TAKE_INDEX];
@@ -1025,6 +1000,7 @@
     else
         return (PngDspCommFailure);
 }
+EXPORT_SYMBOL(gpakPingDsp);
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * gpakSerialTxFixedValue - transmit a fixed value on a timeslot
@@ -1249,7 +1225,7 @@
     *pFramingError3Count = ReadBuffer[2];
     *pDmaStopErrorCount  = ReadBuffer[3];
     
-    if(pDmaSlipStatsBuffer != NULL) 
+    if(pDmaSlipStatsBuffer != 0) 
     // If users want to get the DMA slips count
     {
 	    pDmaSlipStatsBuffer[0] = ReadBuffer[4];
@@ -1612,4 +1588,3 @@
     /* Return with an indication that System Parameters info was obtained. */
     return (RspSuccess);
 }
-#endif

Copied: linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.h (from r6501, linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.h)
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.h?view=diff&rev=6502&p1=linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.h&r1=6501&p2=linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.h&r2=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/GpakApi.h (original)
+++ linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakApi.h Mon Apr 27 11:00:06 2009
@@ -14,23 +14,6 @@
  * Revision History:
  *   06/15/05 - Initial release.
  *   11/15/2006  - 24 TDM-TDM Channels EC release
- *
- * This program has been released under the terms of the GPL version 2 by
- * permission of Adaptive Digital Technologies, Inc.
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2 as published by the
- * Free Software Foundation. See the LICENSE file included with
- * this program for more details.
  */
 
 #ifndef _GPAKAPI_H  /* prevent multiple inclusion */
@@ -67,6 +50,7 @@
     short int EcanAdaptEnable;     // Echo Can Adapt Enable flag 
     short int EcanG165DetEnable;   // Echo Can G165 Detect Enable flag 
     short int EcanDblTalkThresh;   // Echo Can Double Talk threshold 
+	short int EcanMaxDoubleTalkThres; // Maximum double-talk threshold
     short int EcanNlpThreshold;    // Echo Can NLP threshold 
     short int EcanNlpConv;  // Dynamic NLP control, NLP limit when EC about to converged
     short int EcanNlpUnConv;// Dynamic NLP control, NLP limit when EC not converged yet
@@ -76,10 +60,13 @@
     short int EcanCrossCorrLimit;  // Echo Can Cross Correlation limit 
     short int EcanNumFirSegments;  // Echo Can Num FIR Segments 
     short int EcanFirSegmentLen;   // Echo Can FIR Segment Length 
+    short int EcanTandemOperationEnable;   //Enable tandem operation 
+    short int EcanMixedFourWireMode; 	// Handle possible 4-wire (echo-free) lines
+	short int EcanReconvergenceCheckEnable; 	// Handle possible 4-wire (echo-free) lines
 } GpakEcanParms_t;
 
 /* Definition of a Channel Configuration information structure. */
-typedef struct
+typedef struct GpakChannelConfig
 {
     GpakSerialPort_t    PcmInPortA;         // A side PCM Input Serial Port Id 
     unsigned short int  PcmInSlotA;         // A side PCM Input Time Slot 
@@ -106,7 +93,7 @@
 
 
 /* Definition of a Serial Port Configuration Structure */
-typedef struct
+typedef struct GpakPortConfig
 {
     GpakSlotCfg_t SlotsSelect1;         // port 1 Slot selection
     unsigned short int FirstBlockNum1;  // port 1 first group Block Number
@@ -302,7 +289,7 @@
  */
 extern gpakConfigPortStatus_t gpakConfigurePorts(
     unsigned short int DspId,           // DSP identifier
-    GpakPortConfig_t   *pPortConfig,     // pointer to Port Config info
+    const GpakPortConfig_t   *pPortConfig,     // pointer to Port Config info
     GPAK_PortConfigStat_t *pStatus      // pointer to Port Config Status
     );
 

Added: linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c?view=auto&rev=6502
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c (added)
+++ linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c Mon Apr 27 11:00:06 2009
@@ -1,0 +1,681 @@
+/*
+ * Copyright (c) 2005, Adaptive Digital Technologies, Inc.
+ * Copyright (c) 2005-2009, Digium Incorporated
+ *
+ * File Name: GpakCust.c
+ *
+ * Description:
+ *   This file contains host system dependent functions to support generic
+ *   G.PAK API functions. The file is integrated into the host processor
+ *   connected to C55x G.PAK DSPs via a Host Port Interface.
+ *
+ *   Note: This file is supplied by Adaptive Digital Technologies and
+ *   modified by Digium in order to support the VPMADT032 modules.
+ *
+ * This program has been released under the terms of the GPL version 2 by
+ * permission of Adaptive Digital Technologies, Inc.
+ *
+ */
+
+/*
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2 as published by the
+ * Free Software Foundation. See the LICENSE file included with
+ * this program for more details.
+ */
+
+#include <linux/version.h>
+#include <linux/types.h>
+#include <linux/delay.h>
+#include <linux/pci.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#include <linux/semaphore.h>
+#else
+#include <asm/semaphore.h>
+#endif
+
+#include <dahdi/kernel.h>
+#include <dahdi/user.h>
+
+#include "GpakCust.h"
+#include "GpakApi.h"
+
+#include "adt_lec.h"
+#include "voicebus.h"
+#include "vpmadtreg.h"
+
+#ifndef HERE
+#define HERE() printk(KERN_DEBUG "Here %s:%d\n", __FILE__, __LINE__)
+#endif
+
+static rwlock_t ifacelock;
+static struct vpmadt032 *ifaces[MAX_DSP_CORES];
+
+static inline struct vpmadt032 *find_iface(const unsigned short dspid)
+{
+	struct vpmadt032 *ret;
+
+	read_lock(&ifacelock);
+	if (ifaces[dspid]) {
+		ret = ifaces[dspid];
+	} else {
+		ret = NULL;
+	}
+	read_unlock(&ifacelock);
+	return ret;
+}
+
+static struct vpmadt032_cmd *vpmadt032_get_free_cmd(struct vpmadt032 *vpm)
+{
+	unsigned long flags;
+	struct vpmadt032_cmd *cmd;
+	might_sleep();
+	spin_lock_irqsave(&vpm->list_lock, flags);
+	if (list_empty(&vpm->free_cmds)) {
+		spin_unlock_irqrestore(&vpm->list_lock, flags);
+		cmd = kmalloc(sizeof(struct vpmadt032_cmd), GFP_KERNEL);
+		if (unlikely(!cmd))
+			return NULL;
+		memset(cmd, 0, sizeof(*cmd));
+	} else {
+		cmd = list_entry(vpm->free_cmds.next, struct vpmadt032_cmd, node);
+		list_del_init(&cmd->node);
+		spin_unlock_irqrestore(&vpm->list_lock, flags);
+	}
+	init_completion(&cmd->complete);
+	return cmd;
+}
+
+/* Wait for any outstanding commands to the VPMADT032 to complete */
+static inline int vpmadt032_io_wait(struct vpmadt032 *vpm)
+{
+	unsigned long flags;
+	int empty;
+	while (1) {
+		spin_lock_irqsave(&vpm->list_lock, flags);
+		empty = list_empty(&vpm->pending_cmds) && list_empty(&vpm->active_cmds);
+		spin_unlock_irqrestore(&vpm->list_lock, flags);
+		if (empty) {
+			break;
+		} else {
+			msleep(1);
+		}
+	}
+	return 0;
+}
+
+/* Issue a read command to a register on the VPMADT032. We'll get the results
+ * later. */
+static struct vpmadt032_cmd *vpmadt032_getreg_full_async(struct vpmadt032 *vpm, int pagechange,
+	unsigned short addr)
+{
+	unsigned long flags;
+	struct vpmadt032_cmd *cmd;
+	cmd = vpmadt032_get_free_cmd(vpm);
+	if (!cmd)
+		return NULL;
+	cmd->desc = (pagechange) ? __VPM150M_RWPAGE | __VPM150M_RD : __VPM150M_RD;
+	cmd->address = addr;
+	cmd->data = 0;
+	spin_lock_irqsave(&vpm->list_lock, flags);
+	list_add_tail(&cmd->node, &vpm->pending_cmds);
+	spin_unlock_irqrestore(&vpm->list_lock, flags);
+	return cmd;
+}
+
+/* Get the results from a previous call to vpmadt032_getreg_full_async. */
+int vpmadt032_getreg_full_return(struct vpmadt032 *vpm, int pagechange,
+	u16 addr, u16 *outbuf, struct vpmadt032_cmd *cmd)
+{
+	unsigned long flags;
+	int ret = -EIO;
+	BUG_ON(!cmd);
+	wait_for_completion(&cmd->complete);
+	if (cmd->desc & __VPM150M_FIN) {
+		*outbuf = cmd->data;
+		cmd->desc = 0;
+		ret = 0;
+	}
+
+	/* Just throw this command back on the ready list. */
+	spin_lock_irqsave(&vpm->list_lock, flags);
+	list_add_tail(&cmd->node, &vpm->free_cmds);
+	spin_unlock_irqrestore(&vpm->list_lock, flags);
+	return ret;
+}
+
+/* Read one of the registers on the VPMADT032 */
+static int vpmadt032_getreg_full(struct vpmadt032 *vpm, int pagechange, u16 addr, u16 *outbuf)
+{
+	struct vpmadt032_cmd *cmd;
+	cmd = vpmadt032_getreg_full_async(vpm, pagechange, addr);
+	if (unlikely(!cmd)) {
+		return -ENOMEM;
+	}
+	return vpmadt032_getreg_full_return(vpm, pagechange, addr, outbuf, cmd);
+}
+
+static int vpmadt032_setreg_full(struct vpmadt032 *vpm, int pagechange, unsigned int addr,
+                        u16 data)
+{
+	unsigned long flags;
+	struct vpmadt032_cmd *cmd;
+	cmd = vpmadt032_get_free_cmd(vpm);
+	if (!cmd)
+		return -ENOMEM;
+	cmd->desc = cpu_to_le16((pagechange) ? (__VPM150M_WR|__VPM150M_RWPAGE) : __VPM150M_WR);
+	cmd->address = cpu_to_le16(addr);
+	cmd->data = cpu_to_le16(data);
+	spin_lock_irqsave(&vpm->list_lock, flags);
+	list_add_tail(&cmd->node, &vpm->pending_cmds);
+	spin_unlock_irqrestore(&vpm->list_lock, flags);
+	return 0;
+}
+
+
+static int vpmadt032_setpage(struct vpmadt032 *vpm, u16 addr)
+{
+	addr &= 0xf;
+	/* We do not need to set the page if we're already on the page we're
+	 * interested in. */
+	if (vpm->curpage == addr)
+		return 0;
+	else
+		vpm->curpage = addr;
+
+	return vpmadt032_setreg_full(vpm, 1, 0, addr);
+}
+
+static unsigned char vpmadt032_getpage(struct vpmadt032 *vpm)
+{
+	unsigned short res;
+	const int pagechange = 1;
+	vpmadt032_getreg_full(vpm, pagechange, 0, &res);
+	return res;
+}
+
+static int vpmadt032_getreg(struct vpmadt032 *vpm, unsigned int addr, u16 *data)
+{
+	unsigned short res;
+	vpmadt032_setpage(vpm, addr >> 16);
+	res = vpmadt032_getreg_full(vpm, 0, addr & 0xffff, data);
+ 	return res;
+}
+
+static int vpmadt032_setreg(struct vpmadt032 *vpm, unsigned int addr, u16 data)
+{
+	int res;
+	vpmadt032_setpage(vpm, addr >> 16);
+	res = vpmadt032_setreg_full(vpm, 0, addr & 0xffff, data);
+	return res;
+}
+
+/**
+ * vpmadt032_bh - Changes the echocan parameters on the vpmadt032 module.
+ *
+ * This function is typically scheduled to run in the workqueue by the
+ * vpmadt032_echocan_with_params function.  This is because communicating with
+ * the hardware can take some time while messages are sent to the VPMADT032
+ * module and the driver waits for the responses.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+static void vpmadt032_bh(void *data)
+{
+	struct vpmadt032 *vpm = data;
+#else
+static void vpmadt032_bh(struct work_struct *data)
+{
+	struct vpmadt032 *vpm = container_of(data, struct vpmadt032, work);
+#endif
+	struct adt_lec_params *curstate, *desiredstate;
+	int channel;
+
+	/* Sweep through all the echo can channels on the VPMADT032 module,
+	 * looking for ones where the desired state does not match the current
+	 * state.
+	 */
+	for (channel = 0; channel < vpm->span->channels; channel++) {
+		GPAK_AlgControlStat_t pstatus;
+		int res = 1;
+		curstate = &vpm->curecstate[channel];
+		desiredstate = &vpm->desiredecstate[channel];
+
+		if ((desiredstate->nlp_type != curstate->nlp_type) ||
+		    (desiredstate->nlp_threshold != curstate->nlp_threshold) ||
+		    (desiredstate->nlp_max_suppress != curstate->nlp_max_suppress)) {
+
+			GPAK_ChannelConfigStat_t cstatus;
+			GPAK_TearDownChanStat_t tstatus;
+			GpakChannelConfig_t chanconfig;
+
+			if (vpm->options.debug & DEBUG_ECHOCAN)
+				printk(KERN_DEBUG "Reconfiguring chan %d for nlp %d, nlp_thresh %d, and max_supp %d\n", channel + 1, vpm->desiredecstate[channel].nlp_type,
+					desiredstate->nlp_threshold, desiredstate->nlp_max_suppress);
+
+			vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
+
+			res = gpakTearDownChannel(vpm->dspid, channel, &tstatus);
+			if (res)
+				goto vpm_bh_out;
+
+			res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus);
+			if (res)
+				goto vpm_bh_out;
+
+			if (!desiredstate->tap_length) {
+				res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
+				if (res)
+					printk("Unable to disable sw companding on echo cancellation channel %d (reason %d)\n", channel, res);
+				res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
+			}
+
+		} else if (desiredstate->tap_length != curstate->tap_length) {
+			if (desiredstate->tap_length) {
+				printk(KERN_DEBUG "Enabling ecan on channel: %d\n", channel);
+				res = gpakAlgControl(vpm->dspid, channel, EnableMuLawSwCompanding, &pstatus);
+				if (res)
+					printk("Unable to set SW Companding on channel %d (reason %d)\n", channel, res);
+				res = gpakAlgControl(vpm->dspid, channel, EnableEcanA, &pstatus);
+			} else {
+				printk(KERN_DEBUG "Disabling ecan on channel: %d\n", channel);
+				res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
+				if (res)
+					printk("Unable to disable sw companding on echo cancellation channel %d (reason %d)\n", channel, res);
+				res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
+			}
+		}
+vpm_bh_out:
+		if (!res)
+			*curstate = *desiredstate;
+	}
+	return;
+}
+#include "adt_lec.c"
+int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo,
+	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+{
+	int update;
+	unsigned int ret;
+
+	ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p);
+	if (ret)
+		return ret;
+
+	/* The driver cannot control the number of taps on the VPMADT032
+	 * module. Instead, it uses tap_length to enable or disable the echo
+	 * cancellation. */
+	vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0;
+
+	/* Only update the parameters if the new state of the echo canceller
+	 * is different than the current state. */
+	update = memcmp(&vpm->curecstate[channo],
+			&vpm->desiredecstate[channo],
+			sizeof(vpm->curecstate[channo]));
+	if (update && test_bit(VPM150M_ACTIVE, &vpm->control)) {
+		/* Since updating the parameters can take a bit of time while
+		 * the driver sends messages to the VPMADT032 and waits for
+		 * their responses, we'll push the work of updating the
+		 * parameters to a work queue so the caller can continue to
+		 * proceed with setting up the call.
+		 */
+		schedule_work(&vpm->work);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(vpmadt032_echocan_with_params);
+
+struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options)
+{
+	struct vpmadt032 *vpm;
+	int i;
+	might_sleep();
+
+	vpm = kzalloc(sizeof(*vpm), GFP_KERNEL);
+	if (!vpm)
+		return NULL;
+
+	/* Init our vpmadt032 struct */
+	memcpy(&vpm->options, options, sizeof(*options));
+	spin_lock_init(&vpm->list_lock);
+	INIT_LIST_HEAD(&vpm->free_cmds);
+	INIT_LIST_HEAD(&vpm->pending_cmds);
+	INIT_LIST_HEAD(&vpm->active_cmds);
+	sema_init(&vpm->sem, 1);
+	vpm->curpage = 0x80;
+	vpm->dspid = -1;
+
+	/* Place this structure in the ifaces array so that the DspId from the
+	 * Gpak Library can be used to locate it. */
+	write_lock(&ifacelock);
+	for (i=0; i<MAX_DSP_CORES; ++i) {
+		if (NULL == ifaces[i]) {
+			ifaces[i] = vpm;
+			vpm->dspid = i;
+			break;
+		}
+	}
+	write_unlock(&ifacelock);
+
+	if (-1 == vpm->dspid) {
+		kfree(vpm);
+		printk(KERN_NOTICE "Unable to initialize another vpmadt032 modules\n");
+		vpm = NULL;
+	} else if (vpm->options.debug & DEBUG_ECHOCAN) {
+		printk(KERN_DEBUG "Setting VPMADT032 DSP ID to %d\n", vpm->dspid);
+	}
+
+	return vpm;
+}
+EXPORT_SYMBOL(vpmadt032_alloc);
+
+int
+vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
+{
+	int i;
+	u16 reg;
+	int res = -EFAULT;
+	gpakPingDspStat_t pingstatus;
+
+	BUG_ON(!vpm->setchanconfig_from_state);
+	might_sleep();
+
+	if (vpm->options.debug & DEBUG_ECHOCAN)
+		printk(KERN_DEBUG "VPMADT032 Testing page access: ");
+
+	for (i = 0; i < 0xf; i++) {
+		int x;
+		for (x = 0; x < 3; x++) {
+			vpmadt032_setpage(vpm, i);
+			reg = vpmadt032_getpage(vpm);
+			if (reg != i) {
+				if (vpm->options.debug & DEBUG_ECHOCAN)
+					printk(KERN_DEBUG "Failed: Sent %x != %x VPMADT032 Failed HI page test\n", i, reg);
+				res = -ENODEV;
+				goto failed_exit;
+			}
+		}
+	}
+
+	if (vpm->options.debug & DEBUG_ECHOCAN)
+		printk(KERN_DEBUG "Passed\n");
+
+	/* Set us up to page 0 */
+	vpmadt032_setpage(vpm, 0);
+	if (vpm->options.debug & DEBUG_ECHOCAN)
+		printk(KERN_DEBUG "VPMADT032 now doing address test: ");
+
+	for (i = 0; i < 16; i++) {
+		int x;
+		for (x = 0; x < 2; x++) {
+			vpmadt032_setreg(vpm, 0x1000, i);
+			vpmadt032_getreg(vpm, 0x1000, &reg);
+			if (reg != i) {
+				printk("VPMADT032 Failed address test\n");
+				goto failed_exit;
+			}
+
+		}
+	}
+
+	if (vpm->options.debug & DEBUG_ECHOCAN)
+		printk("Passed\n");
+
+	set_bit(VPM150M_HPIRESET, &vpm->control);
+	while (test_bit(VPM150M_HPIRESET, &vpm->control))
+		msleep(1);
+
+	res = vpmadtreg_loadfirmware(vb);
+	if (res) {
+		struct pci_dev *pdev = voicebus_get_pci_dev(vb);
+		dev_printk(KERN_INFO, &pdev->dev, "Failed to load the firmware.\n");
+		return res;
+	}
+	vpm->curpage = -1;
+	set_bit(VPM150M_SWRESET, &vpm->control);
+

[... 3532 lines stripped ...]



More information about the svn-commits mailing list