xpp: BRI: fix timing priority calculation

Use similar caculation as in the PRI module:
* Save timing_priority from spanconfig and
  elect syncer when spanconfig is called.
* Create custom timing_priority() function that returns
  the value or error if span is disconnected.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: : Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10373 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Oron Peled 2011-12-07 19:34:37 +00:00 committed by Tzafrir Cohen
parent 654486dc24
commit 990af593a5

View File

@ -1202,6 +1202,8 @@ static int bri_spanconfig(struct file *file, struct dahdi_span *span,
framingstr, codingstr, crcstr,
lc->lineconfig,
lc->sync);
PHONEDEV(xpd).timing_priority = lc->sync;
elect_syncer("BRI-spanconfig");
/*
* FIXME: validate
*/
@ -1429,6 +1431,18 @@ static void BRI_card_pcm_tospan(xpd_t *xpd, xpacket_t *pack)
}
}
static int BRI_timing_priority(xpd_t *xpd)
{
struct BRI_priv_data *priv;
priv = xpd->priv;
BUG_ON(!priv);
if (priv->layer1_up)
return PHONEDEV(xpd).timing_priority;
XPD_DBG(SYNC, xpd, "No timing priority (no layer1)\n");
return -ENOENT;
}
int BRI_echocancel_timeslot(xpd_t *xpd, int pos)
{
return xpd->addr.subunit * 4 + pos;
@ -1696,7 +1710,7 @@ static const struct phoneops bri_phoneops = {
.card_pcm_recompute = BRI_card_pcm_recompute,
.card_pcm_fromspan = BRI_card_pcm_fromspan,
.card_pcm_tospan = BRI_card_pcm_tospan,
.card_timing_priority = generic_timing_priority,
.card_timing_priority = BRI_timing_priority,
.echocancel_timeslot = BRI_echocancel_timeslot,
.echocancel_setmask = BRI_echocancel_setmask,
.card_ioctl = BRI_card_ioctl,