[dahdi-commits] fjoe: freebsd/trunk r7749 - in /freebsd/trunk: drivers/dahdi/ drivers/dahdi/f...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Sat Jan 2 07:26:43 CST 2010


Author: fjoe
Date: Sat Jan  2 07:26:40 2010
New Revision: 7749

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7749
Log:
Merge from linux/trunk up to rev. 7748.

Modified:
    freebsd/trunk/drivers/dahdi/dahdi-base.c
    freebsd/trunk/drivers/dahdi/firmware/Makefile
    freebsd/trunk/drivers/dahdi/voicebus/voicebus.c
    freebsd/trunk/drivers/dahdi/wcb4xxp/Makefile   (props changed)
    freebsd/trunk/drivers/dahdi/wct4xxp/vpm450m.c
    freebsd/trunk/drivers/dahdi/wcte12xp/base.c
    freebsd/trunk/drivers/dahdi/xpp/card_fxo.c
    freebsd/trunk/drivers/dahdi/xpp/card_pri.c
    freebsd/trunk/drivers/dahdi/xpp/xpp_dahdi.c
    freebsd/trunk/include/dahdi/compat/bsd.h
    freebsd/trunk/include/dahdi/dahdi_config.h
    freebsd/trunk/include/dahdi/kernel.h

Modified: freebsd/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi-base.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi-base.c Sat Jan  2 07:26:40 2010
@@ -1328,9 +1328,12 @@
 	data[len - 1] = (fcs >> 8) & 0xff;
 }
 
-static int dahdi_reallocbufs(struct dahdi_chan *ss, int j, int numbufs)
-{
-	unsigned char *newbuf, *oldbuf;
+static int dahdi_reallocbufs(struct dahdi_chan *ss, int blocksize, int numbufs)
+{
+	unsigned char *newtxbuf = NULL;
+	unsigned char *newrxbuf = NULL;
+	unsigned char *oldtxbuf = NULL;
+	unsigned char *oldrxbuf = NULL;
 	unsigned long flags;
 	int x;
 
@@ -1342,25 +1345,32 @@
 		numbufs = DAHDI_MAX_NUM_BUFS;
 
 	/* We need to allocate our buffers now */
-	if (j) {
-		if (!(newbuf = kcalloc(j * 2, numbufs, GFP_KERNEL)))
+	if (blocksize) {
+		newtxbuf = kzalloc(blocksize * numbufs, GFP_KERNEL);
+		if (NULL == newtxbuf)
 			return -ENOMEM;
-	} else
-		newbuf = NULL;
-
-	/* Now that we've allocated our new buffer, we can safely
+		newrxbuf = kzalloc(blocksize * numbufs, GFP_KERNEL);
+		if (NULL == newrxbuf) {
+			kfree(newtxbuf);
+			return -ENOMEM;
+		}
+	}
+
+	/* Now that we've allocated our new buffers, we can safely
  	   move things around... */
 
 	spin_lock_irqsave(&ss->lock, flags);
 
-	ss->blocksize = j; /* set the blocksize */
-	oldbuf = ss->readbuf[0]; /* Keep track of the old buffer */
+	ss->blocksize = blocksize; /* set the blocksize */
+	oldrxbuf = ss->readbuf[0]; /* Keep track of the old buffer */
+	oldtxbuf = ss->writebuf[0];
 	ss->readbuf[0] = NULL;
 
-	if (newbuf) {
+	if (newrxbuf) {
+		BUG_ON(NULL == newtxbuf);
 		for (x = 0; x < numbufs; x++) {
-			ss->readbuf[x] = newbuf + x * j;
-			ss->writebuf[x] = newbuf + (numbufs + x) * j;
+			ss->readbuf[x] = newrxbuf + x * blocksize;
+			ss->writebuf[x] = newtxbuf + x * blocksize;
 		}
 	} else {
 		for (x = 0; x < numbufs; x++) {
@@ -1379,7 +1389,7 @@
 
 	/* Keep track of where our data goes (if it goes
 	   anywhere at all) */
-	if (newbuf) {
+	if (newrxbuf) {
 		ss->inreadbuf = 0;
 		ss->inwritebuf = 0;
 	} else {
@@ -1403,8 +1413,8 @@
 
 	spin_unlock_irqrestore(&ss->lock, flags);
 
-	if (oldbuf)
-		kfree(oldbuf);
+	kfree(oldtxbuf);
+	kfree(oldrxbuf);
 
 	return 0;
 }
@@ -5700,6 +5710,10 @@
 				kfree(rxgain);
 			if (oldconf) dahdi_check_conf(oldconf);
 		}
+#ifdef	DAHDI_AUDIO_NOTIFY
+		if (chan->span->audio_notify)
+			chan->span->audio_notify(chan, j);
+#endif
 		break;
 	case DAHDI_HDLCPPP:
 #ifdef CONFIG_DAHDI_PPP
@@ -7307,7 +7321,7 @@
 						ss->ec_state->status.mode = ECHO_MODE_STARTTRAINING;
 					}
 				}
-				if ((ss->ec_state->status.mode == ECHO_MODE_AWAITINGECHO) && (txlin > 8000)) {
+				if (ss->ec_state->status.mode == ECHO_MODE_AWAITINGECHO) {
 					ss->ec_state->status.last_train_tap = 0;
 					ss->ec_state->status.mode = ECHO_MODE_TRAINING;
 				}

Modified: freebsd/trunk/drivers/dahdi/firmware/Makefile
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/firmware/Makefile?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/firmware/Makefile (original)
+++ freebsd/trunk/drivers/dahdi/firmware/Makefile Sat Jan  2 07:26:40 2010
@@ -7,8 +7,17 @@
 #
 # Joshua Colp <jcolp at digium.com>
 #
+#
+# See http://www.asterisk.org for more information about
+# the Asterisk project. Please do not directly contact
+# any of the maintainers of this project for assistance;
+# the project provides a web site, mailing lists and IRC
+# channels for your use.
+#
 # This program is free software, distributed under the terms of
-# the GNU General Public License
+# the GNU General Public License Version 2 as published by the
+# Free Software Foundation. See the LICENSE file included with
+# this program for more details.
 #
 
 .PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object firmware-loaders

Modified: freebsd/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/voicebus.c Sat Jan  2 07:26:40 2010
@@ -1733,7 +1733,7 @@
 	 * this driver. */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 	vb->buffer_cache = kmem_cache_create(board_name, vb->framesize, 0,
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22)
+#if defined(CONFIG_SLUB) && (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22))
 				SLAB_HWCACHE_ALIGN | SLAB_STORE_USER, NULL, NULL);
 #else
 				SLAB_HWCACHE_ALIGN, NULL, NULL);

Propchange: freebsd/trunk/drivers/dahdi/wcb4xxp/Makefile
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan  2 07:26:40 2010
@@ -1,1 +1,1 @@
-/linux/trunk/drivers/dahdi/wcb4xxp/Makefile:7418-7668
+/linux/trunk/drivers/dahdi/wcb4xxp/Makefile:7418-7748

Modified: freebsd/trunk/drivers/dahdi/wct4xxp/vpm450m.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wct4xxp/vpm450m.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/wct4xxp/vpm450m.c (original)
+++ freebsd/trunk/drivers/dahdi/wct4xxp/vpm450m.c Sat Jan  2 07:26:40 2010
@@ -42,8 +42,6 @@
 #else
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #include <linux/config.h>
-#else
-#include <linux/autoconf.h>
 #endif
 #endif /* !__FreeBSD__ */
 

Modified: freebsd/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wcte12xp/base.c Sat Jan  2 07:26:40 2010
@@ -1883,7 +1883,7 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 	cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct command), 0,
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22)
+#if defined(CONFIG_SLUB) && (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22))
 				SLAB_HWCACHE_ALIGN | SLAB_STORE_USER, NULL, NULL);
 #else
 				SLAB_HWCACHE_ALIGN, NULL, NULL);

Modified: freebsd/trunk/drivers/dahdi/xpp/card_fxo.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/xpp/card_fxo.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/xpp/card_fxo.c (original)
+++ freebsd/trunk/drivers/dahdi/xpp/card_fxo.c Sat Jan  2 07:26:40 2010
@@ -170,7 +170,7 @@
 static const char *power2str(enum power_state pw)
 {
 	switch(pw) {
-		case POWER_UNKNOWN:	return "UNKOWN";
+		case POWER_UNKNOWN:	return "UNKNOWN";
 		case POWER_OFF:		return "OFF";
 		case POWER_ON:		return "ON";
 	}

Modified: freebsd/trunk/drivers/dahdi/xpp/card_pri.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/xpp/card_pri.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/xpp/card_pri.c (original)
+++ freebsd/trunk/drivers/dahdi/xpp/card_pri.c Sat Jan  2 07:26:40 2010
@@ -551,25 +551,44 @@
 	return 1;
 }
 
-static void pri_pcm_update(xpd_t *xpd)
-{
-	struct PRI_priv_data	*priv;
-	int			channels = xpd->channels;
-	xpp_line_t		mask = BITMASK(xpd->channels);
+static void PRI_card_pcm_recompute(xbus_t *xbus, xpd_t *xpd,
+		xpp_line_t pcm_mask)
+{
+	struct PRI_priv_data	*priv;
+	int			i;
+	int			line_count = 0;
+	unsigned long		flags;
 	uint			pcm_len;
-	unsigned long		flags;
-
-	priv = xpd->priv;
+
+	BUG_ON(!xpd);
+	priv = xpd->priv;
+	spin_lock_irqsave(&xpd->lock_recompute_pcm, flags);
+	//XPD_DBG(SIGNAL, xpd, "pcm_mask=0x%X\n", pcm_mask);
+	/* Add/remove all the trivial cases */
+	pcm_mask |= xpd->offhook_state;
+	for_each_line(xpd, i)
+		if (IS_SET(pcm_mask, i))
+			line_count++;
 	if(priv->is_cas) {
 		if(priv->pri_protocol == PRI_PROTO_E1) {
 			/* CAS: Don't send PCM to D-Channel */
-			channels--;
-			mask &= ~BIT(PRI_DCHAN_IDX(priv));
-		}
-	}
-	pcm_len = RPACKET_HEADERSIZE + sizeof(xpp_line_t)  +  channels * DAHDI_CHUNKSIZE;
-	spin_lock_irqsave(&xpd->lock_recompute_pcm, flags);
-	update_wanted_pcm_mask(xpd, mask, pcm_len);
+			line_count--;
+			pcm_mask &= ~BIT(PRI_DCHAN_IDX(priv));
+		}
+	}
+	/*
+	 * FIXME: Workaround a bug in sync code of the Astribank.
+	 *        Send dummy PCM for sync.
+	 */
+	if (xpd->addr.unit == 0 && pcm_mask == 0) {
+		pcm_mask = BIT(0);
+		line_count = 1;
+	}
+	pcm_len = (line_count)
+		? RPACKET_HEADERSIZE + sizeof(xpp_line_t) +
+			line_count * DAHDI_CHUNKSIZE
+		: 0L;
+	update_wanted_pcm_mask(xpd, pcm_mask, pcm_len);
 	spin_unlock_irqrestore(&xpd->lock_recompute_pcm, flags);
 }
 
@@ -631,7 +650,8 @@
 	priv->pri_protocol = set_proto;
 	priv->is_cas = -1;
 	xpd->channels = pri_num_channels(set_proto);
-	pri_pcm_update(xpd);
+	xpd->offhook_state = BITMASK(xpd->channels);
+	CALL_XMETHOD(card_pcm_recompute, xpd->xbus, xpd, 0);
 	priv->deflaw = deflaw;
 	priv->dchan_num = dchan_num;
 	priv->local_loopback = 0;
@@ -1016,7 +1036,7 @@
 		force_cas = 1;
 		set_mode_cas(xpd, 1);
 	}
-	pri_pcm_update(xpd);
+	CALL_XMETHOD(card_pcm_recompute, xpd->xbus, xpd, 0);
 	/*
 	 * E1's can enable CRC checking
 	 * CRC4 is legal only for E1, and it is checked by pri_linecompat()
@@ -1238,6 +1258,19 @@
 	return 0;
 }
 
+#ifdef	DAHDI_AUDIO_NOTIFY
+static int pri_audio_notify(struct dahdi_chan *chan, int on)
+{
+	xpd_t		*xpd = chan->pvt;
+	int		pos = chan->chanpos - 1;
+
+	BUG_ON(!xpd);
+	LINE_DBG(SIGNAL, xpd, pos, "PRI-AUDIO: %s\n", (on) ? "on" : "off");
+	mark_offhook(xpd, pos, on);
+	return 0;
+}
+#endif
+
 static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
 {
 	xbus_t			*xbus;
@@ -1279,12 +1312,14 @@
 	}
 	if(!priv->is_cas)
 		clear_bit(DAHDI_FLAGBIT_RBS, &xpd->span.flags);
-	xpd->offhook_state = xpd->wanted_pcm_mask;
 	xpd->span.spanconfig = pri_spanconfig;
 	xpd->span.chanconfig = pri_chanconfig;
 	xpd->span.startup = pri_startup;
 	xpd->span.shutdown = pri_shutdown;
 	xpd->span.rbsbits = pri_rbsbits;
+#ifdef	DAHDI_AUDIO_NOTIFY
+	xpd->span.audio_notify = pri_audio_notify;
+#endif
 	return 0;
 }
 
@@ -1436,18 +1471,24 @@
 
 static int PRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg)
 {
+	struct dahdi_chan	*chan;
+
 	BUG_ON(!xpd);
 	if(!XBUS_IS(xpd->xbus, READY))
 		return -ENODEV;
+	chan = XPD_CHAN(xpd, pos);
 	switch (cmd) {
 		case DAHDI_TONEDETECT:
 			/*
 			 * Asterisk call all span types with this (FXS specific)
 			 * call. Silently ignore it.
 			 */
-			LINE_DBG(SIGNAL, xpd, pos, "PRI: Starting a call\n");
-			/* fall-through */
+			LINE_DBG(SIGNAL, xpd, pos, "PRI: TONEDETECT (%s)\n",
+				(chan->flags & DAHDI_FLAG_AUDIO) ?
+					"AUDIO" : "SILENCE");
+			return -ENOTTY;
 		case DAHDI_ONHOOKTRANSFER:
+			LINE_DBG(SIGNAL, xpd, pos, "PRI: ONHOOKTRANSFER\n");
 			return -ENOTTY;
 		default:
 			report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd);
@@ -2098,7 +2139,7 @@
 		.card_dahdi_preregistration	= PRI_card_dahdi_preregistration,
 		.card_dahdi_postregistration	= PRI_card_dahdi_postregistration,
 		.card_tick	= PRI_card_tick,
-		.card_pcm_recompute	= generic_card_pcm_recompute,
+		.card_pcm_recompute	= PRI_card_pcm_recompute,
 		.card_pcm_fromspan	= PRI_card_pcm_fromspan,
 		.card_pcm_tospan	= PRI_card_pcm_tospan,
 		.card_ioctl	= PRI_card_ioctl,
@@ -2634,6 +2675,11 @@
 	if((ret = xpd_driver_register(&pri_driver.driver)) < 0)
 		return ret;
 	INFO("revision %s\n", XPP_VERSION);
+#ifdef	DAHDI_AUDIO_NOTIFY
+	INFO("FEATURE: WITH DAHDI_AUDIO_NOTIFY\n");
+#else
+	INFO("FEATURE: WITHOUT DAHDI_AUDIO_NOTIFY\n");
+#endif
 	xproto_register(&PROTO_TABLE(PRI));
 	return 0;
 }

Modified: freebsd/trunk/drivers/dahdi/xpp/xpp_dahdi.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/xpp/xpp_dahdi.c?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/drivers/dahdi/xpp/xpp_dahdi.c (original)
+++ freebsd/trunk/drivers/dahdi/xpp/xpp_dahdi.c Sat Jan  2 07:26:40 2010
@@ -593,12 +593,12 @@
 		xpd_t *xpd = xpd_of(xbus, i);
 		if(xpd) {
 			if(SPAN_REGISTERED(xpd)) {
-				int i;
+				int j;
 
 				dahdi_alarm_notify(&xpd->span);
 				XPD_DBG(DEVICES, xpd, "Queuing DAHDI_EVENT_REMOVED on all channels to ask user to release them\n");
-				for (i=0; i<xpd->span.channels; i++) {
-					dahdi_qevent_lock(XPD_CHAN(xpd, i),DAHDI_EVENT_REMOVED);
+				for (j=0; j<xpd->span.channels; j++) {
+					dahdi_qevent_lock(XPD_CHAN(xpd, j),DAHDI_EVENT_REMOVED);
 				}
 			}
 			xpd_device_unregister(xpd);

Modified: freebsd/trunk/include/dahdi/compat/bsd.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/compat/bsd.h?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/include/dahdi/compat/bsd.h (original)
+++ freebsd/trunk/include/dahdi/compat/bsd.h Sat Jan  2 07:26:40 2010
@@ -103,6 +103,11 @@
 		if (cond)				\
 			printf("WARN_ON: " #cond "\n");	\
 	} while (0)
+#define BUG_ON(cond)					\
+	do {						\
+		if (cond)				\
+			panic("BUG_ON: " #cond);	\
+	} while (0)
 
 #define KERN_EMERG	"<0>"	/* system is unusable			*/
 #define KERN_ALERT	"<1>"	/* action must be taken immediately	*/

Modified: freebsd/trunk/include/dahdi/dahdi_config.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/dahdi_config.h?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/include/dahdi/dahdi_config.h (original)
+++ freebsd/trunk/include/dahdi/dahdi_config.h Sat Jan  2 07:26:40 2010
@@ -24,8 +24,6 @@
 #include <linux/version.h>
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #include <linux/config.h>
-#else
-#include <linux/autoconf.h>
 #endif
 #endif /* !__FreeBSD__ */
 #endif
@@ -176,5 +174,9 @@
 /* #define	OPTIMIZE_CHANMUTE */
 
 
+/*
+ * Pass DAHDI_AUDIOMODE to channel driver as well
+ */
+#define	DAHDI_AUDIO_NOTIFY
 
 #endif

Modified: freebsd/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/kernel.h?view=diff&rev=7749&r1=7748&r2=7749
==============================================================================
--- freebsd/trunk/include/dahdi/kernel.h (original)
+++ freebsd/trunk/include/dahdi/kernel.h Sat Jan  2 07:26:40 2010
@@ -878,6 +878,11 @@
 
 	/*! Opt: Used to tell an onboard HDLC controller that there is data ready to transmit */
 	void (*hdlc_hard_xmit)(struct dahdi_chan *chan);
+
+#ifdef	DAHDI_AUDIO_NOTIFY
+	/*! Opt: audio is used, don't optimize out */
+	int (*audio_notify)(struct dahdi_chan *chan, int yes);
+#endif
 
 	/* Used by DAHDI only -- no user servicable parts inside */
 	int spanno;			/*!< Span number for DAHDI */




More information about the dahdi-commits mailing list