From 0c9ef5638b491cea7d32b722d6e224fc696fdbbf Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 21 Aug 2007 18:40:23 +0000 Subject: Allow wctdm24xxp to compile on a 2.4 based kernel git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2923 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wctdm24xxp/GpakCust.c | 2 ++ wctdm24xxp/GpakCust.h | 2 ++ wctdm24xxp/base.c | 29 +++++++++++++++++++++++++++-- wctdm24xxp/wctdm24xxp.h | 6 ++++++ 4 files changed, 37 insertions(+), 2 deletions(-) (limited to 'wctdm24xxp') diff --git a/wctdm24xxp/GpakCust.c b/wctdm24xxp/GpakCust.c index bdce428..aefb406 100644 --- a/wctdm24xxp/GpakCust.c +++ b/wctdm24xxp/GpakCust.c @@ -368,6 +368,7 @@ int gpakReadFile( unsigned int NumBytes /* number of bytes to read */ ) { +#ifdef VPM150M_SUPPORT struct wctdm_firmware *fw = FileId; unsigned int i, count; @@ -385,4 +386,5 @@ int gpakReadFile( fw->offset += count; return count; +#endif } diff --git a/wctdm24xxp/GpakCust.h b/wctdm24xxp/GpakCust.h index dfb6103..96fb522 100644 --- a/wctdm24xxp/GpakCust.h +++ b/wctdm24xxp/GpakCust.h @@ -21,7 +21,9 @@ #define _GPAKCUST_H #include "wctdm24xxp.h" +#ifdef VPM150M_SUPPORT #include +#endif #include "gpakenum.h" diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c index 8bc1fd4..e0ad2c2 100644 --- a/wctdm24xxp/base.c +++ b/wctdm24xxp/base.c @@ -32,7 +32,9 @@ #include #include #include +#ifdef VPM150M_SUPPORT #include +#endif #include #include #include @@ -445,6 +447,7 @@ static inline void cmd_dequeue_vpm150m(struct wctdm *wc, volatile unsigned char } } +#ifdef VPM150M_SUPPORT /* Add our leds in */ for (x = 24; x < 28; x++) writechunk[CMD_BYTE(x, 0, 0)] |= leds; @@ -452,6 +455,7 @@ static inline void cmd_dequeue_vpm150m(struct wctdm *wc, volatile unsigned char /* Now let's figure out if we need to check for DTMF */ if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(wc->intcount % 100)) queue_work(vpm150m->wq, &vpm150m->work); +#endif spin_unlock_irqrestore(&wc->reglock, flags); } @@ -1387,6 +1391,7 @@ static int wctdm_echocan(struct zt_chan *chan, int eclen) wctdm_vpm_out(wc,unit,channel,0x01); return 0; +#ifdef VPM150M_SUPPORT } else if (wc->vpm150m) { struct vpm150m *vpm150m = wc->vpm150m; @@ -1400,6 +1405,7 @@ static int wctdm_echocan(struct zt_chan *chan, int eclen) queue_work(vpm150m->wq, &vpm150m->work); } return 0; +#endif } else return -ENODEV; } @@ -2552,6 +2558,9 @@ static void wctdm_disable_interrupts(struct wctdm *wc) } #ifdef VPM_SUPPORT + +#ifdef VPM150M_SUPPORT + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) static void vpm150m_bh(void *data) { @@ -2896,16 +2905,20 @@ static int vpm150m_config_hw(struct wctdm *wc) return 0; } +#endif /* VPM150M_SUPPORT */ static void wctdm_vpm150m_init(struct wctdm *wc) { unsigned short i; struct vpm150m *vpm150m; unsigned short reg; + unsigned long flags; + +#ifdef VPM150M_SUPPORT struct wctdm_firmware fw; gpakDownloadStatus_t downloadstatus; gpakPingDspStat_t pingstatus; - unsigned long flags; +#endif if (!vpmsupport) { printk("VPM: Support Disabled\n"); @@ -2977,6 +2990,12 @@ static void wctdm_vpm150m_init(struct wctdm *wc) if (debug & DEBUG_ECHOCAN) printk("Passed\n"); +#ifndef VPM150M_SUPPORT + printk("Found VPMADT032 module but it is not able to function in anything less than a version 2.6 kernel\n"); + printk("Please update your kernel to a 2.6 or later kernel to enable it\n"); + goto failed_exit; +#else + #if 0 /* Load the firmware */ set_bit(VPM150M_SPIRESET, &vpm150m->control); @@ -3035,6 +3054,7 @@ static void wctdm_vpm150m_init(struct wctdm *wc) } return; +#endif /* VPM150M_SUPPORT */ failed_exit: spin_lock_irqsave(&wc->reglock, flags); @@ -3460,11 +3480,15 @@ static void wctdm_release(struct wctdm *wc) static void __devexit wctdm_remove_one(struct pci_dev *pdev) { - unsigned long flags; struct wctdm *wc = pci_get_drvdata(pdev); + +#ifdef VPM150M_SUPPORT + unsigned long flags; struct vpm150m *vpm150m = wc->vpm150m; +#endif if (wc) { +#ifdef VPM150M_SUPPORT if (vpm150m) { clear_bit(VPM150M_DTMFDETECT, &vpm150m->control); clear_bit(VPM150M_ACTIVE, &vpm150m->control); @@ -3478,6 +3502,7 @@ static void __devexit wctdm_remove_one(struct pci_dev *pdev) kfree(wc->vpm150m); } +#endif /* Stop any DMA */ wctdm_stop_dma(wc); diff --git a/wctdm24xxp/wctdm24xxp.h b/wctdm24xxp/wctdm24xxp.h index dff0b38..89d708e 100644 --- a/wctdm24xxp/wctdm24xxp.h +++ b/wctdm24xxp/wctdm24xxp.h @@ -87,6 +87,10 @@ #define VPM_SUPPORT +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +#define VPM150M_SUPPORT +#endif + #ifdef VPM_SUPPORT /* Define to get more attention-grabbing but slightly more CPU using echocan status */ @@ -103,8 +107,10 @@ struct vpm150m_cmd { }; struct vpm150m { +#ifdef VPM150M_SUPPORT struct workqueue_struct *wq; struct work_struct work; +#endif struct wctdm *wc; int dspid; -- cgit v1.2.3