diff options
author | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-08 17:04:11 +0000 |
---|---|---|
committer | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-08 17:04:11 +0000 |
commit | db2602ee74c907582858c1225bb0fffffe604a00 (patch) | |
tree | f08c566c96008fdca60d6231c653f4804ad5e263 /wctdm24xxp | |
parent | b6c017d1b25f9621fd6738419b6cd1377ca6eb3e (diff) |
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
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3365 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp')
-rw-r--r-- | wctdm24xxp/GpakApi.c | 5 | ||||
-rw-r--r-- | wctdm24xxp/GpakCust.c | 9 | ||||
-rw-r--r-- | wctdm24xxp/Makefile.kernel26 | 8 | ||||
-rw-r--r-- | wctdm24xxp/base.c | 61 | ||||
-rw-r--r-- | wctdm24xxp/wctdm24xxp.h | 29 |
5 files changed, 81 insertions, 31 deletions
diff --git a/wctdm24xxp/GpakApi.c b/wctdm24xxp/GpakApi.c index e52f9ab..5641e97 100644 --- a/wctdm24xxp/GpakApi.c +++ b/wctdm24xxp/GpakApi.c @@ -15,6 +15,11 @@ * 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" #include "GpakApi.h" diff --git a/wctdm24xxp/GpakCust.c b/wctdm24xxp/GpakCust.c index aefb406..4005e97 100644 --- a/wctdm24xxp/GpakCust.c +++ b/wctdm24xxp/GpakCust.c @@ -17,11 +17,14 @@ * */ -#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) { switch (tone) { @@ -386,5 +389,7 @@ int gpakReadFile( fw->offset += count; return count; +#else + return 0; #endif } diff --git a/wctdm24xxp/Makefile.kernel26 b/wctdm24xxp/Makefile.kernel26 index f9fbf0c..43b641c 100644 --- a/wctdm24xxp/Makefile.kernel26 +++ b/wctdm24xxp/Makefile.kernel26 @@ -4,9 +4,17 @@ 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 $(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 diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c index 81dfc74..740af36 100644 --- a/wctdm24xxp/base.c +++ b/wctdm24xxp/base.c @@ -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@digium.com> * Support for TDM800P and VPM150M by Matthew Fredrickson <creslin@digium.com> @@ -32,22 +32,27 @@ #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" -#include "GpakCust.h" -#include "GpakApi.h" +#ifdef LINUX26 +#include <linux/moduleparam.h> +#endif -/* Comment to disable VPM support */ +#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" + /* Experimental max loop current limit for the proslic Loop current limit is from 20 mA to 41 mA in steps of 3 @@ -224,17 +229,6 @@ static struct fxo_mode { { "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 vpmsupport = 1; 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 @@ static void wctdm_vpm150m_init(struct wctdm *wc) #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 @@ static void wctdm_vpm150m_init(struct wctdm *wc) if (pingstatus || (version != 0x106)) { #endif - fw.offset = 0; - if (request_firmware(&fw.fw, vpm150m_firmware, &wc->dev->dev)) { - printk("Unable to locate VPMADT032.bin firmware!\n"); +#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; set_bit(VPM150M_HPIRESET, &vpm150m->control); @@ -3073,7 +3081,8 @@ static void wctdm_vpm150m_init(struct wctdm *wc) 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); diff --git a/wctdm24xxp/wctdm24xxp.h b/wctdm24xxp/wctdm24xxp.h index 40f919c..98f9a36 100644 --- a/wctdm24xxp/wctdm24xxp.h +++ b/wctdm24xxp/wctdm24xxp.h @@ -1,9 +1,32 @@ +/* + * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface + * + * Written by Mark Spencer <markster@digium.com> + * Support for TDM800P and VPM150M by Matthew Fredrickson <creslin@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 #define WC_MAX_IFACES 128 |