From 72f1ad2419858a9a591bdd7deabedb750d8688e3 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Sat, 8 Dec 2007 17:28:28 +0000 Subject: Merged revisions 3365 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3365 | kpfleming | 2007-12-08 11:04:11 -0600 (Sat, 08 Dec 2007) | 5 lines 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.4@3366 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wctdm24xxp/GpakApi.c | 5 +++++ wctdm24xxp/GpakCust.c | 9 ++++++-- wctdm24xxp/base.c | 57 ++++++++++++++++++++++++++++++------------------- wctdm24xxp/wctdm24xxp.h | 29 ++++++++++++++++++++++--- 4 files changed, 73 insertions(+), 27 deletions(-) (limited to 'wctdm24xxp') 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 +#include + +#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 #include #include +#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/base.c b/wctdm24xxp/base.c index b2aff24..97efb5f 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 * Support for TDM800P and VPM150M by Matthew Fredrickson @@ -42,22 +42,27 @@ Tx Gain - W/Pre-Emphasis: -23.99 to 0.00 db #include #include #include -#ifdef VPM150M_SUPPORT -#include -#endif #include #include #include -#include "../proslic.h" -#include "../wctdm.h" -#include "GpakCust.h" -#include "GpakApi.h" +#ifdef LINUX26 +#include +#endif -/* Comment to disable VPM support */ +#ifdef VPM150M_SUPPORT +#include +#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 @@ -234,13 +239,6 @@ static struct fxo_mode { { "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, }, }; -#include "zaptel.h" - -#ifdef LINUX26 -#include -#endif - - #define DEBUG_CARD (1 << 0) #define DEBUG_ECHOCAN (1 << 1) @@ -287,8 +285,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 = "zaptel-fw-vpmadt032.bin"; #endif static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane); @@ -3607,6 +3603,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[] = "zaptel-fw-vpmadt032.bin"; +#endif gpakDownloadStatus_t downloadstatus; gpakPingDspStat_t pingstatus; #endif @@ -3698,10 +3702,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); @@ -3711,7 +3723,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 5fa99b9..71a473f 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 + * Support for TDM800P and VPM150M by Matthew Fredrickson + * + * 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 - #define NUM_FXO_REGS 60 #define WC_MAX_IFACES 128 -- cgit v1.2.3