aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/dsp_cmx.c
diff options
context:
space:
mode:
authorAndreas Eversberg <andreas@eversberg.eu>2008-09-06 03:03:46 -0400
committerKarsten Keil <kkeil@suse.de>2009-01-09 16:44:27 -0500
commit3bd69ad197a4a3d0085a5dc3b5796111bf176b12 (patch)
tree573d7c81f97ff0eb15f914d43dbf9f393cf00ded /drivers/isdn/mISDN/dsp_cmx.c
parent55a6af9749d6a31e087f304f2ea39db3bb7b3f3e (diff)
mISDN: Add ISDN sample clock API to mISDN core
Add ISDN sample clock API to mISDN core (new file clock.c) hfcmulti and mISDNdsp use clock API. Signed-off-by: Andreas Eversberg <andreas@eversberg.eu> Signed-off-by: Karsten Keil <kkeil@suse.de>
Diffstat (limited to 'drivers/isdn/mISDN/dsp_cmx.c')
-rw-r--r--drivers/isdn/mISDN/dsp_cmx.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c
index 04dbb407f7a0..efe4c7430e6d 100644
--- a/drivers/isdn/mISDN/dsp_cmx.c
+++ b/drivers/isdn/mISDN/dsp_cmx.c
@@ -1557,13 +1557,11 @@ send_packet:
1557 schedule_work(&dsp->workq); 1557 schedule_work(&dsp->workq);
1558} 1558}
1559 1559
1560static u32 samplecount; 1560static u32 jittercount; /* counter for jitter check */;
1561struct timer_list dsp_spl_tl; 1561struct timer_list dsp_spl_tl;
1562u32 dsp_spl_jiffies; /* calculate the next time to fire */ 1562u32 dsp_spl_jiffies; /* calculate the next time to fire */
1563#ifdef UNUSED 1563static u16 dsp_count; /* last sample count */
1564static u32 dsp_start_jiffies; /* jiffies at the time, the calculation begins */ 1564static int dsp_count_valid ; /* if we have last sample count */
1565#endif /* UNUSED */
1566static struct timeval dsp_start_tv; /* time at start of calculation */
1567 1565
1568void 1566void
1569dsp_cmx_send(void *arg) 1567dsp_cmx_send(void *arg)
@@ -1577,38 +1575,32 @@ dsp_cmx_send(void *arg)
1577 int r, rr; 1575 int r, rr;
1578 int jittercheck = 0, delay, i; 1576 int jittercheck = 0, delay, i;
1579 u_long flags; 1577 u_long flags;
1580 struct timeval tv; 1578 u16 length, count;
1581 u32 elapsed;
1582 s16 length;
1583 1579
1584 /* lock */ 1580 /* lock */
1585 spin_lock_irqsave(&dsp_lock, flags); 1581 spin_lock_irqsave(&dsp_lock, flags);
1586 1582
1587 if (!dsp_start_tv.tv_sec) { 1583 if (!dsp_count_valid) {
1588 do_gettimeofday(&dsp_start_tv); 1584 dsp_count = mISDN_clock_get();
1589 length = dsp_poll; 1585 length = dsp_poll;
1586 dsp_count_valid = 1;
1590 } else { 1587 } else {
1591 do_gettimeofday(&tv); 1588 count = mISDN_clock_get();
1592 elapsed = ((tv.tv_sec - dsp_start_tv.tv_sec) * 8000) 1589 length = count - dsp_count;
1593 + ((s32)(tv.tv_usec / 125) - (dsp_start_tv.tv_usec / 125)); 1590 dsp_count = count;
1594 dsp_start_tv.tv_sec = tv.tv_sec;
1595 dsp_start_tv.tv_usec = tv.tv_usec;
1596 length = elapsed;
1597 } 1591 }
1598 if (length > MAX_POLL + 100) 1592 if (length > MAX_POLL + 100)
1599 length = MAX_POLL + 100; 1593 length = MAX_POLL + 100;
1600/* printk(KERN_DEBUG "len=%d dsp_count=0x%x.%04x dsp_poll_diff=0x%x.%04x\n", 1594 /* printk(KERN_DEBUG "len=%d dsp_count=0x%x\n", length, dsp_count); */
1601 length, dsp_count >> 16, dsp_count & 0xffff, dsp_poll_diff >> 16,
1602 dsp_poll_diff & 0xffff);
1603 */
1604 1595
1605 /* 1596 /*
1606 * check if jitter needs to be checked 1597 * check if jitter needs to be checked (this is every second)
1607 * (this is about every second = 8192 samples)
1608 */ 1598 */
1609 samplecount += length; 1599 jittercount += length;
1610 if ((samplecount & 8191) < length) 1600 if (jittercount >= 8000) {
1601 jittercount -= 8000;
1611 jittercheck = 1; 1602 jittercheck = 1;
1603 }
1612 1604
1613 /* loop all members that do not require conference mixing */ 1605 /* loop all members that do not require conference mixing */
1614 list_for_each_entry(dsp, &dsp_ilist, list) { 1606 list_for_each_entry(dsp, &dsp_ilist, list) {