summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-07-26 00:30:41 +0000
committerShaun Ruffell <sruffell@digium.com>2010-07-26 00:30:41 +0000
commit113b9311ebca9311befbd017eb27f6a25949e6a6 (patch)
tree57dc2f7e5a6c358c0a13eb4a8d0f7856b5e8077a /drivers/dahdi/xpp
parent8682c2a90bd996765326fb6477a2466b63530b73 (diff)
dahdi: Move the callbacks in dahdi_span into its own structure.
Part of preparation for adding additional callbacks to allow board drivers to advertise and support gathering pre-echocan data from hardware echocans. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8985 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp')
-rw-r--r--drivers/dahdi/xpp/card_bri.c29
-rw-r--r--drivers/dahdi/xpp/card_pri.c33
-rw-r--r--drivers/dahdi/xpp/xpp_dahdi.c33
-rw-r--r--drivers/dahdi/xpp/xpp_dahdi.h1
4 files changed, 69 insertions, 27 deletions
diff --git a/drivers/dahdi/xpp/card_bri.c b/drivers/dahdi/xpp/card_bri.c
index b390bf7..e15f064 100644
--- a/drivers/dahdi/xpp/card_bri.c
+++ b/drivers/dahdi/xpp/card_bri.c
@@ -861,6 +861,27 @@ static int BRI_card_remove(xbus_t *xbus, xpd_t *xpd)
return 0;
}
+static const struct dahdi_span_ops BRI_span_ops = {
+ .spanconfig = bri_spanconfig,
+ .chanconfig = bri_chanconfig,
+ .startup = bri_startup,
+ .shutdown = bri_shutdown,
+#ifndef CONFIG_DAHDI_BRI_DCHANS
+ .hdlc_hard_xmit = bri_hdlc_hard_xmit,
+#endif
+ .open = xpp_open,
+ .close = xpp_close,
+ .hooksig = xpp_hooksig, /* Only with RBS bits */
+ .ioctl = xpp_ioctl,
+ .maint = xpp_maint,
+#ifdef DAHDI_SYNC_TICK
+ .sync_tick = dahdi_sync_tick,
+#endif
+#ifdef CONFIG_DAHDI_WATCHDOG
+ .watchdog = xpp_watchdog,
+#endif
+};
+
static int BRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
{
xbus_t *xbus;
@@ -912,13 +933,7 @@ static int BRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
}
}
CALL_XMETHOD(card_pcm_recompute, xbus, xpd, 0);
- xpd->span.spanconfig = bri_spanconfig;
- xpd->span.chanconfig = bri_chanconfig;
- xpd->span.startup = bri_startup;
- xpd->span.shutdown = bri_shutdown;
-#ifndef CONFIG_DAHDI_BRI_DCHANS
- xpd->span.hdlc_hard_xmit = bri_hdlc_hard_xmit;
-#endif
+ xpd->span.ops = &BRI_span_ops;
return 0;
}
diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c
index 53cd8d5..1003188 100644
--- a/drivers/dahdi/xpp/card_pri.c
+++ b/drivers/dahdi/xpp/card_pri.c
@@ -1273,6 +1273,29 @@ static int pri_audio_notify(struct dahdi_chan *chan, int on)
}
#endif
+static const struct dahdi_span_ops PRI_span_ops = {
+ .spanconfig = pri_spanconfig,
+ .chanconfig = pri_chanconfig,
+ .startup = pri_startup,
+ .shutdown = pri_shutdown,
+ .rbsbits = pri_rbsbits,
+ .open = xpp_open,
+ .close = xpp_close,
+ .hooksig = xpp_hooksig, /* Only with RBS bits */
+ .ioctl = xpp_ioctl,
+ .maint = xpp_maint,
+#ifdef DAHDI_SYNC_TICK
+ .sync_tick = dahdi_sync_tick,
+#endif
+#ifdef CONFIG_DAHDI_WATCHDOG
+ .watchdog = xpp_watchdog,
+#endif
+
+#ifdef DAHDI_AUDIO_NOTIFY
+ .audio_notify = pri_audio_notify,
+#endif
+};
+
static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
{
xbus_t *xbus;
@@ -1312,14 +1335,8 @@ static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
cur_chan->flags &= ~DAHDI_FLAG_HDLC;
}
}
- 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
+ xpd->offhook_state = xpd->wanted_pcm_mask;
+ xpd->span.ops = &PRI_span_ops;
return 0;
}
diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c
index ebabdcc..82157f6 100644
--- a/drivers/dahdi/xpp/xpp_dahdi.c
+++ b/drivers/dahdi/xpp/xpp_dahdi.c
@@ -944,7 +944,7 @@ int xpp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long arg)
return 0;
}
-static int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
+int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
{
xpd_t *xpd = chan->pvt;
xbus_t *xbus;
@@ -966,6 +966,7 @@ static int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
DBG(SIGNAL, "Setting %s to %s (%d)\n", chan->name, txsig2str(txsig), txsig);
return CALL_XMETHOD(card_hooksig, xbus, xpd, pos, txsig);
}
+EXPORT_SYMBOL(xpp_hooksig);
/* Req: Set the requested chunk size. This is the unit in which you must
report results for conferencing, etc */
@@ -1068,6 +1069,21 @@ int dahdi_unregister_xpd(xpd_t *xpd)
return 0;
}
+static const struct dahdi_span_ops xpp_span_ops = {
+ .open = xpp_open,
+ .close = xpp_close,
+ .ioctl = xpp_ioctl,
+ .maint = xpp_maint,
+};
+
+static const struct dahdi_span_ops xpp_rbs_span_ops = {
+ .hooksig = xpp_hooksig,
+ .open = xpp_open,
+ .close = xpp_close,
+ .ioctl = xpp_ioctl,
+ .maint = xpp_maint,
+};
+
int dahdi_register_xpd(xpd_t *xpd)
{
struct dahdi_span *span;
@@ -1099,13 +1115,12 @@ int dahdi_register_xpd(xpd_t *xpd)
span->channels = cn;
span->chans = xpd->chans;
- span->open = xpp_open;
- span->close = xpp_close;
span->flags = DAHDI_FLAG_RBS;
if(xops->card_hooksig)
- span->hooksig = xpp_hooksig; /* Only with RBS bits */
- span->ioctl = xpp_ioctl;
- span->maint = xpp_maint;
+ span->ops = &xpp_rbs_span_ops; /* Only with RBS bits */
+ else
+ span->ops = &xpp_span_ops;
+
/*
* This actually describe the dahdi_spaninfo version 3
* A bunch of unrelated data exported via a modified ioctl()
@@ -1138,12 +1153,6 @@ int dahdi_register_xpd(xpd_t *xpd)
* No irq's for you today!
*/
span->irq = 0;
-#ifdef DAHDI_SYNC_TICK
- span->sync_tick = dahdi_sync_tick;
-#endif
-#ifdef CONFIG_DAHDI_WATCHDOG
- span->watchdog = xpp_watchdog;
-#endif
snprintf(xpd->span.desc, MAX_SPANDESC, "Xorcom XPD #%02d/%1d%1d: %s",
xbus->num, xpd->addr.unit, xpd->addr.subunit, xpd->type_name);
diff --git a/drivers/dahdi/xpp/xpp_dahdi.h b/drivers/dahdi/xpp/xpp_dahdi.h
index 96e7fc3..e048dc7 100644
--- a/drivers/dahdi/xpp/xpp_dahdi.h
+++ b/drivers/dahdi/xpp/xpp_dahdi.h
@@ -39,6 +39,7 @@ void hookstate_changed(xpd_t *xpd, int pos, bool good);
int xpp_open(struct dahdi_chan *chan);
int xpp_close(struct dahdi_chan *chan);
int xpp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long arg);
+int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig);
int xpp_maint(struct dahdi_span *span, int cmd);
void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd);
int total_registered_spans(void);