summaryrefslogtreecommitdiff
path: root/xivovp
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2010-10-14 10:16:53 +0200
committerNoe Rubinstein <nrubinstein@proformatique.com>2010-10-14 10:16:53 +0200
commitc13b79002ca4cc044c024af337c4ae42be022513 (patch)
tree73aebdb081853579e2d8edd3a061be7251658db9 /xivovp
parentf568593d78d4a43c76d619ab2e5c99590a3a6913 (diff)
FXO (untested yet)
Diffstat (limited to 'xivovp')
-rw-r--r--xivovp/base.c57
1 files changed, 43 insertions, 14 deletions
diff --git a/xivovp/base.c b/xivovp/base.c
index e391df3..d769fba 100644
--- a/xivovp/base.c
+++ b/xivovp/base.c
@@ -32,7 +32,7 @@ MODULE_PARM_DESC(traces_vanish,
"ERROR/WARNING/INFO (default: " __stringify(TRACES_VANISH_DEFAULT) ")");
-#define NB_LINES 1 //XXX
+#define NB_LINES 2
#define TICK_JIFFIES(n) DIV_ROUND_UP(n * HZ, 1000)
#define VP_TICK_JIFFIES TICK_JIFFIES(VP_TICK_MS)
#define RXTX_TICK_JIFFIES TICK_JIFFIES(1)
@@ -246,6 +246,7 @@ static void vp_post_init(VpEventType *event)
return;
}
+ /* FXS */
vpst = VpSetLineState(&xivovp.line[FXS_LINE].vp_ctx,
VP_LINE_OHT);
if (vpst != VP_STATUS_SUCCESS) {
@@ -254,10 +255,6 @@ static void vp_post_init(VpEventType *event)
return;
}
- //TODO: VpSetLineState for FXO_LINE
- //TODO: VpCalLine for FXO_LINE
- // What happens if lines aren't connected?
-
vpst = VpCalLine(&xivovp.line[FXS_LINE].vp_ctx);
if (vpst != VP_STATUS_SUCCESS) {
printk(KERN_ERR DRV_NAME ": VpCalLine returned %d\n",
@@ -265,6 +262,24 @@ static void vp_post_init(VpEventType *event)
return;
}
+ /* FXO */
+ vpst = VpSetLineState(&xivovp.line[FXO_LINE].vp_ctx,
+ VP_LINE_FXO_OHT);
+ if (vpst != VP_STATUS_SUCCESS) {
+ printk(KERN_ERR DRV_NAME ": VpSetLineState returned %d\n",
+ (int)vpst);
+ return;
+ }
+
+ vpst = VpCalLine(&xivovp.line[FXO_LINE].vp_ctx);
+ if (vpst != VP_STATUS_SUCCESS) {
+ printk(KERN_ERR DRV_NAME ": VpCalLine returned %d\n",
+ (int)vpst);
+ return;
+ }
+
+ // XXX What happens if lines aren't connected?
+
mod_timer(&rxtx_timer, jiffies + RXTX_TICK_JIFFIES);
count_and_stop_traces = TRUE;
}
@@ -389,6 +404,7 @@ static const struct dahdi_span_ops xivovp_span_ops = {
static int
span_init(void)
{
+ int i;
struct xivovp_line* l;
dahdi_copy_string(xivovp.span.name, "XivoVP", sizeof(xivovp.span.name));
dahdi_copy_string(xivovp.span.desc,
@@ -403,21 +419,32 @@ span_init(void)
xivovp.span.deflaw = alawoverride ? DAHDI_LAW_ALAW : DAHDI_LAW_MULAW;
xivovp.span.flags = DAHDI_FLAG_RBS;
- init_waitqueue_head(&xivovp.span.maintq); /* still dunno what this is */
-
- for (l = xivovp.line; l < xivovp.line + NB_LINES; l++) {
- xivovp.chans[l - xivovp.line] = &l->chan;
+ for (i = 0; i < NB_LINES; i++) {
+ l = &xivovp.line[i];
+ xivovp.chans[i] = &l->chan;
l->chan.pvt = l;
- if (l->type == FXO_LINE)
+ l->chan.chanpos = i + 1;
+
+ if (l->type == FXO_LINE) {
/* /!\ FXO uses FXS sig and vice-versa */
+ sprintf(l->chan.name, "XiVO/FXO");
l->chan.sigcap = DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS |
DAHDI_SIG_FXSKS;
- else
+ } else if (l->type == FXS_LINE) {
+
+ sprintf(l->chan.name, "XiVO/FXS");
l->chan.sigcap = DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS |
DAHDI_SIG_FXOKS;
+ } else {
+ printk(KERN_ERR DRV_NAME ": WTF?? Unsupported line type %d\n", l->type);
+ return -EINVAL;
+ }
+
spin_lock_init(&l->lock);
}
+ init_waitqueue_head(&xivovp.span.maintq); /* still dunno what this is */
+
if (dahdi_register(&xivovp.span, /*prefmaster*/ 0)) {
printk(KERN_WARNING DRV_NAME ": couldn't register span.\n");
return -EINVAL;
@@ -474,17 +501,19 @@ vp_init(void)
goto err_vp_make_line_object;
}
-#if 0
+#if 1
vpst = VpMakeLineObject(
VP_TERM_FXO_GENERIC,
FXO_LINE,
- &xivovp.line[1].vp_ctx,
- (void*)&xivovp.line[1].line_obj,
+ &xivovp.line[FXO_LINE].vp_ctx,
+ (void*)&xivovp.line[FXO_LINE].line_obj,
&xivovp.dev_ctx);
if (vpst != VP_STATUS_SUCCESS) {
printk(KERN_ERR DRV_NAME ": VpMakeLineObject (FXO) failed (%d)\n", vpst);
rc = -EIO;
goto err_vp_make_line_object;
+ } else {
+ printk(KERN_INFO DRV_NAME ": VpMakeLineObject (FXO) done.\n");
}
#endif