[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-nodummy r6978 - in /linux/team/sr...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 12 15:15:59 CDT 2009


Author: sruffell
Date: Wed Aug 12 15:15:55 2009
New Revision: 6978

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6978
Log:
Merged revisions 6862-6863,6890-6891,6897,6926-6933,6938,6941,6945-6946,6951-6952,6961,6966-6967,6971 via svnmerge from 
https://origsvn.digium.com/svn/dahdi/linux/trunk

........
  r6862 | sruffell | 2009-07-21 12:52:59 -0500 (Tue, 21 Jul 2009) | 4 lines
  
  Revert "wct4xxp, wcte11xp: Use the default configuration by default at startup."
  
  This reverts the change introduced by revision 6712.  This change can cause
  problems when there is a VPM module installed on the quad-span digital cards.
........
  r6863 | sruffell | 2009-07-21 12:53:02 -0500 (Tue, 21 Jul 2009) | 12 lines
  
  dahdi-base: Add support for core timing.
  
  This essentially moves the function of dahdi_dummy into the core of DAHDI.  It
  ensures that if DAHDI is loaded, it will always be able to provide timing,
  regardless of whether there are board drivers loaded, or if the board drivers
  are properly calling dahdi_receive.
  
  If there is a master span loaded which is calling dahdi_receive, then the
  behavior will be like it is normally.
  
  This functionality is off by default, uncomment CONFIG_DAHDI_CORE_TIMER in
  include/dahdi/config_dahdi.h in order to enable it.
........
  r6890 | sruffell | 2009-07-23 17:01:04 -0500 (Thu, 23 Jul 2009) | 1 line
  
  dahdi-base: Reduce the stack usage of ioctl_load_zone.
........
  r6891 | sruffell | 2009-07-23 17:26:25 -0500 (Thu, 23 Jul 2009) | 3 lines
  
  dahdi-base: Update formatting in ioctl_load_zone.
  
  Fixes checkpatch.pl formatting errors from the previous commit.
........
  r6897 | dbrooks | 2009-07-27 14:52:38 -0500 (Mon, 27 Jul 2009) | 6 lines
  
  Replace typos "recieved" with "received".
  
  (closes issue #15571)
  Reported by: alecdavis
........
  r6926 | sruffell | 2009-08-04 11:22:17 -0500 (Tue, 04 Aug 2009) | 1 line
  
  wctdm24xxp: We no longer need to keep our own reference count.
........
  r6927 | sruffell | 2009-08-04 11:22:20 -0500 (Tue, 04 Aug 2009) | 1 line
  
  wctdm24xxp: Remove some unused members from struct wctdm.
........
  r6928 | sruffell | 2009-08-04 11:22:23 -0500 (Tue, 04 Aug 2009) | 1 line
  
  wcte12xp: Remove unused 'schluffen' declaration in wcte12xp.h
........
  r6929 | sruffell | 2009-08-04 11:22:26 -0500 (Tue, 04 Aug 2009) | 4 lines
  
  wctdm24xxp: Eliminate 'variety' and 'type' members from 'struct wctdm'.
  
  struct wctdm can hold a pointer to struct wctdm_desc directly, and eliminate
  the need to copy members of wctdm_desc into wctdm.
........
  r6930 | sruffell | 2009-08-04 11:22:29 -0500 (Tue, 04 Aug 2009) | 4 lines
  
  wcte12xp: Remove the vpm_num from 'struct command'
  
  This member wasn't necessary anymore since the VPM commands are kept on a
  separate queue now.
........
  r6931 | sruffell | 2009-08-04 11:22:32 -0500 (Tue, 04 Aug 2009) | 4 lines
  
  wcte12xp: Remove unnecessary usage of keyword volatile.
  
  The buffers are not being accessed by the hardware at this point, and
  therefore do not need to be volatile.
........
  r6932 | sruffell | 2009-08-04 11:22:36 -0500 (Tue, 04 Aug 2009) | 1 line
  
  wctdm24xxp: txints and rxints duplicate intcount. Remove them.
........
  r6933 | sruffell | 2009-08-04 11:22:39 -0500 (Tue, 04 Aug 2009) | 10 lines
  
  dahdi_dummy: Do not allow jumps in system time to lock up the system.
  
  Since dahdi_dummy uses the number of milliseconds that has actually passed to
  determine how many times to call dahdi_receive, it is possible that if the
  system time shifts after dahdi is started, that the system can appear to lock
  up while dahdi_dummy attempts to catch up.  This change prevents soft lock ups
  under these conditions.
  
  (closes issue #15647)
  Reported by: missnebun
........
  r6938 | tzafrir | 2009-08-04 12:10:31 -0500 (Tue, 04 Aug 2009) | 5 lines
  
  xpp firmware: Fixes PCM issue with FXO that is not a timing source
  
  Fixes PCM issue with an Astribank2 (116x) FXO module that is installed
  alongside a PRI/BRI module.
........
  r6941 | dbailey | 2009-08-05 09:40:45 -0500 (Wed, 05 Aug 2009) | 14 lines
  
  Change proslic linefeed register setting
  
  Insure that proslic linefeed register is not transitioned from Active to
  On-Hook Transmission while the channel is off-hook.
  Replaced magic numbers assigned to linefeed associated variables with more
  descriptive constants. 
  
  (issue #15352)
  Reported by: alecdavis
  Patches:
        wctdm_prevent_ohttimer_click.diff3.txt uploaded by dbailey (license 819)
  Tested by: alecdavis, dbailey, vmikhelson
........
  r6945 | sruffell | 2009-08-05 14:39:10 -0500 (Wed, 05 Aug 2009) | 6 lines
  
  wctdm24xxp, wctdm: Formatting changes.
  
  Update the lines affected by revision 6941. I'm taking every opportunity
  to move DAHDI closer to the kernel coding conventions short of just
  reformatting for the sake of reformatting. The majority of these changes
  are to bring the line lengths under 80 chars.
........
  r6946 | sruffell | 2009-08-05 14:39:13 -0500 (Wed, 05 Aug 2009) | 1 line
  
  dahdi_dummy: Remove some trailing whitespace.
........
  r6951 | sruffell | 2009-08-11 13:47:19 -0500 (Tue, 11 Aug 2009) | 1 line
  
  wcte12xp: Removing a few macros that are no longer used.
........
  r6952 | sruffell | 2009-08-11 13:47:21 -0500 (Tue, 11 Aug 2009) | 3 lines
  
  wctdm24xxp: Remove unused members related to hardware DTMF detection.
  
  Not used anymore, so they are gone.
........
  r6961 | sruffell | 2009-08-11 16:39:27 -0500 (Tue, 11 Aug 2009) | 4 lines
  
  wct4xxp-diag: Fixes to allow it to compile once more.
  
  This is just a debugging tool and wouldn't have affected any operational
  systems.
........
  r6966 | tzafrir | 2009-08-11 23:20:32 -0500 (Tue, 11 Aug 2009) | 2 lines
  
  xpp: FPGA_1161.hex r7276 . Minor PRI bugfixes.
........
  r6967 | tzafrir | 2009-08-11 23:49:47 -0500 (Tue, 11 Aug 2009) | 7 lines
  
  xpp: Don't check for the 'owner' field too soon
  
  The owner field should only tested after the low-level driver 
  pre-registration method is called.
  
  xpp rev: 7287
........
  r6971 | tzafrir | 2009-08-12 04:53:30 -0500 (Wed, 12 Aug 2009) | 6 lines
  
  live_dahdi: more drivers in subdirs; voicebus
  
  * wcb4xxp and wcte12xp should also be loaded from a subdirectory with
    their name.
  * wctdm24xxp and wcte12xp depend on the voicebus driver.
........

Modified:
    linux/team/sruffell/dahdi-linux-nodummy/   (props changed)
    linux/team/sruffell/dahdi-linux-nodummy/build_tools/live_dahdi
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi_dummy.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/proslic.h
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct1xxp.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct4xxp/wct4xxp-diag.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctc4xxp/base.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wcte12xp/wcte12xp.h
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/xpp/card_pri.c
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/xpp/firmwares/FPGA_1161.hex
    linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/xpp/xpp_dahdi.c
    linux/team/sruffell/dahdi-linux-nodummy/include/dahdi/dahdi_config.h

Propchange: linux/team/sruffell/dahdi-linux-nodummy/
------------------------------------------------------------------------------
    automerge = yes

Propchange: linux/team/sruffell/dahdi-linux-nodummy/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Aug 12 15:15:55 2009
@@ -1,1 +1,1 @@
-/linux/trunk:1-6853
+/linux/trunk:1-6977

Modified: linux/team/sruffell/dahdi-linux-nodummy/build_tools/live_dahdi
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/build_tools/live_dahdi?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/build_tools/live_dahdi (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/build_tools/live_dahdi Wed Aug 12 15:15:55 2009
@@ -70,7 +70,12 @@
 			fi
 			MODULES_LOAD="$MODULES_LOAD xpp/xpp_usb"
 			;;
-		wctdm24xxp | wct4xxp | wcte12xp | wctc4xp)
+		wctdm24xxp | wcte12xp)
+			# FIXME: better automation of the voicebus
+			# dependency:
+			MODULES_LOAD="$MODULES_LOAD voicebus/dahdi_voicebus $mod/$mod"
+				;;
+		wct4xxp | wcte12xp | wctc4xp | wcb4xxp)
 			MODULES_LOAD="$MODULES_LOAD $mod/$mod"
 				;;
 		wanpipe)

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi-base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi-base.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi-base.c Wed Aug 12 15:15:55 2009
@@ -2929,47 +2929,63 @@
 */
 static int ioctl_load_zone(unsigned long data)
 {
-	struct dahdi_tone *samples[MAX_TONES] = { NULL, };
-	short next[MAX_TONES] = { 0, };
-	struct dahdi_tone_def_header th;
-	struct dahdi_tone_def td;
-	struct dahdi_zone *z;
-	struct dahdi_tone *t;
-	void *slab, *ptr;
-	int x;
+	struct load_zone_workarea {
+		struct dahdi_tone *samples[MAX_TONES];
+		short next[MAX_TONES];
+		struct dahdi_tone_def_header th;
+		struct dahdi_tone_def td;
+	} *work;
+
 	size_t space;
 	size_t size;
 	int res;
-
-	if (copy_from_user(&th, (struct dahdi_tone_def_header *) data, sizeof(th)))
+	int x;
+	void *slab, *ptr;
+	struct dahdi_zone *z;
+	struct dahdi_tone *t;
+
+	work = kzalloc(sizeof(*work), GFP_KERNEL);
+	if (!work)
+		return -ENOMEM;
+
+	if (copy_from_user(&work->th, (struct dahdi_tone_def_header *)data,
+	    sizeof(work->th))) {
+		kfree(work);
 		return -EFAULT;
-
-	data += sizeof(th);
-
-	if ((th.count < 0) || (th.count > MAX_TONES)) {
+	}
+
+	data += sizeof(work->th);
+
+	if ((work->th.count < 0) || (work->th.count > MAX_TONES)) {
 		module_printk(KERN_NOTICE, "Too many tones included\n");
+		kfree(work);
 		return -EINVAL;
 	}
 
-	space = size = sizeof(*z) + th.count * sizeof(*t);
-
-	if (size > MAX_SIZE)
+	space = size = sizeof(*z) + work->th.count * sizeof(*t);
+
+	if (size > MAX_SIZE) {
+		kfree(work);
 		return -E2BIG;
-
-	if (!(z = ptr = slab = kzalloc(size, GFP_KERNEL)))
+	}
+
+	z = ptr = slab = kzalloc(size, GFP_KERNEL);
+	if (!z) {
+		kfree(work);
 		return -ENOMEM;
+	}
 
 	ptr += sizeof(*z);
 	space -= sizeof(*z);
 
-	dahdi_copy_string(z->name, th.name, sizeof(z->name));
+	dahdi_copy_string(z->name, work->th.name, sizeof(z->name));
 
 	for (x = 0; x < DAHDI_MAX_CADENCE; x++)
-		z->ringcadence[x] = th.ringcadence[x];
+		z->ringcadence[x] = work->th.ringcadence[x];
 
 	atomic_set(&z->refcount, 0);
 
-	for (x = 0; x < th.count; x++) {
+	for (x = 0; x < work->th.count; x++) {
 		enum {
 			REGULAR_TONE,
 			DTMF_TONE,
@@ -2980,82 +2996,94 @@
 
 		if (space < sizeof(*t)) {
 			kfree(slab);
+			kfree(work);
 			module_printk(KERN_NOTICE, "Insufficient tone zone space\n");
 			return -EINVAL;
 		}
 
-		if (copy_from_user(&td, (struct dahdi_tone_def *) data, sizeof(td))) {
+		res = copy_from_user(&work->td, (struct dahdi_tone_def *)data,
+				     sizeof(work->td));
+		if (res) {
 			kfree(slab);
+			kfree(work);
 			return -EFAULT;
 		}
 
-		data += sizeof(td);
-
-		if ((td.tone >= 0) && (td.tone < DAHDI_TONE_MAX)) {
+		data += sizeof(work->td);
+
+		if ((work->td.tone >= 0) && (work->td.tone < DAHDI_TONE_MAX)) {
 			tone_type = REGULAR_TONE;
 
-			t = samples[x] = ptr;
+			t = work->samples[x] = ptr;
 
 			space -= sizeof(*t);
 			ptr += sizeof(*t);
 
-			/* Remember which sample is next */
-			next[x] = td.next;
+			/* Remember which sample is work->next */
+			work->next[x] = work->td.next;
 
 			/* Make sure the "next" one is sane */
-			if ((next[x] >= th.count) || (next[x] < 0)) {
-				module_printk(KERN_NOTICE, "Invalid 'next' pointer: %d\n", next[x]);
+			if ((work->next[x] >= work->th.count) ||
+			    (work->next[x] < 0)) {
+				module_printk(KERN_NOTICE,
+					      "Invalid 'next' pointer: %d\n",
+					      work->next[x]);
 				kfree(slab);
+				kfree(work);
 				return -EINVAL;
 			}
-		} else if ((td.tone >= DAHDI_TONE_DTMF_BASE) &&
-			   (td.tone <= DAHDI_TONE_DTMF_MAX)) {
+		} else if ((work->td.tone >= DAHDI_TONE_DTMF_BASE) &&
+			   (work->td.tone <= DAHDI_TONE_DTMF_MAX)) {
 			tone_type = DTMF_TONE;
-			td.tone -= DAHDI_TONE_DTMF_BASE;
-			t = &z->dtmf[td.tone];
-		} else if ((td.tone >= DAHDI_TONE_MFR1_BASE) &&
-			   (td.tone <= DAHDI_TONE_MFR1_MAX)) {
+			work->td.tone -= DAHDI_TONE_DTMF_BASE;
+			t = &z->dtmf[work->td.tone];
+		} else if ((work->td.tone >= DAHDI_TONE_MFR1_BASE) &&
+			   (work->td.tone <= DAHDI_TONE_MFR1_MAX)) {
 			tone_type = MFR1_TONE;
-			td.tone -= DAHDI_TONE_MFR1_BASE;
-			t = &z->mfr1[td.tone];
-		} else if ((td.tone >= DAHDI_TONE_MFR2_FWD_BASE) &&
-			   (td.tone <= DAHDI_TONE_MFR2_FWD_MAX)) {
+			work->td.tone -= DAHDI_TONE_MFR1_BASE;
+			t = &z->mfr1[work->td.tone];
+		} else if ((work->td.tone >= DAHDI_TONE_MFR2_FWD_BASE) &&
+			   (work->td.tone <= DAHDI_TONE_MFR2_FWD_MAX)) {
 			tone_type = MFR2_FWD_TONE;
-			td.tone -= DAHDI_TONE_MFR2_FWD_BASE;
-			t = &z->mfr2_fwd[td.tone];
-		} else if ((td.tone >= DAHDI_TONE_MFR2_REV_BASE) &&
-			   (td.tone <= DAHDI_TONE_MFR2_REV_MAX)) {
+			work->td.tone -= DAHDI_TONE_MFR2_FWD_BASE;
+			t = &z->mfr2_fwd[work->td.tone];
+		} else if ((work->td.tone >= DAHDI_TONE_MFR2_REV_BASE) &&
+			   (work->td.tone <= DAHDI_TONE_MFR2_REV_MAX)) {
 			tone_type = MFR2_REV_TONE;
-			td.tone -= DAHDI_TONE_MFR2_REV_BASE;
-			t = &z->mfr2_rev[td.tone];
+			work->td.tone -= DAHDI_TONE_MFR2_REV_BASE;
+			t = &z->mfr2_rev[work->td.tone];
 		} else {
-			module_printk(KERN_NOTICE, "Invalid tone (%d) defined\n", td.tone);
+			module_printk(KERN_NOTICE,
+				      "Invalid tone (%d) defined\n",
+				      work->td.tone);
 			kfree(slab);
+			kfree(work);
 			return -EINVAL;
 		}
 
-		t->fac1 = td.fac1;
-		t->init_v2_1 = td.init_v2_1;
-		t->init_v3_1 = td.init_v3_1;
-		t->fac2 = td.fac2;
-		t->init_v2_2 = td.init_v2_2;
-		t->init_v3_2 = td.init_v3_2;
-		t->modulate = td.modulate;
+		t->fac1 = work->td.fac1;
+		t->init_v2_1 = work->td.init_v2_1;
+		t->init_v3_1 = work->td.init_v3_1;
+		t->fac2 = work->td.fac2;
+		t->init_v2_2 = work->td.init_v2_2;
+		t->init_v3_2 = work->td.init_v3_2;
+		t->modulate = work->td.modulate;
 
 		switch (tone_type) {
 		case REGULAR_TONE:
-			t->tonesamples = td.samples;
-			if (!z->tones[td.tone])
-				z->tones[td.tone] = t;
+			t->tonesamples = work->td.samples;
+			if (!z->tones[work->td.tone])
+				z->tones[work->td.tone] = t;
 			break;
 		case DTMF_TONE:
 			t->tonesamples = global_dialparams.dtmf_tonelen;
 			t->next = &dtmf_silence;
-			z->dtmf_continuous[td.tone] = *t;
-			z->dtmf_continuous[td.tone].next = &z->dtmf_continuous[td.tone];
+			z->dtmf_continuous[work->td.tone] = *t;
+			z->dtmf_continuous[work->td.tone].next =
+				&z->dtmf_continuous[work->td.tone];
 			break;
 		case MFR1_TONE:
-			switch (td.tone + DAHDI_TONE_MFR1_BASE) {
+			switch (work->td.tone + DAHDI_TONE_MFR1_BASE) {
 			case DAHDI_TONE_MFR1_KP:
 			case DAHDI_TONE_MFR1_ST:
 			case DAHDI_TONE_MFR1_STP:
@@ -3073,31 +3101,35 @@
 		case MFR2_FWD_TONE:
 			t->tonesamples = global_dialparams.mfr2_tonelen;
 			t->next = &dtmf_silence;
-			z->mfr2_fwd_continuous[td.tone] = *t;
-			z->mfr2_fwd_continuous[td.tone].next = &z->mfr2_fwd_continuous[td.tone];
+			z->mfr2_fwd_continuous[work->td.tone] = *t;
+			z->mfr2_fwd_continuous[work->td.tone].next =
+					&z->mfr2_fwd_continuous[work->td.tone];
 			break;
 		case MFR2_REV_TONE:
 			t->tonesamples = global_dialparams.mfr2_tonelen;
 			t->next = &dtmf_silence;
-			z->mfr2_rev_continuous[td.tone] = *t;
-			z->mfr2_rev_continuous[td.tone].next = &z->mfr2_rev_continuous[td.tone];
+			z->mfr2_rev_continuous[work->td.tone] = *t;
+			z->mfr2_rev_continuous[work->td.tone].next =
+					&z->mfr2_rev_continuous[work->td.tone];
 			break;
 		}
 	}
 
-	for (x = 0; x < th.count; x++) {
-		if (samples[x])
-			samples[x]->next = samples[next[x]];
-	}
-
-	if ((res = dahdi_register_tone_zone(th.zone, z))) {
+	for (x = 0; x < work->th.count; x++) {
+		if (work->samples[x])
+			work->samples[x]->next = work->samples[work->next[x]];
+	}
+
+	res = dahdi_register_tone_zone(work->th.zone, z);
+	if (res) {
 		kfree(slab);
 	} else {
 		if ( -1 == default_zone ) {
-			dahdi_set_default_zone(th.zone);
-		}
-	}
-
+			dahdi_set_default_zone(work->th.zone);
+		}
+	}
+
+	kfree(work);
 	return res;
 }
 

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi_dummy.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi_dummy.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi_dummy.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/dahdi_dummy.c Wed Aug 12 15:15:55 2009
@@ -161,12 +161,31 @@
 	unsigned long ms_since_start;
 	struct timespec now;
 	const unsigned long MAX_INTERVAL = 100000L;
+	const unsigned long MS_LIMIT = 3000;
 
 	if (!atomic_read(&shutdown))
 		mod_timer(&timer, jiffies + JIFFIES_INTERVAL);
 
 	now = current_kernel_time();
 	ms_since_start = timespec_diff_ms(&ztd->start_interval, &now);
+
+	/*
+	 * If the system time has changed, it is possible for us to be far
+	 * behind.  If we are more than MS_LIMIT milliseconds behind, just
+	 * reset our time base and continue so that we do not hang the system
+	 * here.
+	 *
+	 */
+	if (unlikely((ms_since_start - ztd->calls_since_start) > MS_LIMIT)) {
+		if (printk_ratelimit()) {
+			printk(KERN_INFO
+			       "dahdi_dummy: Detected time shift.\n");
+		}
+		ztd->calls_since_start = 0;
+		ztd->start_interval = now;
+		return;
+	}
+
 	while (ms_since_start > ztd->calls_since_start) {
 		ztd->calls_since_start++;
 		dahdi_receive(&ztd->span);

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/proslic.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/proslic.h?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/proslic.h (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/proslic.h Wed Aug 12 15:15:55 2009
@@ -34,6 +34,20 @@
 
 // Defines
 #define LPT 0X378
+
+/* Proslic Linefeed options for register 64 - Linefeed Control */
+#define SLIC_LF_OPEN		0x0
+#define SLIC_LF_ACTIVE_FWD	0x1
+#define SLIC_LF_OHTRAN_FWD	0x2 /* Forward On Hook Transfer */
+#define SLIC_LF_TIP_OPEN	0x3
+#define SLIC_LF_RINGING		0x4
+#define SLIC_LF_ACTIVE_REV	0x5
+#define SLIC_LF_OHTRAN_REV	0x6 /* Reverse On Hook Transfer */
+#define SLIC_LF_RING_OPEN	0x7
+
+/* Mask used to reverse the linefeed mode between forward and
+ * reverse polarity. */
+#define SLIC_LF_REVMASK 	0x4
 
 #define IDA_LO  28
 #define IDA_HI	29

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct1xxp.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct1xxp.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct1xxp.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct1xxp.c Wed Aug 12 15:15:55 2009
@@ -1101,7 +1101,7 @@
 		start_alarm(wc);
 		if (!(alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_LOOPBACK)) &&
 		    wc->sync) {
-			/* Use the recieve signalling */
+			/* Use the receive signalling */
 			wc->span.syncsrc = wc->span.spanno;
 			d |= 1;
 		} else {

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct4xxp/wct4xxp-diag.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct4xxp/wct4xxp-diag.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct4xxp/wct4xxp-diag.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wct4xxp/wct4xxp-diag.c Wed Aug 12 15:15:55 2009
@@ -18,10 +18,10 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <string.h>
-#include <dahdi/kernel.h>
+#include <dahdi/user.h>
 #include "wct4xxp.h"
 
-static struct t4_reg_def {
+struct t4_reg_def {
 	int reg;
 	char *name;
 	int global;

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctc4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctc4xxp/base.c Wed Aug 12 15:15:55 2009
@@ -2528,7 +2528,7 @@
 		receive_csm_encaps_packet(wc, cmd);
 	} else {
 		DTE_DEBUG(DTE_DEBUG_GENERAL,
-		   "Unknown packet protocol recieved: %04x.\n",
+		   "Unknown packet protocol received: %04x.\n",
 		   be16_to_cpu(ethhdr->h_proto));
 		free_cmd(cmd);
 	}

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm.c Wed Aug 12 15:15:55 2009
@@ -726,22 +726,23 @@
 
 static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card)
 {
+	struct fxs *const fxs = &wc->mod[card].fxs;
 	int res;
 	/* Check loopback */
 	res = wc->reg1shadow[card];
-	if (!res && (res != wc->mod[card].fxs.lasttxhook)) {
+	if (!res && (res != fxs->lasttxhook)) {
 		res = wctdm_getreg(wc, card, 8);
 		if (res) {
 			printk(KERN_NOTICE "Ouch, part reset, quickly restoring reality (%d)\n", card);
 			wctdm_init_proslic(wc, card, 1, 0, 1);
 		} else {
-			if (wc->mod[card].fxs.palarms++ < MAX_ALARMS) {
+			if (fxs->palarms++ < MAX_ALARMS) {
 				printk(KERN_NOTICE "Power alarm on module %d, resetting!\n", card + 1);
-				if (wc->mod[card].fxs.lasttxhook == 4)
-					wc->mod[card].fxs.lasttxhook = 1;
-				wctdm_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook);
+				if (fxs->lasttxhook == SLIC_LF_RINGING)
+					fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;
+				wctdm_setreg(wc, card, 64, fxs->lasttxhook);
 			} else {
-				if (wc->mod[card].fxs.palarms == MAX_ALARMS)
+				if (fxs->palarms == MAX_ALARMS)
 					printk(KERN_NOTICE "Too many power alarms on card %d, NOT resetting!\n", card + 1);
 			}
 		}
@@ -965,6 +966,7 @@
 
 static inline void wctdm_proslic_check_hook(struct wctdm *wc, int card)
 {
+	struct fxs *const fxs = &wc->mod[card].fxs;
 	char res;
 	int hook;
 
@@ -973,47 +975,63 @@
 
 	res = wc->reg0shadow[card];
 	hook = (res & 1);
-	if (hook != wc->mod[card].fxs.lastrxhook) {
+	if (hook != fxs->lastrxhook) {
 		/* Reset the debounce (must be multiple of 4ms) */
-		wc->mod[card].fxs.debounce = 8 * (4 * 8);
+		fxs->debounce = 8 * (4 * 8);
 #if 0
-		printk(KERN_DEBUG "Resetting debounce card %d hook %d, %d\n", card, hook, wc->mod[card].fxs.debounce);
+		printk(KERN_DEBUG "Resetting debounce card %d hook %d, %d\n",
+		       card, hook, fxs->debounce);
 #endif
 	} else {
-		if (wc->mod[card].fxs.debounce > 0) {
-			wc->mod[card].fxs.debounce-= 16 * DAHDI_CHUNKSIZE;
+		if (fxs->debounce > 0) {
+			fxs->debounce -= 16 * DAHDI_CHUNKSIZE;
 #if 0
-			printk(KERN_DEBUG "Sustaining hook %d, %d\n", hook, wc->mod[card].fxs.debounce);
+			printk(KERN_DEBUG "Sustaining hook %d, %d\n",
+			       hook, fxs->debounce);
 #endif
-			if (!wc->mod[card].fxs.debounce) {
+			if (!fxs->debounce) {
 #if 0
 				printk(KERN_DEBUG "Counted down debounce, newhook: %d...\n", hook);
 #endif
-				wc->mod[card].fxs.debouncehook = hook;
+				fxs->debouncehook = hook;
 			}
-			if (!wc->mod[card].fxs.oldrxhook && wc->mod[card].fxs.debouncehook) {
+			if (!fxs->oldrxhook && fxs->debouncehook) {
 				/* Off hook */
 #if 1
 				if (debug)
 #endif				
 					printk(KERN_DEBUG "wctdm: Card %d Going off hook\n", card);
+
+				switch (fxs->lasttxhook) {
+				case SLIC_LF_RINGING:
+				case SLIC_LF_OHTRAN_FWD:
+				case SLIC_LF_OHTRAN_REV:
+					/* just detected OffHook, during
+					 * Ringing or OnHookTransfer */
+					fxs->idletxhookstate =
+						POLARITY_XOR(card) ?
+							SLIC_LF_ACTIVE_REV :
+							SLIC_LF_ACTIVE_FWD;
+					break;
+				}
+
 				dahdi_hooksig(wc->chans[card], DAHDI_RXSIG_OFFHOOK);
 				if (robust)
 					wctdm_init_proslic(wc, card, 1, 0, 1);
-				wc->mod[card].fxs.oldrxhook = 1;
+				fxs->oldrxhook = 1;
 			
-			} else if (wc->mod[card].fxs.oldrxhook && !wc->mod[card].fxs.debouncehook) {
+			} else if (fxs->oldrxhook && !fxs->debouncehook) {
 				/* On hook */
 #if 1
 				if (debug)
 #endif				
 					printk(KERN_DEBUG "wctdm: Card %d Going on hook\n", card);
 				dahdi_hooksig(wc->chans[card], DAHDI_RXSIG_ONHOOK);
-				wc->mod[card].fxs.oldrxhook = 0;
+				fxs->oldrxhook = 0;
 			}
 		}
 	}
-	wc->mod[card].fxs.lastrxhook = hook;
+	fxs->lastrxhook = hook;
 }
 
 DAHDI_IRQ_HANDLER(wctdm_interrupt)
@@ -1045,27 +1063,40 @@
 	for (x=0;x<4;x++) {
 		if (wc->cardflag & (1 << x) &&
 		    (wc->modtype[x] == MOD_TYPE_FXS)) {
-			if (wc->mod[x].fxs.lasttxhook == 0x4) {
+			struct fxs *const fxs = &wc->mod[x].fxs;
+			if (fxs->lasttxhook == SLIC_LF_RINGING) {
 				/* RINGing, prepare for OHT */
-				wc->mod[x].fxs.ohttimer = OHT_TIMER << 3;
+				fxs->ohttimer = OHT_TIMER << 3;
 
 				/* logical XOR 3 variables
 				    module parameter 'reversepolarity', global reverse all FXS lines. 
 				    ioctl channel variable fxs 'reversepolarity', Line Reversal Alert Signal if required.
 				    ioctl channel variable fxs 'vmwi_lrev', VMWI pending.
 				 */
-				wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x6 : 0x2;/* OHT mode when idle */
-			} else {
-				if (wc->mod[x].fxs.ohttimer) {
-					wc->mod[x].fxs.ohttimer-= DAHDI_CHUNKSIZE;
-					if (!wc->mod[x].fxs.ohttimer) {
-						wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x5 : 0x1; /* Switch to Active : Reverse Forward */
-						if ((wc->mod[x].fxs.lasttxhook == 0x2) || (wc->mod[x].fxs.lasttxhook == 0x6)) {
-							/* Apply the change if appropriate */
-							wc->mod[x].fxs.lasttxhook = POLARITY_XOR(x) ? 0x5 : 0x1;
-							wctdm_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook);
-						}
-					}
+
+				/* OHT mode when idle */
+				fxs->idletxhookstate = POLARITY_XOR(x) ?
+							SLIC_LF_OHTRAN_REV :
+							SLIC_LF_OHTRAN_FWD;
+			} else if (fxs->ohttimer) {
+				fxs->ohttimer -= DAHDI_CHUNKSIZE;
+				if (fxs->ohttimer)
+					continue;
+
+				/* Switch to Active : Reverse Forward */
+				fxs->idletxhookstate = POLARITY_XOR(x) ?
+							SLIC_LF_ACTIVE_REV :
+							SLIC_LF_ACTIVE_FWD;
+
+				if ((fxs->lasttxhook == SLIC_LF_OHTRAN_FWD) ||
+				    (fxs->lasttxhook == SLIC_LF_OHTRAN_REV)) {
+					/* Apply the change if appropriate */
+					fxs->lasttxhook = POLARITY_XOR(x) ?
+							   SLIC_LF_ACTIVE_REV :
+							   SLIC_LF_ACTIVE_FWD;
+
+					wctdm_setreg(wc, x, 64,
+						     fxs->lasttxhook);
 				}
 			}
 		}
@@ -1453,6 +1484,7 @@
 
 static int set_vmwi(struct wctdm * wc, int chan_idx)
 {
+	struct fxs *const fxs = &wc->mod[chan_idx].fxs;
 	if (wc->mod[chan_idx].fxs.vmwi_active_messages){
 		wc->mod[chan_idx].fxs.vmwi_lrev = (wc->mod[chan_idx].fxs.vmwisetting.vmwi_type & DAHDI_VMWI_LREV)?1:0;
 		wc->mod[chan_idx].fxs.vmwi_hvdc = (wc->mod[chan_idx].fxs.vmwisetting.vmwi_type & DAHDI_VMWI_HVDC)?1:0;
@@ -1473,21 +1505,21 @@
 			  );
 	}
 	if (POLARITY_XOR(chan_idx)) {
-		wc->mod[chan_idx].fxs.idletxhookstate |= 0x4;
+		wc->mod[chan_idx].fxs.idletxhookstate |= SLIC_LF_REVMASK;
 		/* Do not set while currently ringing or open */
-		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
-				  wc->mod[chan_idx ].fxs.lasttxhook != 0x00) {
-			wc->mod[chan_idx ].fxs.lasttxhook |= 0x4;
+		if ((fxs->lasttxhook != SLIC_LF_RINGING) &&
+		    (fxs->lasttxhook != SLIC_LF_OPEN)) {
+			fxs->lasttxhook |= SLIC_LF_REVMASK;
+			wctdm_setreg(wc, chan_idx, 64, fxs->lasttxhook);
+		}
+	} else {
+		wc->mod[chan_idx].fxs.idletxhookstate &= ~SLIC_LF_REVMASK;
+		/* Do not set while currently ringing or open */
+		if ((fxs->lasttxhook != SLIC_LF_RINGING) &&
+		    (fxs->lasttxhook != SLIC_LF_OPEN)) {
+			wc->mod[chan_idx].fxs.lasttxhook &= ~SLIC_LF_REVMASK;
 			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
-				  }
-	} else {
-		wc->mod[chan_idx].fxs.idletxhookstate &= ~0x04;
-		/* Do not set while currently ringing or open */
-		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
-				  wc->mod[chan_idx].fxs.lasttxhook != 0x00) {
-			wc->mod[chan_idx].fxs.lasttxhook &= ~0x04;
-			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
-				  }
+		}
 	}
 	return 0;
 }
@@ -1618,9 +1650,9 @@
 				
 	/* By default, don't send on hook */
 	if (!reversepolarity != !wc->mod[card].fxs.reversepolarity)
-		wc->mod[card].fxs.idletxhookstate = 5;
+		wc->mod[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_REV;
 	else
-		wc->mod[card].fxs.idletxhookstate = 1;
+		wc->mod[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_FWD;
 
 	if (sane) {
 		/* Make sure we turn off the DC->DC converter to prevent anything from blowing up */
@@ -1849,6 +1881,7 @@
 	struct wctdm_echo_coefs echoregs;
 	struct dahdi_hwgain hwgain;
 	struct wctdm *wc = chan->pvt;
+	struct fxs *const fxs = &wc->mod[chan->chanpos - 1].fxs;
 	int x;
 	switch (cmd) {
 	case DAHDI_ONHOOKTRANSFER:
@@ -1857,10 +1890,18 @@
 		if (get_user(x, (__user int *) data))
 			return -EFAULT;
 		wc->mod[chan->chanpos - 1].fxs.ohttimer = x << 3;
-		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? 0x6 : 0x2;	/* OHT mode when idle */
-		if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x1 || wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x5) {
+
+		/* Active mode when idle */
+		fxs->idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ?
+					SLIC_LF_ACTIVE_REV :
+					SLIC_LF_ACTIVE_FWD;
+
+		if ((fxs->lasttxhook == SLIC_LF_ACTIVE_FWD) ||
+		    (fxs->lasttxhook == SLIC_LF_ACTIVE_REV)) {
 			/* Apply the change if appropriate */
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook = POLARITY_XOR(chan->chanpos - 1) ? 0x6 : 0x2;
+			fxs->lasttxhook = POLARITY_XOR(chan->chanpos - 1) ?
+						SLIC_LF_OHTRAN_REV :
+						SLIC_LF_OHTRAN_FWD;
 			wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook);
 		}
 		break;
@@ -1870,15 +1911,15 @@
 		if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
 			return -EINVAL;
 		/* Can't change polarity while ringing or when open */
-		if ((wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x04) ||
-		    (wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x00))
+		if ((fxs->lasttxhook == SLIC_LF_RINGING) ||
+		    (fxs->lasttxhook == SLIC_LF_OPEN))
 			return -EINVAL;
 		
 		wc->mod[chan->chanpos - 1].fxs.reversepolarity = x;
 		if ( POLARITY_XOR(chan->chanpos - 1) )
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook |= 0x04;
+			fxs->lasttxhook |= SLIC_LF_REVMASK;
 		else
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook &= ~0x04;
+			fxs->lasttxhook &= ~SLIC_LF_REVMASK;
 		wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook);
 		break;
 	case DAHDI_VMWI_CONFIG:
@@ -2007,7 +2048,11 @@
 	struct wctdm *wc = chan->pvt;
 	wc->usecount--;
 	if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) {
-		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? 0x5 : 0x1;
+		int idlehookstate;
+		idlehookstate = POLARITY_XOR(chan->chanpos - 1) ?
+						SLIC_LF_ACTIVE_REV :
+						SLIC_LF_ACTIVE_FWD;
+		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = idlehookstate;
 	}
 	/* If we're dead, release us now */
 	if (!wc->usecount && wc->dead) 
@@ -2035,45 +2080,51 @@
 			printk(KERN_NOTICE "wcfxo: Can't set tx state to %d\n", txsig);
 		}
 	} else {
+		struct fxs *const fxs = &wc->mod[chan->chanpos - 1].fxs;
 		switch(txsig) {
 		case DAHDI_TXSIG_ONHOOK:
 			switch(chan->sig) {
 			case DAHDI_SIG_FXOKS:
 			case DAHDI_SIG_FXOLS:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = (wc->mod[chan->chanpos-1].fxs.vmwi_hvac ? 4 : wc->mod[chan->chanpos-1].fxs.idletxhookstate);
+				fxs->lasttxhook = fxs->vmwi_hvac ?
+							SLIC_LF_RINGING :
+							fxs->idletxhookstate;
 				break;
 			case DAHDI_SIG_EM:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
+				fxs->lasttxhook = fxs->idletxhookstate;
 				break;
 			case DAHDI_SIG_FXOGS:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = 3;
+				fxs->lasttxhook = SLIC_LF_TIP_OPEN;
 				break;
 			}
 			break;
 		case DAHDI_TXSIG_OFFHOOK:
 			switch(chan->sig) {
 			case DAHDI_SIG_EM:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = 5;
+				fxs->lasttxhook = SLIC_LF_ACTIVE_REV;
 				break;
 			default:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
+				fxs->lasttxhook = fxs->idletxhookstate;
 				break;
 			}
 			break;
 		case DAHDI_TXSIG_START:
-			wc->mod[chan->chanpos-1].fxs.lasttxhook = 4;
+			fxs->lasttxhook = SLIC_LF_RINGING;
 			break;
 		case DAHDI_TXSIG_KEWL:
-			wc->mod[chan->chanpos-1].fxs.lasttxhook = 0;
+			fxs->lasttxhook = SLIC_LF_OPEN;
 			break;
 		default:
 			printk(KERN_NOTICE "wctdm: Can't set tx state to %d\n", txsig);
 		}
-		if (debug)
-			printk(KERN_DEBUG "Setting FXS hook state to %d (%02x)\n", txsig, wc->mod[chan->chanpos-1].fxs.lasttxhook);
+		if (debug) {
+			printk(KERN_DEBUG
+			       "Setting FXS hook state to %d (%02x)\n",
+			       txsig, fxs->lasttxhook);
+		}
 
 #if 1
-		wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos-1].fxs.lasttxhook);
+		wctdm_setreg(wc, chan->chanpos - 1, 64, fxs->lasttxhook);
 #endif
 	}
 	return 0;

Modified: linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=6978&r1=6977&r2=6978
==============================================================================
--- linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-nodummy/drivers/dahdi/wctdm24xxp/base.c Wed Aug 12 15:15:55 2009
@@ -161,17 +161,17 @@
 #include "fxo_modes.h"
 
 struct wctdm_desc {
-	char *name;
-	int flags;
-	int ports;
+	const char *name;
+	const int flags;
+	const int ports;
 };
 
-static struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 };
-static struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 };
-static struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 };
-static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", FLAG_EXPRESS, 24 };
-static struct wctdm_desc wcaex800 = { "Wildcard AEX800", FLAG_EXPRESS, 8 };
-static struct wctdm_desc wcaex410 = { "Wildcard AEX410", FLAG_EXPRESS, 4 };
+static const struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 };
+static const struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 };
+static const struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 };
+static const struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", FLAG_EXPRESS, 24 };
+static const struct wctdm_desc wcaex800 = { "Wildcard AEX800", FLAG_EXPRESS, 8 };
+static const struct wctdm_desc wcaex410 = { "Wildcard AEX410", FLAG_EXPRESS, 4 };
 
 static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 };
 
@@ -849,7 +849,7 @@
 			}
 
 			if (likely(wc->initialized)) {
-				if (y < wc->type)
+				if (y < wc->desc->ports)
 					writechunk[y] = wc->chans[y]->writechunk[x];
 			}
 			cmd_dequeue(wc, writechunk, y, x);
@@ -877,7 +877,7 @@
 			writechunk[EFRAME_SIZE] = wc->ctlreg;
 			writechunk[EFRAME_SIZE + 1] = wc->txident++;
 
-			if ((wc->type == 4) && ((wc->ctlreg & 0x10) || (wc->modtype[NUM_CARDS] == MOD_TYPE_NONE))) {
+			if ((wc->desc->ports == 4) && ((wc->ctlreg & 0x10) || (wc->modtype[NUM_CARDS] == MOD_TYPE_NONE))) {
 				writechunk[EFRAME_SIZE + 2] = 0;
 				for (y = 0; y < 4; y++) {
 					if (wc->modtype[y] == MOD_TYPE_NONE)
@@ -1031,11 +1031,8 @@
 			}
 		}
 		for (y=0;y < wc->cards;y++) {
-			if (likely(wc->initialized)) {
-				if (y < wc->type) {
-					wc->chans[y]->readchunk[x] = readchunk[y];
-				}
-			}	
+			if (likely(wc->initialized) && (y < wc->desc->ports))
+				wc->chans[y]->readchunk[x] = readchunk[y];
 			cmd_decipher(wc, readchunk, y);
 		}
 		if (wc->vpm100) {
@@ -1049,7 +1046,7 @@
 	}
 	/* XXX We're wasting 8 taps.  We should get closer :( */
 	if (likely(wc->initialized)) {
-		for (x=0;x<wc->type;x++) {
+		for (x = 0; x < wc->desc->ports; x++) {
 			if (wc->cardflag & (1 << x))
 				dahdi_ec_chunk(wc->chans[x], wc->chans[x]->readchunk, wc->chans[x]->writechunk);
 		}
@@ -1187,56 +1184,61 @@
 
 static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card)
 {
+	struct fxs *const fxs = &wc->mods[card].fxs;
 	int res;
 #ifdef PAQ_DEBUG
 	res = wc->cmdq[card].isrshadow[1];
 	res &= ~0x3;
 	if (res) {
 		wc->cmdq[card].isrshadow[1]=0;
-		wc->mods[card].fxs.palarms++;
-		if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
+		fxs->palarms++;
+		if (fxs->palarms < MAX_ALARMS) {
 			printk(KERN_NOTICE "Power alarm (%02x) on module %d, resetting!\n", res, card + 1);
-			if (wc->mods[card].fxs.lasttxhook == 4) {
-				wc->mods[card].fxs.lasttxhook = POLARITY_XOR(card) ? 0x15 : 0x11;
+			if (fxs->lasttxhook == SLIC_LF_RINGING) {
+				fxs->lasttxhook = 0x10 | POLARITY_XOR(card) ?
+							   SLIC_LF_ACTIVE_REV :
+							   SLIC_LF_ACTIVE_FWD;
 			}
 			wc->sethook[card] = CMD_WR(19, res);
 #if 0
-			wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook);
+			wc->sethook[card] = CMD_WR(64, fxs->lasttxhook);
 #endif
 
-			/* wctdm_setreg_intr(wc, card, 64, wc->mods[card].fxs.lasttxhook); */
+			/* wctdm_setreg_intr(wc, card, 64, fxs->lasttxhook); */
 			/* Update shadow register to avoid extra power alarms until next read */
 			wc->cmdq[card].isrshadow[1] = 0;
 		} else {
-			if (wc->mods[card].fxs.palarms == MAX_ALARMS)
+			if (fxs->palarms == MAX_ALARMS)
 				printk(KERN_NOTICE "Too many power alarms on card %d, NOT resetting!\n", card + 1);
 		}
 	}
 #else
 	res = wc->cmdq[card].isrshadow[1];
 	/* This makes sure the lasthook was put in reg 64 the linefeed reg */
-	if (((res & 0x0f) | 0x10) == wc->mods[card].fxs.lasttxhook) 
-		wc->mods[card].fxs.lasttxhook &= 0x0f;
+	if (((res & 0x0f) | 0x10) == fxs->lasttxhook)
+		fxs->lasttxhook &= 0x0f;
 
 	res = !res &&    /* reg 64 has to be zero at last isr read */
-		!(wc->mods[card].fxs.lasttxhook & 0x10 ) && /* not a transition */
-		wc->mods[card].fxs.lasttxhook; /* not an intended zero */
+		!(fxs->lasttxhook & 0x10) && /* not a transition */
+		fxs->lasttxhook; /* not an intended zero */
 	
 	if (res) {
-		wc->mods[card].fxs.palarms++;
-		if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
+		fxs->palarms++;
+		if (fxs->palarms < MAX_ALARMS) {
 			printk(KERN_NOTICE "Power alarm on module %d, resetting!\n", card + 1);
-			if (wc->mods[card].fxs.lasttxhook == 4) {

[... 3047 lines stripped ...]



More information about the svn-commits mailing list