diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-25 21:07:29 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-25 21:07:29 +0000 |
commit | 3dfd34b02d96d50252b4f00a2a51084bb16f8d36 (patch) | |
tree | 8b4b962903620b15e59bcf1587274021d486630e /wcfxs.c | |
parent | 491081bb9fd20fe122636025a3f51376fbe0080d (diff) |
Unify sleep code in wcfxs, merge belgium tones (bug #2130)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@441 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-x | wcfxs.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1066,11 +1066,17 @@ static int wcfxs_proslic_calibrate(struct wcfxs *wc, int card) } #endif -static int wcfxs_init_voicedaa(struct wcfxs *wc, int card, int fast, int manual, int sane) +static void wait_just_a_bit(int foo) { long newjiffies; + newjiffies = jiffies + foo; + while(jiffies < newjiffies); +} + +static int wcfxs_init_voicedaa(struct wcfxs *wc, int card, int fast, int manual, int sane) +{ unsigned char reg16=0, reg26=0, reg30=0, reg31=0; - + long newjiffies; wc->modtype[card] = MOD_TYPE_FXO; /* Sanity check the ProSLIC */ reset_spi(wc, card); @@ -1081,8 +1087,7 @@ static int wcfxs_init_voicedaa(struct wcfxs *wc, int card, int fast, int manual, wcfxs_setreg(wc, card, 1, 0x80); /* Wait just a bit */ - newjiffies = jiffies + (HZ/10); - while(jiffies < newjiffies); + wait_just_a_bit(HZ/10); /* Enable PCM, ulaw */ wcfxs_setreg(wc, card, 33, 0x28); @@ -1121,7 +1126,8 @@ static int wcfxs_init_voicedaa(struct wcfxs *wc, int card, int fast, int manual, /* Wait 1000ms for ISO-cap to come up */ newjiffies = jiffies; newjiffies += 2 * HZ; - while((jiffies < newjiffies) && !(wcfxs_getreg(wc, card, 11) & 0xf0)); + while((jiffies < newjiffies) && !(wcfxs_getreg(wc, card, 11) & 0xf0)) + wait_just_a_bit(HZ/10); if (!(wcfxs_getreg(wc, card, 11) & 0xf0)) { printk("VoiceDAA did not bring up ISO link properly!\n"); @@ -1724,7 +1730,6 @@ static void wcfxs_post_initialize(struct wcfxs *wc) static int wcfxs_hardware_init(struct wcfxs *wc) { /* Hardware stuff */ - long oldjiffies; unsigned char ver; unsigned char x,y; int failed; @@ -1779,8 +1784,7 @@ static int wcfxs_hardware_init(struct wcfxs *wc) outb(0x4, wc->ioaddr + WC_AUXFUNC); /* Wait 1/4 of a sec */ - oldjiffies = jiffies; - while(jiffies - oldjiffies < (HZ / 4) + 1); + wait_just_a_bit(HZ/4); /* Back to normal, with automatic DMA wrap around */ outb(0x30 | 0x01, wc->ioaddr + WC_CNTL); @@ -1807,8 +1811,7 @@ static int wcfxs_hardware_init(struct wcfxs *wc) outb(0xff, wc->ioaddr + WC_INTSTAT); /* Wait 1/4 of a second more */ - oldjiffies = jiffies; - while(jiffies - oldjiffies < (HZ / 4) + 1); + wait_just_a_bit(HZ/4); for (x=0;x<wc->cards;x++) { int sane=0,ret=0; |