[dahdi-commits] sruffell: branch linux/sruffell/wctdm24xxp-updates r10129 - /linux/team/sruff...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Fri Aug 12 19:36:19 CDT 2011
Author: sruffell
Date: Fri Aug 12 19:36:16 2011
New Revision: 10129
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10129
Log:
wctdm24xxp: Name the shadow registers for each modules.
Enhances readibility in my opinion.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10129&r1=10128&r2=10129
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c Fri Aug 12 19:36:16 2011
@@ -1021,13 +1021,20 @@
return;
}
+ kfree(cmd);
+
switch (mod->type) {
case FXS:
- mod->isrshadow[(68 == address) ? 0 : 1] = value;
+ if (68 == address)
+ mod->mod.fxs.hook_state_shadow = value;
+ else
+ mod->mod.fxs.linefeed_control_shadow = value;
break;
case FXO:
- /* 5 = Hook/Ring 29 = Battery */
- mod->isrshadow[(5 == address) ? 0 : 1] = value;
+ if (5 == address)
+ mod->mod.fxo.hook_ring_shadow = value;
+ else
+ mod->mod.fxo.line_voltage_status = value;
break;
case QRV:
/* wctdm_isr_getreg(wc, mod, 3); */ /* COR/CTCSS state */
@@ -1038,8 +1045,6 @@
default:
break;
}
-
- kfree(cmd);
}
/* Call with wc.reglock held and local interrupts disabled. */
@@ -1643,28 +1648,29 @@
wctdm_proslic_check_oppending(struct wctdm *wc, struct wctdm_module *const mod)
{
struct fxs *const fxs = &mod->mod.fxs;
- int res;
if (!(fxs->lasttxhook & SLIC_LF_OPPENDING))
return;
/* Monitor the Pending LF state change, for the next 100ms */
spin_lock(&wc->reglock);
+
if (!(fxs->lasttxhook & SLIC_LF_OPPENDING)) {
spin_unlock(&wc->reglock);
return;
}
- res = mod->isrshadow[1];
- if ((res & SLIC_LF_SETMASK) == (fxs->lasttxhook & SLIC_LF_SETMASK)) {
+ if ((fxs->linefeed_control_shadow & SLIC_LF_SETMASK) ==
+ (fxs->lasttxhook & SLIC_LF_SETMASK)) {
fxs->lasttxhook &= SLIC_LF_SETMASK;
fxs->oppending_ms = 0;
if (debug & DEBUG_CARD) {
dev_info(&wc->vb.pdev->dev,
"SLIC_LF OK: card=%d shadow=%02x "
"lasttxhook=%02x framecount=%ld\n", mod->card,
- res, fxs->lasttxhook, wc->framecount);
+ fxs->linefeed_control_shadow,
+ fxs->lasttxhook, wc->framecount);
}
} else if (fxs->oppending_ms && (--fxs->oppending_ms == 0)) {
wctdm_setreg_intr(wc, mod, LINE_STATE, fxs->lasttxhook);
@@ -1672,7 +1678,8 @@
dev_info(&wc->vb.pdev->dev,
"SLIC_LF RETRY: card=%d shadow=%02x "
"lasttxhook=%02x framecount=%ld\n", mod->card,
- res, fxs->lasttxhook, wc->framecount);
+ fxs->linefeed_control_shadow,
+ fxs->lasttxhook, wc->framecount);
}
} else { /* Start 100ms Timeout */
fxs->oppending_ms = 100;
@@ -1704,8 +1711,6 @@
}
#else
spin_lock(&wc->reglock);
- res = mod->isrshadow[1];
-
#if 0
/* This makes sure the lasthook was put in reg 64 the linefeed reg */
if (fxs->lasttxhook & SLIC_LF_OPPENDING) {
@@ -1728,7 +1733,7 @@
}
#endif
- res = !res && /* reg 64 has to be zero at last isr read */
+ res = !fxs->linefeed_control_shadow && /* reg 64 has to be zero at last isr read */
!(fxs->lasttxhook & SLIC_LF_OPPENDING) && /* not a transition */
fxs->lasttxhook; /* not an intended zero */
@@ -1746,8 +1751,9 @@
fxs->lasttxhook |= SLIC_LF_OPPENDING;
mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
- /* Update shadow register to avoid extra power alarms until next read */
- mod->isrshadow[1] = fxs->lasttxhook;
+ /* Update shadow register to avoid extra power alarms
+ * until next read */
+ fxs->linefeed_control_shadow = fxs->lasttxhook;
} else {
if (fxs->palarms == MAX_ALARMS) {
dev_notice(&wc->vb.pdev->dev,
@@ -1767,7 +1773,7 @@
if (wc->mods[card].mod.qrv.debtime >= 2)
wc->mods[card].mod.qrv.debtime--;
- b = wc->mods[qrvcard].isrshadow[0]; /* Hook/Ring state */
+ b = wc->mods[qrvcard].mod.qrv.isrshadow[0]; /* Hook/Ring state */
b &= 0xcc; /* use bits 3-4 and 6-7 only */
if (wc->mods[qrvcard].mod.qrv.radmode & RADMODE_IGNORECOR)
@@ -1839,7 +1845,7 @@
struct fxo *const fxo = &mod->mod.fxo;
/* Try to track issues that plague slot one FXO's */
- b = mod->isrshadow[0]; /* Hook/Ring state */
+ b = fxo->hook_ring_shadow;
b &= 0x9b;
if (fxo->offhook) {
if (b != 0x9)
@@ -1859,7 +1865,7 @@
* but not to have transitions between the two bits (i.e. no negative
* to positive or positive to negative transversals )
*/
- res = mod->isrshadow[0] & 0x60;
+ res = fxo->hook_ring_shadow & 0x60;
if (0 == fxo->wasringing) {
if (res) {
/* Look for positive/negative crossings in ring status reg */
@@ -1897,7 +1903,7 @@
}
}
} else {
- res = mod->isrshadow[0];
+ res = fxo->hook_ring_shadow;
if ((res & 0x60) && (fxo->battery == BATTERY_PRESENT)) {
fxo->ringdebounce += (DAHDI_CHUNKSIZE * 16);
if (fxo->ringdebounce >= DAHDI_CHUNKSIZE * ringdebounce) {
@@ -1925,7 +1931,7 @@
}
}
- b = mod->isrshadow[1]; /* Voltage */
+ b = fxo->line_voltage_status;
abs_voltage = abs(b);
if (fxovoltage && time_after(wc->framecount, fxo->display_fxovoltage)) {
@@ -2256,7 +2262,7 @@
/* For some reason we have to debounce the
hook detector. */
- res = mod->isrshadow[0]; /* Hook state */
+ res = fxs->hook_state_shadow;
hook = (res & 1);
if (hook != fxs->lastrxhook) {
@@ -3396,10 +3402,10 @@
fxs->lasttxhook = fxs->idletxhookstate;
wctdm_setreg(wc, mod, LINE_STATE, fxs->lasttxhook);
- /* Preset the isrshadow register so that we won't get a power alarm
- * when we finish initialization, otherwise the line state register
- * may not have been read yet. */
- mod->isrshadow[1] = fxs->lasttxhook;
+ /* Preset the shadow register so that we won't get a power alarm when
+ * we finish initialization, otherwise the line state register may not
+ * have been read yet. */
+ fxs->linefeed_control_shadow = fxs->lasttxhook;
return 0;
}
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=10129&r1=10128&r2=10129
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Fri Aug 12 19:36:16 2011
@@ -85,7 +85,6 @@
#define NUM_CAL_REGS 12
-#define ISR_COMMANDS 2
#define QRV_DEBOUNCETIME 20
#define VPM150M_HPI_CONTROL 0x00
@@ -162,6 +161,8 @@
unsigned int neonmwi_debounce;
unsigned int neonmwi_offcounter;
unsigned long display_fxovoltage;
+ u8 hook_ring_shadow;
+ s8 line_voltage_status;
};
struct fxs {
@@ -182,6 +183,8 @@
*/
int lasttxhook;
int oppending_ms;
+ u8 linefeed_control_shadow;
+ u8 hook_state_shadow;
int palarms;
struct dahdi_vmwi_info vmwisetting;
int vmwi_active_messages;
@@ -206,6 +209,7 @@
int radmode;
signed short rxgain;
signed short txgain;
+ u8 isrshadow[3];
};
enum module_type {
@@ -230,7 +234,6 @@
struct list_head active_cmds;
u8 offsets[3];
u8 subaddr;
- u8 isrshadow[ISR_COMMANDS];
u8 card;
enum module_type type;
More information about the dahdi-commits
mailing list