summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-27 22:32:19 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-27 22:32:19 +0000
commit6fb43e3d95aebe0c31534686ad309deeec740b1f (patch)
treeb353b04d2f4fcfacca80018a75b2f0dc8f5e2558
parent243aac831a8fa886fdeb6ea9cbd49dd172b3e6cc (diff)
make memory layout of private structures a little more sensible
git-svn-id: http://svn.digium.com/svn/zaptel/branches/v1-0@712 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwcfxs.c278
1 files changed, 139 insertions, 139 deletions
diff --git a/wcfxs.c b/wcfxs.c
index eb870e2..a4523f0 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -295,34 +295,34 @@ struct wcfxs {
union {
struct {
#ifdef AUDIO_RINGCHECK
- unsigned int pegtimer[NUM_CARDS];
- int pegcount[NUM_CARDS];
- int peg[NUM_CARDS];
- int ring[NUM_CARDS];
+ unsigned int pegtimer;
+ int pegcount;
+ int peg;
+ int ring;
#else
- int wasringing[NUM_CARDS];
+ int wasringing;
#endif
- int ringdebounce[NUM_CARDS];
- int offhook[NUM_CARDS];
- int battdebounce[NUM_CARDS];
- int nobatttimer[NUM_CARDS];
- int battery[NUM_CARDS];
- int lastpol[NUM_CARDS];
- int polarity[NUM_CARDS];
- int polaritydebounce[NUM_CARDS];
+ int ringdebounce;
+ int offhook;
+ int battdebounce;
+ int nobatttimer;
+ int battery;
+ int lastpol;
+ int polarity;
+ int polaritydebounce;
} fxo;
struct {
- int oldrxhook[NUM_CARDS];
- int debouncehook[NUM_CARDS];
- int lastrxhook[NUM_CARDS];
- int debounce[NUM_CARDS];
- int ohttimer[NUM_CARDS];
- int idletxhookstate[NUM_CARDS]; /* IDLE changing hook state */
- int lasttxhook[NUM_CARDS];
- int palarms[NUM_CARDS];
- struct calregs calregs[NUM_CARDS];
+ int oldrxhook;
+ int debouncehook;
+ int lastrxhook;
+ int debounce;
+ int ohttimer;
+ int idletxhookstate; /* IDLE changing hook state */
+ int lasttxhook;
+ int palarms;
+ struct calregs calregs;
} fxs;
- } mod;
+ } mod[NUM_CARDS];
/* Receive hook state and debouncing */
int modtype[NUM_CARDS];
@@ -397,46 +397,46 @@ static inline void ring_check(struct wcfxs *wc, int card)
short sample;
if (wc->modtype[card] != MOD_TYPE_FXO)
return;
- wc->mod.fxo.pegtimer[card] += ZT_CHUNKSIZE;
+ wc->mod[card].fxo.pegtimer += ZT_CHUNKSIZE;
for (x=0;x<ZT_CHUNKSIZE;x++) {
/* Look for pegging to indicate ringing */
sample = ZT_XLAW(wc->chans[card].readchunk[x], (&(wc->chans[card])));
- if ((sample > 10000) && (wc->mod.fxo.peg[card] != 1)) {
+ if ((sample > 10000) && (wc->mod[card].fxo.peg != 1)) {
if (debug > 1) printk("High peg!\n");
- if ((wc->mod.fxo.pegtimer[card] < PEGTIME) && (wc->mod.fxo.pegtimer[card] > MINPEGTIME))
- wc->mod.fxo.pegcount[card]++;
- wc->mod.fxo.pegtimer[card] = 0;
- wc->mod.fxo.peg[card] = 1;
- } else if ((sample < -10000) && (wc->mod.fxo.peg[card] != -1)) {
+ if ((wc->mod[card].fxo.pegtimer < PEGTIME) && (wc->mod[card].fxo.pegtimer > MINPEGTIME))
+ wc->mod[card].fxo.pegcount++;
+ wc->mod[card].fxo.pegtimer = 0;
+ wc->mod[card].fxo.peg = 1;
+ } else if ((sample < -10000) && (wc->mod[card].fxo.peg != -1)) {
if (debug > 1) printk("Low peg!\n");
- if ((wc->mod.fxo.pegtimer[card] < (PEGTIME >> 2)) && (wc->mod.fxo.pegtimer[card] > (MINPEGTIME >> 2)))
- wc->mod.fxo.pegcount[card]++;
- wc->mod.fxo.pegtimer[card] = 0;
- wc->mod.fxo.peg[card] = -1;
+ if ((wc->mod[card].fxo.pegtimer < (PEGTIME >> 2)) && (wc->mod[card].fxo.pegtimer > (MINPEGTIME >> 2)))
+ wc->mod[card].fxo.pegcount++;
+ wc->mod[card].fxo.pegtimer = 0;
+ wc->mod[card].fxo.peg = -1;
}
}
- if (wc->mod.fxo.pegtimer[card] > PEGTIME) {
+ if (wc->mod[card].fxo.pegtimer > PEGTIME) {
/* Reset pegcount if our timer expires */
- wc->mod.fxo.pegcount[card] = 0;
+ wc->mod[card].fxo.pegcount = 0;
}
/* Decrement debouncer if appropriate */
- if (wc->mod.fxo.ringdebounce[card])
- wc->mod.fxo.ringdebounce[card]--;
- if (!wc->mod.fxo.offhook[card] && !wc->mod.fxo.ringdebounce[card]) {
- if (!wc->mod.fxo.ring[card] && (wc->mod.fxo.pegcount[card] > PEGCOUNT)) {
+ if (wc->mod[card].fxo.ringdebounce)
+ wc->mod[card].fxo.ringdebounce--;
+ if (!wc->mod[card].fxo.offhook && !wc->mod[card].fxo.ringdebounce) {
+ if (!wc->mod[card].fxo.ring && (wc->mod[card].fxo.pegcount > PEGCOUNT)) {
/* It's ringing */
if (debug)
printk("RING on %d/%d!\n", wc->span.spanno, card + 1);
- if (!wc->mod.fxo.offhook[card])
+ if (!wc->mod[card].fxo.offhook)
zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
- wc->mod.fxo.ring[card] = 1;
+ wc->mod[card].fxo.ring = 1;
}
- if (wc->mod.fxo.ring[card] && !wc->mod.fxo.pegcount[card]) {
+ if (wc->mod[card].fxo.ring && !wc->mod[card].fxo.pegcount) {
/* No more ring */
if (debug)
printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1);
zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
- wc->mod.fxo.ring[card] = 0;
+ wc->mod[card].fxo.ring = 0;
}
}
}
@@ -781,7 +781,7 @@ static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
poopy++;
}
b &= 0x9b;
- if (wc->mod.fxo.offhook[card]) {
+ if (wc->mod[card].fxo.offhook) {
if (b != 0x9)
wcfxs_setreg(wc, card, 5, 0x9);
} else {
@@ -791,29 +791,29 @@ static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
if (poopy)
return;
#ifndef AUDIO_RINGCHECK
- if (!wc->mod.fxo.offhook[card]) {
+ if (!wc->mod[card].fxo.offhook) {
res = wcfxs_getreg(wc, card, 5);
- if ((res & 0x60) && wc->mod.fxo.battery[card]) {
- wc->mod.fxo.ringdebounce[card] += (ZT_CHUNKSIZE * 4);
- if (wc->mod.fxo.ringdebounce[card] >= ZT_CHUNKSIZE * 64) {
- if (!wc->mod.fxo.wasringing[card]) {
- wc->mod.fxo.wasringing[card] = 1;
+ if ((res & 0x60) && wc->mod[card].fxo.battery) {
+ wc->mod[card].fxo.ringdebounce += (ZT_CHUNKSIZE * 4);
+ if (wc->mod[card].fxo.ringdebounce >= ZT_CHUNKSIZE * 64) {
+ if (!wc->mod[card].fxo.wasringing) {
+ wc->mod[card].fxo.wasringing = 1;
zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
if (debug)
printk("RING on %d/%d!\n", wc->span.spanno, card + 1);
}
- wc->mod.fxo.ringdebounce[card] = ZT_CHUNKSIZE * 64;
+ wc->mod[card].fxo.ringdebounce = ZT_CHUNKSIZE * 64;
}
} else {
- wc->mod.fxo.ringdebounce[card] -= ZT_CHUNKSIZE;
- if (wc->mod.fxo.ringdebounce[card] <= 0) {
- if (wc->mod.fxo.wasringing[card]) {
- wc->mod.fxo.wasringing[card] =0;
+ wc->mod[card].fxo.ringdebounce -= ZT_CHUNKSIZE;
+ if (wc->mod[card].fxo.ringdebounce <= 0) {
+ if (wc->mod[card].fxo.wasringing) {
+ wc->mod[card].fxo.wasringing =0;
zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
if (debug)
printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1);
}
- wc->mod.fxo.ringdebounce[card] = 0;
+ wc->mod[card].fxo.ringdebounce = 0;
}
}
@@ -825,20 +825,20 @@ static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
static int count = 0;
if (!(count++ % 100)) {
printk("Card %d: Voltage: %d Debounce %d\n", card + 1,
- b, wc->mod.fxo.battdebounce[card]);
+ b, wc->mod[card].fxo.battdebounce);
}
}
#endif
if (abs(b) < BATT_THRESH) {
- wc->mod.fxo.nobatttimer[card]++;
+ wc->mod[card].fxo.nobatttimer++;
#if 0
- if (wc->mod.fxo.battery[card])
- printk("Battery loss: %d (%d debounce)\n", b, wc->mod.fxo.battdebounce[card]);
+ if (wc->mod[card].fxo.battery)
+ printk("Battery loss: %d (%d debounce)\n", b, wc->mod[card].fxo.battdebounce);
#endif
- if (wc->mod.fxo.battery[card] && !wc->mod.fxo.battdebounce[card]) {
+ if (wc->mod[card].fxo.battery && !wc->mod[card].fxo.battdebounce) {
if (debug)
printk("NO BATTERY on %d/%d!\n", wc->span.spanno, card + 1);
- wc->mod.fxo.battery[card] = 0;
+ wc->mod[card].fxo.battery = 0;
#ifdef JAPAN
if ((!wc->ohdebounce) && wc->offhook) {
zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
@@ -851,11 +851,11 @@ static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
#else
zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
#endif
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
- } else if (!wc->mod.fxo.battery[card])
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod[card].fxo.battdebounce = BATT_DEBOUNCE;
+ } else if (!wc->mod[card].fxo.battery)
+ wc->mod[card].fxo.battdebounce = BATT_DEBOUNCE;
} else if (abs(b) > BATT_THRESH) {
- if (!wc->mod.fxo.battery[card] && !wc->mod.fxo.battdebounce[card]) {
+ if (!wc->mod[card].fxo.battery && !wc->mod[card].fxo.battdebounce) {
if (debug)
printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1,
(b < 0) ? "-" : "+");
@@ -869,41 +869,41 @@ static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
#else
zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
#endif
- wc->mod.fxo.battery[card] = 1;
- wc->mod.fxo.nobatttimer[card] = 0;
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
- } else if (wc->mod.fxo.battery[card])
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod[card].fxo.battery = 1;
+ wc->mod[card].fxo.nobatttimer = 0;
+ wc->mod[card].fxo.battdebounce = BATT_DEBOUNCE;
+ } else if (wc->mod[card].fxo.battery)
+ wc->mod[card].fxo.battdebounce = BATT_DEBOUNCE;
- if (wc->mod.fxo.lastpol[card] >= 0) {
+ if (wc->mod[card].fxo.lastpol >= 0) {
if (b < 0) {
- wc->mod.fxo.lastpol[card] = -1;
- wc->mod.fxo.polaritydebounce[card] = POLARITY_DEBOUNCE;
+ wc->mod[card].fxo.lastpol = -1;
+ wc->mod[card].fxo.polaritydebounce = POLARITY_DEBOUNCE;
}
}
- if (wc->mod.fxo.lastpol[card] <= 0) {
+ if (wc->mod[card].fxo.lastpol <= 0) {
if (b > 0) {
- wc->mod.fxo.lastpol[card] = 1;
- wc->mod.fxo.polaritydebounce[card] = POLARITY_DEBOUNCE;
+ wc->mod[card].fxo.lastpol = 1;
+ wc->mod[card].fxo.polaritydebounce = POLARITY_DEBOUNCE;
}
}
} else {
/* It's something else... */
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
- }
- if (wc->mod.fxo.battdebounce[card])
- wc->mod.fxo.battdebounce[card]--;
- if (wc->mod.fxo.polaritydebounce[card]) {
- wc->mod.fxo.polaritydebounce[card]--;
- if (wc->mod.fxo.polaritydebounce[card] < 1) {
- if (wc->mod.fxo.lastpol[card] != wc->mod.fxo.polarity[card]) {
+ wc->mod[card].fxo.battdebounce = BATT_DEBOUNCE;
+ }
+ if (wc->mod[card].fxo.battdebounce)
+ wc->mod[card].fxo.battdebounce--;
+ if (wc->mod[card].fxo.polaritydebounce) {
+ wc->mod[card].fxo.polaritydebounce--;
+ if (wc->mod[card].fxo.polaritydebounce < 1) {
+ if (wc->mod[card].fxo.lastpol != wc->mod[card].fxo.polarity) {
if (debug)
printk("%lu Polarity reversed (%d -> %d)\n", jiffies,
- wc->mod.fxo.polarity[card],
- wc->mod.fxo.lastpol[card]);
- if (wc->mod.fxo.polarity[card])
+ wc->mod[card].fxo.polarity,
+ wc->mod[card].fxo.lastpol);
+ if (wc->mod[card].fxo.polarity)
zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
- wc->mod.fxo.polarity[card] = wc->mod.fxo.lastpol[card];
+ wc->mod[card].fxo.polarity = wc->mod[card].fxo.lastpol;
}
}
}
@@ -919,25 +919,25 @@ static inline void wcfxs_proslic_check_hook(struct wcfxs *wc, int card)
res = wcfxs_getreg(wc, card, 68);
hook = (res & 1);
- if (hook != wc->mod.fxs.lastrxhook[card]) {
+ if (hook != wc->mod[card].fxs.lastrxhook) {
/* Reset the debounce (must be multiple of 4ms) */
- wc->mod.fxs.debounce[card] = 8 * (4 * 8);
+ wc->mod[card].fxs.debounce = 8 * (4 * 8);
#if 0
- printk("Resetting debounce card %d hook %d, %d\n", card, hook, wc->mod.fxs.debounce[card]);
+ printk("Resetting debounce card %d hook %d, %d\n", card, hook, wc->mod[card].fxs.debounce);
#endif
} else {
- if (wc->mod.fxs.debounce[card] > 0) {
- wc->mod.fxs.debounce[card]-= 4 * ZT_CHUNKSIZE;
+ if (wc->mod[card].fxs.debounce > 0) {
+ wc->mod[card].fxs.debounce-= 4 * ZT_CHUNKSIZE;
#if 0
- printk("Sustaining hook %d, %d\n", hook, wc->mod.fxs.debounce[card]);
+ printk("Sustaining hook %d, %d\n", hook, wc->mod[card].fxs.debounce);
#endif
- if (!wc->mod.fxs.debounce[card]) {
+ if (!wc->mod[card].fxs.debounce) {
#if 0
printk("Counted down debounce, newhook: %d...\n", hook);
#endif
- wc->mod.fxs.debouncehook[card] = hook;
+ wc->mod[card].fxs.debouncehook = hook;
}
- if (!wc->mod.fxs.oldrxhook[card] && wc->mod.fxs.debouncehook[card]) {
+ if (!wc->mod[card].fxs.oldrxhook && wc->mod[card].fxs.debouncehook) {
/* Off hook */
#if 1
if (debug)
@@ -946,20 +946,20 @@ static inline void wcfxs_proslic_check_hook(struct wcfxs *wc, int card)
zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
if (robust)
wcfxs_init_proslic(wc, card, 1, 0, 1);
- wc->mod.fxs.oldrxhook[card] = 1;
+ wc->mod[card].fxs.oldrxhook = 1;
- } else if (wc->mod.fxs.oldrxhook[card] && !wc->mod.fxs.debouncehook[card]) {
+ } else if (wc->mod[card].fxs.oldrxhook && !wc->mod[card].fxs.debouncehook) {
/* On hook */
#if 1
if (debug)
#endif
printk("wcfxs: Card %d Going on hook\n", card);
zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
- wc->mod.fxs.oldrxhook[card] = 0;
+ wc->mod[card].fxs.oldrxhook = 0;
}
}
}
- wc->mod.fxs.lastrxhook[card] = hook;
+ wc->mod[card].fxs.lastrxhook = hook;
}
@@ -974,14 +974,14 @@ static inline void wcfxs_proslic_recheck_sanity(struct wcfxs *wc, int card)
wcfxs_init_proslic(wc, card, 1, 0, 1);
} else {
res = wcfxs_getreg(wc, card, 64);
- if (!res && (res != wc->mod.fxs.lasttxhook[card])) {
- if (wc->mod.fxs.palarms[card]++ < MAX_ALARMS) {
+ if (!res && (res != wc->mod[card].fxs.lasttxhook)) {
+ if (wc->mod[card].fxs.palarms++ < MAX_ALARMS) {
printk("Power alarm on module %d, resetting!\n", card + 1);
- if (wc->mod.fxs.lasttxhook[card] == 4)
- wc->mod.fxs.lasttxhook[card] = 1;
- wcfxs_setreg(wc, card, 64, wc->mod.fxs.lasttxhook[card]);
+ if (wc->mod[card].fxs.lasttxhook == 4)
+ wc->mod[card].fxs.lasttxhook = 1;
+ wcfxs_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook);
} else {
- if (wc->mod.fxs.palarms[card] == MAX_ALARMS)
+ if (wc->mod[card].fxs.palarms == MAX_ALARMS)
printk("Too many power alarms on card %d, NOT resetting!\n", card + 1);
}
}
@@ -1031,19 +1031,19 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
for (x=0;x<4;x++) {
if ((x < wc->cards) && (wc->cardflag & (1 << x)) &&
(wc->modtype[x] == MOD_TYPE_FXS)) {
- if (wc->mod.fxs.lasttxhook[x] == 0x4) {
+ if (wc->mod[x].fxs.lasttxhook == 0x4) {
/* RINGing, prepare for OHT */
- wc->mod.fxs.ohttimer[x] = OHT_TIMER << 3;
- wc->mod.fxs.idletxhookstate[x] = 0x2; /* OHT mode when idle */
+ wc->mod[x].fxs.ohttimer = OHT_TIMER << 3;
+ wc->mod[x].fxs.idletxhookstate = 0x2; /* OHT mode when idle */
} else {
- if (wc->mod.fxs.ohttimer[x]) {
- wc->mod.fxs.ohttimer[x]-= ZT_CHUNKSIZE;
- if (!wc->mod.fxs.ohttimer[x]) {
- wc->mod.fxs.idletxhookstate[x] = 0x1; /* Switch to active */
- if (wc->mod.fxs.lasttxhook[x] == 0x2) {
+ if (wc->mod[x].fxs.ohttimer) {
+ wc->mod[x].fxs.ohttimer-= ZT_CHUNKSIZE;
+ if (!wc->mod[x].fxs.ohttimer) {
+ wc->mod[x].fxs.idletxhookstate = 0x1; /* Switch to active */
+ if (wc->mod[x].fxs.lasttxhook == 0x2) {
/* Apply the change if appropriate */
- wc->mod.fxs.lasttxhook[x] = 0x1;
- wcfxs_setreg(wc, x, 64, wc->mod.fxs.lasttxhook[x]);
+ wc->mod[x].fxs.lasttxhook = 0x1;
+ wcfxs_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook);
}
}
}
@@ -1067,8 +1067,8 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* Accept an alarm once per 10 seconds */
for (x=0;x<4;x++)
if (wc->modtype[x] == MOD_TYPE_FXS) {
- if (wc->mod.fxs.palarms[x])
- wc->mod.fxs.palarms[x]--;
+ if (wc->mod[x].fxs.palarms)
+ wc->mod[x].fxs.palarms--;
}
}
wcfxs_receiveprep(wc, ints);
@@ -1439,7 +1439,7 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual,
int fxsmode=0;
/* By default, don't send on hook */
- wc->mod.fxs.idletxhookstate [card] = 1;
+ wc->mod[card].fxs.idletxhookstate = 1;
/* Sanity check the ProSLIC */
if (!sane && wcfxs_proslic_insane(wc, card))
@@ -1527,13 +1527,13 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual,
/* Save calibration vectors */
for (x=0;x<NUM_CAL_REGS;x++)
- wc->mod.fxs.calregs[card].vals[x] = wcfxs_getreg(wc, card, 96 + x);
+ wc->mod[card].fxs.calregs.vals[x] = wcfxs_getreg(wc, card, 96 + x);
#endif
} else {
/* Restore calibration registers */
for (x=0;x<NUM_CAL_REGS;x++)
- wcfxs_setreg(wc, card, 96 + x, wc->mod.fxs.calregs[card].vals[x]);
+ wcfxs_setreg(wc, card, 96 + x, wc->mod[card].fxs.calregs.vals[x]);
}
/* Calibration complete, restore original values */
for (x=0;x<5;x++) {
@@ -1621,12 +1621,12 @@ static int wcfxs_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
return -EINVAL;
if (get_user(x, (int *)data))
return -EFAULT;
- wc->mod.fxs.ohttimer[chan->chanpos - 1] = x << 3;
- wc->mod.fxs.idletxhookstate[chan->chanpos - 1] = 0x2; /* OHT mode when idle */
- if (wc->mod.fxs.lasttxhook[chan->chanpos - 1] == 0x1) {
+ wc->mod[chan->chanpos - 1].fxs.ohttimer = x << 3;
+ wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 0x2; /* OHT mode when idle */
+ if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x1) {
/* Apply the change if appropriate */
- wc->mod.fxs.lasttxhook[chan->chanpos - 1] = 0x2;
- wcfxs_setreg(wc, chan->chanpos - 1, 64, wc->mod.fxs.lasttxhook[chan->chanpos - 1]);
+ wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x2;
+ wcfxs_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook);
}
break;
case WCFXS_GET_STATS:
@@ -1711,7 +1711,7 @@ static int wcfxs_close(struct zt_chan *chan)
module_put(THIS_MODULE);
#endif
if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS)
- wc->mod.fxs.idletxhookstate[chan->chanpos - 1] = 1;
+ wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 1;
/* If we're dead, release us now */
if (!wc->usecount && wc->dead)
@@ -1728,11 +1728,11 @@ static int wcfxs_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
switch(txsig) {
case ZT_TXSIG_START:
case ZT_TXSIG_OFFHOOK:
- wc->mod.fxo.offhook[chan->chanpos - 1] = 1;
+ wc->mod[chan->chanpos - 1].fxo.offhook = 1;
wcfxs_setreg(wc, chan->chanpos - 1, 5, 0x9);
break;
case ZT_TXSIG_ONHOOK:
- wc->mod.fxo.offhook[chan->chanpos - 1] = 0;
+ wc->mod[chan->chanpos - 1].fxo.offhook = 0;
wcfxs_setreg(wc, chan->chanpos - 1, 5, 0x8);
break;
default:
@@ -1745,28 +1745,28 @@ static int wcfxs_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
case ZT_SIG_EM:
case ZT_SIG_FXOKS:
case ZT_SIG_FXOLS:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = wc->mod.fxs.idletxhookstate[chan->chanpos-1];
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
break;
case ZT_SIG_FXOGS:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = 3;
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = 3;
break;
}
break;
case ZT_TXSIG_OFFHOOK:
switch(chan->sig) {
case ZT_SIG_EM:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = 5;
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = 5;
break;
default:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = wc->mod.fxs.idletxhookstate[chan->chanpos-1];
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
break;
}
break;
case ZT_TXSIG_START:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = 4;
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = 4;
break;
case ZT_TXSIG_KEWL:
- wc->mod.fxs.lasttxhook[chan->chanpos-1] = 0;
+ wc->mod[chan->chanpos-1].fxs.lasttxhook = 0;
break;
default:
printk("wcfxs: Can't set tx state to %d\n", txsig);
@@ -1775,7 +1775,7 @@ static int wcfxs_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
printk("Setting FXS hook state to %d (%02x)\n", txsig, reg);
#if 1
- wcfxs_setreg(wc, chan->chanpos - 1, 64, wc->mod.fxs.lasttxhook[chan->chanpos-1]);
+ wcfxs_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos-1].fxs.lasttxhook);
#endif
}
return 0;