diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-09-29 16:45:15 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-09-29 16:45:15 +0000 |
commit | 8d2bf266da60c9e13c8fe9b791edef35bf397fd9 (patch) | |
tree | 37768239fc0800ae60711b8838ce01e2de8f104a /drivers/dahdi/xpp/xbus-pcm.c | |
parent | 5d91a043f4d0c55ec1d1dbd08942387465ae9ccb (diff) |
xpp: refactor pcm mask handling.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7245 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xbus-pcm.c')
-rw-r--r-- | drivers/dahdi/xpp/xbus-pcm.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c index 99f9c03..81efba0 100644 --- a/drivers/dahdi/xpp/xbus-pcm.c +++ b/drivers/dahdi/xpp/xbus-pcm.c @@ -605,6 +605,17 @@ void elect_syncer(const char *msg) } /* + * This function should be called with the xpd already locked + */ +void update_wanted_pcm_mask(xpd_t *xpd, xpp_line_t new_mask, uint new_pcm_len) +{ + xpd->pcm_len = new_pcm_len; + xpd->wanted_pcm_mask = new_mask; + XPD_DBG(SIGNAL, xpd, "pcm_len=%d wanted_pcm_mask=0x%X\n", + xpd->pcm_len, xpd->wanted_pcm_mask); +} + +/* * This function is used by FXS/FXO. The pcm_mask argument signifies * channels which should be *added* to the automatic calculation. * Normally, this argument is 0. @@ -614,6 +625,7 @@ void generic_card_pcm_recompute(xbus_t *xbus, xpd_t *xpd, xpp_line_t pcm_mask) int i; int line_count = 0; unsigned long flags; + uint pcm_len; spin_lock_irqsave(&xpd->lock_recompute_pcm, flags); //XPD_DBG(SIGNAL, xpd, "pcm_mask=0x%X\n", pcm_mask); @@ -633,12 +645,10 @@ void generic_card_pcm_recompute(xbus_t *xbus, xpd_t *xpd, xpp_line_t pcm_mask) pcm_mask = BIT(0); line_count = 1; } - xpd->pcm_len = (line_count) + pcm_len = (line_count) ? RPACKET_HEADERSIZE + sizeof(xpp_line_t) + line_count * DAHDI_CHUNKSIZE : 0L; - xpd->wanted_pcm_mask = pcm_mask; - XPD_DBG(SIGNAL, xpd, "pcm_len=%d wanted_pcm_mask=0x%X\n", - xpd->pcm_len, xpd->wanted_pcm_mask); + update_wanted_pcm_mask(xpd, pcm_mask, pcm_len); spin_unlock_irqrestore(&xpd->lock_recompute_pcm, flags); } @@ -1258,6 +1268,7 @@ EXPORT_SYMBOL(elect_syncer); #ifdef DAHDI_SYNC_TICK EXPORT_SYMBOL(dahdi_sync_tick); #endif +EXPORT_SYMBOL(update_wanted_pcm_mask); EXPORT_SYMBOL(generic_card_pcm_recompute); EXPORT_SYMBOL(generic_card_pcm_tospan); EXPORT_SYMBOL(generic_card_pcm_fromspan); |