summaryrefslogtreecommitdiff
path: root/wcte12xp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
commitdb2602ee74c907582858c1225bb0fffffe604a00 (patch)
treef08c566c96008fdca60d6231c653f4804ad5e263 /wcte12xp
parentb6c017d1b25f9621fd6738419b6cd1377ca6eb3e (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 'wcte12xp')
-rw-r--r--wcte12xp/GpakApi.c2
-rw-r--r--wcte12xp/Makefile.kernel2610
-rw-r--r--wcte12xp/VPMADT032.binbin0 -> 60980 bytes
-rw-r--r--wcte12xp/base.c11
-rw-r--r--wcte12xp/vpmadt032.c77
-rw-r--r--wcte12xp/vpmadt032.h37
-rw-r--r--wcte12xp/wcte12xp.h34
7 files changed, 143 insertions, 28 deletions
diff --git a/wcte12xp/GpakApi.c b/wcte12xp/GpakApi.c
index 0b599c8..641de88 100644
--- a/wcte12xp/GpakApi.c
+++ b/wcte12xp/GpakApi.c
@@ -15,6 +15,8 @@
* 11/15/2006 - 24 TDM-TDM Channels EC release
*/
+#include "zaptel.h"
+
#include "GpakHpi.h"
#include "vpmadt032.h"
#include "GpakApi.h"
diff --git a/wcte12xp/Makefile.kernel26 b/wcte12xp/Makefile.kernel26
index c692631..c41e8f1 100644
--- a/wcte12xp/Makefile.kernel26
+++ b/wcte12xp/Makefile.kernel26
@@ -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
diff --git a/wcte12xp/VPMADT032.bin b/wcte12xp/VPMADT032.bin
new file mode 100644
index 0000000..e882060
--- /dev/null
+++ b/wcte12xp/VPMADT032.bin
Binary files differ
diff --git a/wcte12xp/base.c b/wcte12xp/base.c
index 3bc49ae..fd5a010 100644
--- a/wcte12xp/base.c
+++ b/wcte12xp/base.c
@@ -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@digium.com>
*
@@ -36,17 +36,14 @@
#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 */
#include "wcte12xp.h"
diff --git a/wcte12xp/vpmadt032.c b/wcte12xp/vpmadt032.c
index 92af63e..aa9cb9d 100644
--- a/wcte12xp/vpmadt032.c
+++ b/wcte12xp/vpmadt032.c
@@ -1,8 +1,44 @@
+/*
+ * Digium, Inc. Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland@digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster@digium.com>
+ * Matthew Fredrickson <creslin@digium.com>
+ * William Meadows <wmeadows@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 @@ static void vpm150m_debug_bh(void *data)
{
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 @@ static void vpm150m_dtmf_bh(void *data)
{
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,9 +604,10 @@ static void vpm150m_dtmf_bh(void *data)
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)) {
- module_printk("DTMF detected channel=%d tone=%d duration=%d\n", channel + 1, tone, duration);
struct zt_chan *chan = &wc->chans[channel];
+ module_printk("DTMF detected channel=%d tone=%d duration=%d\n", channel + 1, tone, duration);
+
if ((tone != EndofMFDigit) && (zaptone != 0)) {
vpm150m->curtone[channel] = tone;
@@ -609,9 +646,18 @@ void t1_vpm150m_init(struct t1 *wc) {
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 @@ void t1_vpm150m_init(struct t1 *wc) {
if (pingstatus || (version != 0x106)) {
#endif
- 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;
+#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);
@@ -833,7 +886,8 @@ void t1_vpm150m_init(struct t1 *wc) {
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 @@ int vpm150m_config_hw(struct t1 *wc)
}
#endif
-
diff --git a/wcte12xp/vpmadt032.h b/wcte12xp/vpmadt032.h
index 5d8ae53..55620f1 100644
--- a/wcte12xp/vpmadt032.h
+++ b/wcte12xp/vpmadt032.h
@@ -1,11 +1,37 @@
+/*
+ * Digium, Inc. Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland@digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster@digium.com>
+ * Matthew Fredrickson <creslin@digium.com>
+ * William Meadows <wmeadows@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;
@@ -45,8 +71,6 @@ typedef struct t1_firmware* GPAK_FILE_ID; /* G.PAK Download file identifier */
#define VPM150M_ACTIVE 4
#define VPM150M_MAX_DATA 1
-static const char *vpm150m_firmware = "VPMADT032.bin";
-
struct vpm150m_cmd {
unsigned short address;
unsigned short data[VPM150M_MAX_DATA];
@@ -118,4 +142,5 @@ int gpakReadFile(
unsigned char *pBuffer, /* pointer to buffer for storing bytes */
unsigned int NumBytes /* number of bytes to read */
);
+
#endif
diff --git a/wcte12xp/wcte12xp.h b/wcte12xp/wcte12xp.h
index 7c1560e..2edc109 100644
--- a/wcte12xp/wcte12xp.h
+++ b/wcte12xp/wcte12xp.h
@@ -1,8 +1,36 @@
+/*
+ * Digium, Inc. Wildcard TE12xP T1/E1 card Driver
+ *
+ * Written by Michael Spiceland <mspiceland@digium.com>
+ *
+ * Adapted from the wctdm24xxp and wcte11xp drivers originally
+ * written by Mark Spencer <markster@digium.com>
+ * Matthew Fredrickson <creslin@digium.com>
+ * William Meadows <wmeadows@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;