[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-spancleanup r7036 - in /linux/tea...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Aug 18 10:01:41 CDT 2009
Author: sruffell
Date: Tue Aug 18 10:01:38 2009
New Revision: 7036
URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=7036
Log:
dahdi_ops-wip: Move the dacs into the call back function.
Modified:
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c?view=diff&rev=7036&r1=7035&r2=7036
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c Tue Aug 18 10:01:38 2009
@@ -497,6 +497,22 @@
conf_sums_next = sums + (DAHDI_MAX_CONF + 1) * ((pos + 2) % 3);
pos = (pos + 1) % 3;
memset(conf_sums_next, 0, maxconfs * sizeof(sumtype));
+}
+
+static int dahdi_chan_dacs(struct dahdi_chan *chan1, struct dahdi_chan *chan2)
+{
+ if (chan2) {
+ if (chan1->span && chan2->span &&
+ (chan1->span->ops->dacs == chan2->span->ops->dacs))
+ return chan1->span->ops->dacs(chan1, chan2);
+ else
+ return -ENOSYS;
+ } else {
+ if (chan1->span && chan1->span->ops->dacs)
+ return chan1->span->ops->dacs(chan1, NULL);
+ else
+ return -ENOSYS;
+ }
}
/*!
@@ -1287,8 +1303,8 @@
memset(chan->conflast1, 0, sizeof(chan->conflast1));
memset(chan->conflast2, 0, sizeof(chan->conflast2));
- if (chan->span && chan->span->dacs && oldconf)
- chan->span->dacs(chan, NULL);
+ if (chan->span && oldconf)
+ dahdi_chan_dacs(chan, NULL);
if (ec_state) {
ec_state->ops->echocan_free(chan, ec_state);
@@ -1954,8 +1970,8 @@
/* release conference resource if any */
if (chans[x]->confna) {
dahdi_check_conf(chans[x]->confna);
- if (chans[x]->span && chans[x]->span->dacs)
- chans[x]->span->dacs(chans[x], NULL);
+ if (chans[x]->span)
+ dahdi_chan_dacs(chans[x], NULL);
}
chans[x]->confna = 0;
chans[x]->_confn = 0;
@@ -2557,8 +2573,7 @@
if ((chan->sig & __DAHDI_SIG_DACS) != __DAHDI_SIG_DACS) {
chan->confna = 0;
chan->confmode = 0;
- if (chan->span && chan->span->dacs)
- chan->span->dacs(chan, NULL);
+ dahdi_chan_dacs(chan, NULL);
}
chan->_confn = 0;
memset(chan->conflast, 0, sizeof(chan->conflast));
@@ -4073,14 +4088,9 @@
/* Setup conference properly */
chans[ch.chan]->confmode = DAHDI_CONF_DIGITALMON;
chans[ch.chan]->confna = ch.idlebits;
- if (chans[ch.chan]->span &&
- chans[ch.chan]->span->dacs &&
- chans[ch.idlebits] &&
- chans[ch.chan]->span &&
- (chans[ch.chan]->span->dacs == chans[ch.idlebits]->span->dacs))
- chans[ch.chan]->span->dacs(chans[ch.chan], chans[ch.idlebits]);
- } else if (chans[ch.chan]->span && chans[ch.chan]->span->dacs) {
- chans[ch.chan]->span->dacs(chans[ch.chan], NULL);
+ dahdi_chan_dacs(chans[ch.chan], chans[ch.idlebits]);
+ } else {
+ dahdi_chan_dacs(chans[ch.chan], NULL);
}
chans[ch.chan]->master = newmaster;
/* Note new slave if we are not our own master */
@@ -4705,17 +4715,15 @@
chans[i]->_confn = 0; /* Clear confn */
dahdi_check_conf(j);
dahdi_check_conf(stack.conf.confno);
- if (chans[i]->span && chans[i]->span->dacs) {
+ if (chans[i]->span && chans[i]->span->ops->dacs) {
if (((stack.conf.confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_DIGITALMON) &&
- chans[stack.conf.confno]->span &&
- chans[stack.conf.confno]->span->dacs == chans[i]->span->dacs &&
chans[i]->txgain == defgain &&
chans[i]->rxgain == defgain &&
chans[stack.conf.confno]->txgain == defgain &&
chans[stack.conf.confno]->rxgain == defgain) {
- chans[i]->span->dacs(chans[i], chans[stack.conf.confno]);
+ dahdi_chan_dacs(chans[i], chans[stack.conf.confno]);
} else {
- chans[i]->span->dacs(chans[i], NULL);
+ dahdi_chan_dacs(chans[i], NULL);
}
}
/* if we are going onto a conf */
@@ -5170,8 +5178,7 @@
/* initialize conference variables */
chan->_confn = 0;
chan->confna = 0;
- if (chan->span && chan->span->dacs)
- chan->span->dacs(chan, NULL);
+ dahdi_chan_dacs(chan, NULL);
chan->confmode = 0;
chan->confmute = 0;
memset(chan->conflast, 0, sizeof(chan->conflast));
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7036&r1=7035&r2=7036
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c Tue Aug 18 10:01:38 2009
@@ -1586,7 +1586,7 @@
*/
static unsigned int order_index[16];
-static const struct dahdi_span_ops t4_span_ops = {
+static const struct dahdi_span_ops t4_gen1_span_ops = {
.spanconfig = t4_spanconfig,
.chanconfig = t4_chanconfig,
.startup = t4_startup,
@@ -1597,6 +1597,20 @@
.close = t4_close,
.ioctl = t4_ioctl,
.hdlc_hard_xmit = t4_hdlc_hard_xmit,
+};
+
+static const struct dahdi_span_ops t4_gen2_span_ops = {
+ .spanconfig = t4_spanconfig,
+ .chanconfig = t4_chanconfig,
+ .startup = t4_startup,
+ .shutdown = t4_shutdown,
+ .rbsbits = t4_rbsbits,
+ .maint = t4_maint,
+ .open = t4_open,
+ .close = t4_close,
+ .ioctl = t4_ioctl,
+ .hdlc_hard_xmit = t4_hdlc_hard_xmit,
+ .dacs = t4_dacs,
};
static void init_spans(struct t4 *wc)
@@ -1659,20 +1673,23 @@
}
ts->span.chans = ts->chans;
ts->span.flags = DAHDI_FLAG_RBS;
+
+ ts->owner = wc;
+ ts->span.offset = x;
+ ts->writechunk = (void *)(wc->writechunk + x * 32 * 2);
+ ts->readchunk = (void *)(wc->readchunk + x * 32 * 2);
+ init_waitqueue_head(&ts->span.maintq);
+
if (gen2) {
#ifdef VPM_SUPPORT
if (vpmsupport)
ts->span.echocan_create = echocan_create;
#endif
- ts->span.dacs = t4_dacs;
- }
- ts->owner = wc;
- ts->span.offset = x;
- ts->writechunk = (void *)(wc->writechunk + x * 32 * 2);
- ts->readchunk = (void *)(wc->readchunk + x * 32 * 2);
- init_waitqueue_head(&ts->span.maintq);
-
- ts->span.ops = &t4_span_ops;
+ ts->span.ops = &t4_gen2_span_ops;
+ } else {
+ ts->span.ops = &t4_gen1_span_ops;
+ }
+
for (y=0;y<wc->tspans[x]->span.channels;y++) {
struct dahdi_chan *mychans = ts->chans[y];
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7036&r1=7035&r2=7036
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c Tue Aug 18 10:01:38 2009
@@ -3270,6 +3270,7 @@
.close = wctdm_close,
.ioctl = wctdm_ioctl,
.watchdog = wctdm_watchdog,
+ .dacs = wctdm_dacs,
};
static int wctdm_initialize(struct wctdm *wc)
@@ -3305,7 +3306,6 @@
wc->span.channels = wc->desc->ports;
wc->span.irq = pdev->irq;
wc->span.flags = DAHDI_FLAG_RBS;
- wc->span.dacs= wctdm_dacs;
wc->span.ops = &wctdm24xxp_span_ops;
#ifdef VPM_SUPPORT
if (vpmsupport)
Modified: linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h?view=diff&rev=7036&r1=7035&r2=7036
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h Tue Aug 18 10:01:38 2009
@@ -794,6 +794,10 @@
/*! If the watchdog detects no received data, it will call the
watchdog routine */
int (*watchdog)(struct dahdi_span *span, int cause);
+
+ /*! Opt: Dacs the contents of chan2 into chan1 if possible */
+ int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
+
};
struct dahdi_span {
@@ -826,23 +830,20 @@
int mainttimer; /*!< Maintenance timer */
int irqmisses; /*!< Interrupt misses */
-
- int timingslips; /*!< Clock slips */
-
- struct dahdi_chan **chans; /*!< Member channel structures */
-
- /*! Opt: Dacs the contents of chan2 into chan1 if possible */
- int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
+ int timingslips; /*!< Clock slips */
+
+ struct dahdi_chan **chans; /*!< Member channel structures */
+
+ const struct dahdi_span_ops *ops; /*!< span callbacks. */
/*! Opt: Provide echo cancellation on a channel */
int (*echocan_create)(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
- const struct dahdi_span_ops *ops; /*!< span callbacks. */
/* Used by DAHDI only -- no user servicable parts inside */
int spanno; /*!< Span number for DAHDI */
int offset; /*!< Offset within a given card */
- int lastalarms; /*!< Previous alarms */
+ int lastalarms; /*!< Previous alarms */
#ifdef CONFIG_DAHDI_WATCHDOG
int watchcounter;
More information about the dahdi-commits
mailing list