[zaptel-commits] kpfleming: branch 1.2 r3365 - in /branches/1.2: ./ wct4xxp/ wctc4xxp/ wctdm24...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Sat Dec 8 11:04:12 CST 2007


Author: kpfleming
Date: Sat Dec  8 11:04:11 2007
New Revision: 3365

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3365
Log:
clean up firmware handling across wct4xxp, wctc4xxp, wctdm24xxp and wcte12xp drivers to use consistent methods
add non-hotplug firmware loading support to wctdm24xxp and wcte12xp
add license and copyright headers to various files that did not have them
clean up header inclusion in some files

Added:
    branches/1.2/wcte12xp/VPMADT032.bin
      - copied unchanged from r3364, branches/1.2/wctdm24xxp/VPMADT032.bin
Modified:
    branches/1.2/Makefile
    branches/1.2/wct4xxp/base.c
    branches/1.2/wctc4xxp/base.c
    branches/1.2/wctdm24xxp/GpakApi.c
    branches/1.2/wctdm24xxp/GpakCust.c
    branches/1.2/wctdm24xxp/Makefile.kernel26
    branches/1.2/wctdm24xxp/base.c
    branches/1.2/wctdm24xxp/wctdm24xxp.h
    branches/1.2/wcte12xp/GpakApi.c
    branches/1.2/wcte12xp/Makefile.kernel26
    branches/1.2/wcte12xp/base.c
    branches/1.2/wcte12xp/vpmadt032.c
    branches/1.2/wcte12xp/vpmadt032.h
    branches/1.2/wcte12xp/wcte12xp.h

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Sat Dec  8 11:04:11 2007
@@ -489,11 +489,13 @@
 firmware:
 ifeq ($(HOTPLUG_FIRMWARE),yes)
 	if [ -d $(DESTDIR)/usr/lib/hotplug/firmware ]; then \
-		install -m 644 wct4xxp/*.ima wctc4xxp/*.bin $(DESTDIR)/usr/lib/hotplug/firmware; \
+		install -m 644 wct4xxp/*.ima $(DESTDIR)/usr/lib/hotplug/firmware; \
+		install -m 644 wctc4xxp/*.bin $(DESTDIR)/usr/lib/hotplug/firmware; \
 		install -m 644 wctdm24xxp/*.bin $(DESTDIR)/usr/lib/hotplug/firmware; \
 	fi
 	if [ -d $(DESTDIR)/lib/firmware ]; then \
-		install -m 644 wct4xxp/*.ima wctc4xxp/*.bin $(DESTDIR)/lib/firmware; \
+		install -m 644 wct4xxp/*.ima $(DESTDIR)/lib/firmware; \
+		install -m 644 wctc4xxp/*.bin $(DESTDIR)/lib/firmware; \
 		install -m 644 wctdm24xxp/*.bin $(DESTDIR)/lib/firmware; \
 	fi
 	@echo "Installed firmware"

Modified: branches/1.2/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/base.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wct4xxp/base.c (original)
+++ branches/1.2/wct4xxp/base.c Sat Dec  8 11:04:11 2007
@@ -44,11 +44,6 @@
 
 #include "wct4xxp.h"
 #include "vpm450m.h"
-
-#ifdef HOTPLUG_FIRMWARE
-static const char *oct064_firmware = "OCT6114-64D.ima";
-static const char *oct128_firmware = "OCT6114-128D.ima";
-#endif
 
 /*
  * Tasklets provide better system interactive response at the cost of the
@@ -2726,6 +2721,9 @@
 	extern void _binary_OCT6114_128D_ima_size;
 	extern u8 _binary_OCT6114_64D_ima_start[];
 	extern u8 _binary_OCT6114_128D_ima_start[];
+#else
+	static const char oct064_firmware[] = "OCT6114-64D.ima";
+	static const char oct128_firmware[] = "OCT6114-128D.ima";
 #endif
 
 	if (!vpmsupport) {
@@ -2796,15 +2794,13 @@
 
 	if (!(wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
 		printk("VPM450: Failed to initialize\n");
-#if defined(HOTPLUG_FIRMWARE)
+		if (firmware != &embedded_firmware)
+			release_firmware(firmware);
+		return;
+	}
+
+	if (firmware != &embedded_firmware)
 		release_firmware(firmware);
-#endif
-		return;
-	}
-
-#if defined(HOTPLUG_FIRMWARE)
-	release_firmware(firmware);
-#endif
 
 	if (vpmdtmfsupport == -1) {
 		printk("VPM450: hardware DTMF disabled.\n");

Modified: branches/1.2/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctc4xxp/base.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctc4xxp/base.c (original)
+++ branches/1.2/wctc4xxp/base.c Sat Dec  8 11:04:11 2007
@@ -50,13 +50,6 @@
 #include "zaptel.h"
 #else
 #include <linux/zaptel.h>
-#endif
-
-#ifdef HOTPLUG_FIRMWARE
-static const char *dte_firmware = "tc400m-firmware.bin";
-#else
-extern u8 _binary_tc400m_firmware_bin_start[];
-extern void _binary_tc400m_firmware_bin_size;
 #endif
 
 
@@ -1669,19 +1662,15 @@
 	static int initd_ifaces=0;
 	unsigned char g729_numchannels, g723_numchannels, min_numchannels, dte_firmware_ver, dte_firmware_ver_minor;
 	unsigned int complexfmts;
-	struct firmware embedded_firmware = {
+
+	struct firmware embedded_firmware;
+	const struct firmware *firmware = &embedded_firmware;
 #if !defined(HOTPLUG_FIRMWARE)
-		/* Yes... this is weird. objcopy gives us a symbol containing
-		   the size of the firmware, not a pointer to a variable containing
-		   the size. The only way we can get the value of the symbol
-		   is to take its address, so we define it as a pointer and
-		   then cast that value to the proper type.
-		*/
-		.size = (size_t) &_binary_tc400m_firmware_bin_size,
-		.data = _binary_tc400m_firmware_bin_start,
+	extern void _binary_tc400m_firmware_bin_size;
+	extern u8 _binary_tc400m_firmware_bin_start[];
+#else
+	static const char tc400m_firmware[] = "tc400m-firmware.bin";
 #endif
-	};
-	const struct firmware *firmware = &embedded_firmware;
 
 	if (!initd_ifaces) {
 		memset((void *)ifaces,0,(sizeof(struct wcdte *))*WC_MAX_IFACES);
@@ -1760,12 +1749,17 @@
 			INIT_WORK(&wc->dte_work, dte_wque_run, wc);
 #endif
 
-#ifdef HOTPLUG_FIRMWARE
-			if ((request_firmware(&firmware, dte_firmware, &wc->dev->dev) != 0) || !firmware) {
-				printk("TC400B: firmware %s not available from userspace\n", dte_firmware);
-				return -1;
-			}
+#if defined(HOTPLUG_FIRMWARE)
+			if ((request_firmware(&firmware, tc400m_firmware, &wc->dev->dev) != 0) ||
+			    !firmware) {
+				printk("TC400M: firmware %s not available from userspace\n", tc400m_firmware);
+				return -EIO;
+			}
+#else
+			embedded_firmware.data = _binary_tc400m_firmware_bin_start;
+			embedded_firmware.size = (size_t) &_binary_tc400m_firmware_bin_size;
 #endif
+
 			dte_firmware_ver = firmware->data[0];
 			dte_firmware_ver_minor = firmware->data[16];
 			g729_numchannels = firmware->data[1];
@@ -1882,6 +1876,7 @@
 
 			/* Start DMA */
 			wcdte_start_dma(wc);
+
 			if (wcdte_boot_processor(wc,firmware,1)) {
 				if (firmware != &embedded_firmware)
 					release_firmware(firmware);
@@ -1897,8 +1892,10 @@
 				vfree(wc);
 				return -EIO;
 			}
-			if (wcdte_setup_channels(wc))
-			{
+			if (firmware != &embedded_firmware)
+				release_firmware(firmware);
+
+			if (wcdte_setup_channels(wc)) {
 				/* Set Reset Low */
 				wcdte_stop_dma(wc);
 				/* Free Resources */

Modified: branches/1.2/wctdm24xxp/GpakApi.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp/GpakApi.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctdm24xxp/GpakApi.c (original)
+++ branches/1.2/wctdm24xxp/GpakApi.c Sat Dec  8 11:04:11 2007
@@ -14,6 +14,11 @@
  *   06/15/05 - Initial release.
  *   11/15/2006  - 24 TDM-TDM Channels EC release
  */
+
+#include <linux/version.h>
+#include <asm/semaphore.h>
+
+#include "zaptel.h"
 
 #include "GpakHpi.h"
 #include "GpakCust.h"

Modified: branches/1.2/wctdm24xxp/GpakCust.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp/GpakCust.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctdm24xxp/GpakCust.c (original)
+++ branches/1.2/wctdm24xxp/GpakCust.c Sat Dec  8 11:04:11 2007
@@ -17,10 +17,13 @@
  *
  */
 
-#include "GpakCust.h"
-#include "wctdm24xxp.h"
+#include <linux/version.h>
 #include <linux/delay.h>
 #include <asm/semaphore.h>
+
+#include "zaptel.h"
+#include "wctdm24xxp.h"
+#include "GpakCust.h"
 
 char vpm150mtone_to_zaptone(GpakToneCodes_t tone)
 {
@@ -386,5 +389,7 @@
 	fw->offset += count;
 
 	return count;
+#else
+	return 0;
 #endif
 }

Modified: branches/1.2/wctdm24xxp/Makefile.kernel26
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp/Makefile.kernel26?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctdm24xxp/Makefile.kernel26 (original)
+++ branches/1.2/wctdm24xxp/Makefile.kernel26 Sat Dec  8 11:04:11 2007
@@ -3,6 +3,10 @@
 EXTRA_CFLAGS := -I$(src)/.. -Wno-undef
 
 wctdm24xxp-objs := base.o GpakCust.o GpakApi.o
+
+ifneq ($(HOTPLUG_FIRMWARE),yes)
+wctdm24xxp-objs += firmware_vpmadt032.o
+endif
 
 $(obj)/base.o: $(src)/GpakCust.h $(src)/wctdm24xxp.h
 $(obj)/base.o: $(src)/../zaptel.h
@@ -10,3 +14,7 @@
 $(obj)/GpakCust.o: $(src)/GpakCust.h
 
 $(obj)/GpakApi.o: $(src)/GpakApi.h
+
+$(obj)/firmware_vpmadt032.o: $(src)/VPMADT032.bin $(obj)/base.o
+	@echo Making firmware object file for $(notdir $<)
+	@cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o

Modified: branches/1.2/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp/base.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctdm24xxp/base.c (original)
+++ branches/1.2/wctdm24xxp/base.c Sat Dec  8 11:04:11 2007
@@ -1,5 +1,5 @@
 /*
- * Wilcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface
+ * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface
  *
  * Written by Mark Spencer <markster at digium.com>
  * Support for TDM800P and VPM150M by Matthew Fredrickson <creslin at digium.com>
@@ -32,21 +32,26 @@
 #include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
-#ifdef VPM150M_SUPPORT
-#include <linux/firmware.h>
-#endif
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <asm/semaphore.h>
-#include "../proslic.h"
-#include "../wctdm.h"
+
+#ifdef LINUX26
+#include <linux/moduleparam.h>
+#endif
+
+#ifdef VPM150M_SUPPORT
+#include <linux/firmware.h>
+#endif
+
+#include "zaptel.h"
+#include "proslic.h"
+#include "wctdm.h"
+
+#include "wctdm24xxp.h"
 
 #include "GpakCust.h"
 #include "GpakApi.h"
-
-/* Comment to disable VPM support */
-
-#include "wctdm24xxp.h"
 
 /*
   Experimental max loop current limit for the proslic
@@ -224,17 +229,6 @@
 	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, },
 };
 
-#ifdef STANDALONE_ZAPATA
-#include "zaptel.h"
-#else
-#include <linux/zaptel.h>
-#endif
-
-#ifdef LINUX26
-#include <linux/moduleparam.h>
-#endif
-
-
 #define DEBUG_CARD (1 << 0)
 #define DEBUG_ECHOCAN (1 << 1)
 
@@ -275,8 +269,6 @@
 static int vpmdtmfsupport = 0;
 #define VPM_DEFAULT_DTMFTHRESHOLD 1250
 static int dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD;
-
-static const char *vpm150m_firmware = "VPMADT032.bin";
 #endif
 
 static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane);
@@ -2969,6 +2961,14 @@
 
 #ifdef VPM150M_SUPPORT
 	struct wctdm_firmware fw;
+	struct firmware embedded_firmware;
+	const struct firmware *firmware = &embedded_firmware;
+#if !defined(HOTPLUG_FIRMWARE)
+	extern void _binary_vpmadt032_bin_size;
+	extern u8 _binary_vpmadt032_bin_start[];
+#else
+	static const char vpmadt032_firmware[] = "VPMADT032.bin";
+#endif
 	gpakDownloadStatus_t downloadstatus;
 	gpakPingDspStat_t pingstatus;
 #endif
@@ -3060,10 +3060,18 @@
 	
 	if (pingstatus || (version != 0x106)) {
 #endif
+#if defined(HOTPLUG_FIRMWARE)
+		if ((request_firmware(&firmware, vpmadt032_firmware, &wc->dev->dev) != 0) ||
+		    !firmware) {
+			printk("VPMADT032: firmware %s not available from userspace\n", vpmadt032_firmware);
+			return;
+		}
+#else
+		embedded_firmware.data = _binary_vpmadt032_bin_start;
+		embedded_firmware.size = (size_t) &_binary_vpmadt032_bin_size;
+#endif
+		fw.fw = firmware;
 		fw.offset = 0;
-		if (request_firmware(&fw.fw, vpm150m_firmware, &wc->dev->dev)) {
-			printk("Unable to locate VPMADT032.bin firmware!\n");
-		}
 
 		set_bit(VPM150M_HPIRESET, &vpm150m->control);
 
@@ -3073,7 +3081,8 @@
 		printk("VPMADT032 Loading firwmare... ");
 		downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw);
 
-		release_firmware(fw.fw);
+		if (firmware != &embedded_firmware)
+			release_firmware(firmware);
 
 		if (downloadstatus != 0) {
 			printk("Unable to download firmware to VPMADT032 with cause %d\n", downloadstatus);

Modified: branches/1.2/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp/wctdm24xxp.h?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wctdm24xxp/wctdm24xxp.h (original)
+++ branches/1.2/wctdm24xxp/wctdm24xxp.h Sat Dec  8 11:04:11 2007
@@ -1,8 +1,31 @@
+/*
+ * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface
+ *
+ * Written by Mark Spencer <markster at digium.com>
+ * Support for TDM800P and VPM150M by Matthew Fredrickson <creslin at digium.com>
+ *
+ * Copyright (C) 2005, 2006, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ */
+
 #ifndef _WCTDM24XXP_H
 #define _WCTDM24XXP_H
-
-#include "../zaptel.h"
-#include <asm/semaphore.h>
 
 #define NUM_FXO_REGS 60
 

Modified: branches/1.2/wcte12xp/GpakApi.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/GpakApi.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/GpakApi.c (original)
+++ branches/1.2/wcte12xp/GpakApi.c Sat Dec  8 11:04:11 2007
@@ -14,6 +14,8 @@
  *   06/15/05 - Initial release.
  *   11/15/2006  - 24 TDM-TDM Channels EC release
  */
+
+#include "zaptel.h"
 
 #include "GpakHpi.h"
 #include "vpmadt032.h"

Modified: branches/1.2/wcte12xp/Makefile.kernel26
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/Makefile.kernel26?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/Makefile.kernel26 (original)
+++ branches/1.2/wcte12xp/Makefile.kernel26 Sat Dec  8 11:04:11 2007
@@ -1,9 +1,19 @@
 obj-m += wcte12xp.o
 
+EXTRA_CFLAGS := -I$(src)/.. -Wno-undef
+
 wcte12xp-objs := base.o vpmadt032.o GpakApi.o
+
+ifneq ($(HOTPLUG_FIRMWARE),yes)
+wcte12xp-objs += firmware_vpmadt032.o
+endif
 
 $(obj)/base.o: $(src)/../zaptel.h
 
 $(obj)/vpmadt032.o: $(src)/vpmadt032.h
 
 $(obj)/GpakApi.o: $(src)/GpakApi.h
+
+$(obj)/firmware_vpmadt032.o: $(src)/VPMADT032.bin $(obj)/base.o
+	@echo Making firmware object file for $(notdir $<)
+	@cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o

Modified: branches/1.2/wcte12xp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/base.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/base.c (original)
+++ branches/1.2/wcte12xp/base.c Sat Dec  8 11:04:11 2007
@@ -1,5 +1,5 @@
 /*
- * Digium, Inc.  Wildcard TE12xP T1/PRI card Driver
+ * Digium, Inc.  Wildcard TE12xP T1/E1 card Driver
  *
  * Written by Michael Spiceland <mspiceland at digium.com>
  *
@@ -36,16 +36,13 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/proc_fs.h>
-
-#ifdef STANDALONE_ZAPATA
-#include "../zaptel.h"
-#else
-#include <zaptel/zaptel.h>
-#endif
+#include <linux/interrupt.h>
 
 #ifdef LINUX26
 #include <linux/moduleparam.h>
 #endif
+
+#include "zaptel.h"
 
 #include "../wct4xxp/wct4xxp.h"	/* For certain definitions */
 

Modified: branches/1.2/wcte12xp/vpmadt032.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/vpmadt032.c?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/vpmadt032.c (original)
+++ branches/1.2/wcte12xp/vpmadt032.c Sat Dec  8 11:04:11 2007
@@ -1,8 +1,44 @@
+/*
+ * Digium, Inc.  Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland at digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster at digium.com>
+ *            Matthew Fredrickson <creslin at digium.com>
+ *            William Meadows <wmeadows at digium.com>
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ */
+
+#include <linux/delay.h>
+#include <asm/semaphore.h>
+#include <linux/pci.h> 
+#include <linux/firmware.h> 
+#include <linux/list.h> 
+
+#include "zaptel.h"
+
 #include "wcte12xp.h"
 #include "vpmadt032.h"
 #include "GpakApi.h"
-#include <linux/delay.h>
-#include <asm/semaphore.h>
 
 extern struct t1 *ifaces[WC_MAX_IFACES];
 
@@ -485,7 +521,7 @@
 {
 	struct vpm150m *vpm150m = data;
 #else
-static void vpm150m_debug_bh(void *data)
+static void vpm150m_debug_bh(struct work_struct *data)
 {
 	struct vpm150m *vpm150m = container_of(data, struct vpm150m, work_debug);
 #endif
@@ -509,7 +545,7 @@
 {
 	struct vpm150m *vpm150m = data;
 #else
-static void vpm150m_dtmf_bh(void *data)
+static void vpm150m_dtmf_bh(struct work_struct *data)
 {
 	struct vpm150m *vpm150m = container_of(data, struct vpm150m, work_dtmf);
 #endif
@@ -568,8 +604,9 @@
 				debug_printk(1, "Channel %d: Detected DTMF tone %d of duration %d\n", channel + 1, tone, duration);
 
 				if (test_bit(channel, &wc->dtmfmask) && (eventdata.toneEvent.ToneDuration > 0)) {
+					struct zt_chan *chan = &wc->chans[channel];
+
 					module_printk("DTMF detected channel=%d tone=%d duration=%d\n", channel + 1, tone, duration);
-					struct zt_chan *chan = &wc->chans[channel];
 
 					if ((tone != EndofMFDigit) && (zaptone != 0)) {
 						vpm150m->curtone[channel] = tone;
@@ -609,9 +646,18 @@
 	unsigned short i;
 	unsigned short reg;
 	unsigned long flags;
-	struct t1_firmware fw;
 	gpakPingDspStat_t pingstatus;
 	gpakDownloadStatus_t downloadstatus;
+	struct t1_firmware fw;
+	struct firmware embedded_firmware;
+	const struct firmware *firmware = &embedded_firmware;
+#if !defined(HOTPLUG_FIRMWARE)
+	extern void _binary_vpmadt032_bin_size;
+	extern u8 _binary_vpmadt032_bin_start[];
+#else
+	static const char vpmadt032_firmware[] = "VPMADT032.bin";
+#endif
+
 #if 0
 	unsigned short omsg[4] = { 0xdead, 0xbeef, 0x1111, 0x2222};
 	unsigned short imsg[4];
@@ -819,11 +865,18 @@
 
 	if (pingstatus || (version != 0x106)) {
 #endif
+#if defined(HOTPLUG_FIRMWARE)
+		if ((request_firmware(&firmware, vpmadt032_firmware, &wc->dev->dev) != 0) ||
+		    !firmware) {
+			printk("VPMADT032: firmware %s not available from userspace\n", vpmadt032_firmware);
+			return;
+		}
+#else
+		embedded_firmware.data = _binary_vpmadt032_bin_start;
+		embedded_firmware.size = (size_t) &_binary_vpmadt032_bin_size;
+#endif
+		fw.fw = firmware;
 		fw.offset = 0;
-		if (request_firmware(&fw.fw, vpm150m_firmware, &wc->dev->dev)) {
-			module_printk("Unable to locate .bin firmware file!\n");
-			goto failed_exit;
-		}
 
 		set_bit(VPM150M_HPIRESET, &vpm150m->control);
 
@@ -833,7 +886,8 @@
 		module_printk("VPMADT032 Loading firwmare... ");
 		downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw);
 
-		release_firmware(fw.fw);
+		if (firmware != &embedded_firmware)
+			release_firmware(firmware);
 
 		if (downloadstatus != 0) {
 			module_printk("Unable to download firmware to VPMADT032 with cause %d\n", downloadstatus);
@@ -1261,4 +1315,3 @@
 }
 
 #endif
-

Modified: branches/1.2/wcte12xp/vpmadt032.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/vpmadt032.h?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/vpmadt032.h (original)
+++ branches/1.2/wcte12xp/vpmadt032.h Sat Dec  8 11:04:11 2007
@@ -1,11 +1,37 @@
+/*
+ * Digium, Inc.  Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland at digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster at digium.com>
+ *            Matthew Fredrickson <creslin at digium.com>
+ *            William Meadows <wmeadows at digium.com>
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ */
+
 #ifndef _VPM150M_H
 #define _VPM150M_H
 
-#include "../zaptel.h"
 #include "wcte12xp.h"
-#include <linux/pci.h> 
-#include <linux/firmware.h> 
-#include <linux/list.h> 
 
 struct t1_firmware {
 	const struct firmware *fw;
@@ -44,8 +70,6 @@
 #define VPM150M_DTMFDETECT		3
 #define VPM150M_ACTIVE			4
 #define VPM150M_MAX_DATA		1
-
-static const char *vpm150m_firmware = "VPMADT032.bin";
 
 struct vpm150m_cmd {
 	unsigned short address;
@@ -118,4 +142,5 @@
     unsigned char *pBuffer,	    /* pointer to buffer for storing bytes */
     unsigned int NumBytes       /* number of bytes to read */
     );
+
 #endif

Modified: branches/1.2/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/wcte12xp/wcte12xp.h?view=diff&rev=3365&r1=3364&r2=3365
==============================================================================
--- branches/1.2/wcte12xp/wcte12xp.h (original)
+++ branches/1.2/wcte12xp/wcte12xp.h Sat Dec  8 11:04:11 2007
@@ -1,7 +1,35 @@
+/*
+ * Digium, Inc.  Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland at digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster at digium.com>
+ *            Matthew Fredrickson <creslin at digium.com>
+ *            William Meadows <wmeadows at digium.com>
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ */
+
 #ifndef _WCTE12XP_H
 #define _WCTE12XP_H
-
-#include "../zaptel.h"
 
 /* Comment to disable VPM support */
 #define VPM_SUPPORT 1
@@ -63,7 +91,7 @@
 
 #define module_printk(fmt, args...) printk("%s: " fmt, te12xp_driver.name, ## args)
 #define debug_printk(level, fmt, args...) if (debug >= level) printk("%s (%s): " fmt, te12xp_driver.name, __FUNCTION__, ## args)
-																				extern spinlock_t ifacelock;
+extern spinlock_t ifacelock;
 
 struct command {
 	unsigned short address;




More information about the zaptel-commits mailing list