[svn-commits] sruffell: linux/trunk r10165 - /linux/trunk/drivers/dahdi/wctdm24xxp/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 30 11:38:22 CDT 2011
Author: sruffell
Date: Tue Aug 30 11:38:19 2011
New Revision: 10165
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10165
Log:
wctdm24xxp: Name the shadow registers for each modules.
Saved me time when reading the code so I don't have to lookup which position
in the index is what register for each of the modules.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
Modified:
linux/trunk/drivers/dahdi/wctdm24xxp/base.c
linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10165&r1=10164&r2=10165
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Tue Aug 30 11:38:19 2011
@@ -1025,11 +1025,16 @@
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 */
@@ -1649,28 +1654,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);
@@ -1678,7 +1684,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;
@@ -1710,9 +1717,9 @@
}
#else
spin_lock(&wc->reglock);
- res = mod->isrshadow[1];
-
- res = !res && /* reg 64 has to be zero at last isr read */
+
+ /* reg 64 has to be zero at last isr read */
+ res = !fxs->linefeed_control_shadow &&
!(fxs->lasttxhook & SLIC_LF_OPPENDING) && /* not a transition */
fxs->lasttxhook; /* not an intended zero */
@@ -1730,8 +1737,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,
@@ -1751,7 +1759,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)
@@ -1823,7 +1831,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)
@@ -1843,7 +1851,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 */
@@ -1881,7 +1889,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) {
@@ -1909,7 +1917,7 @@
}
}
- b = mod->isrshadow[1]; /* Voltage */
+ b = fxo->line_voltage_status;
abs_voltage = abs(b);
if (fxovoltage && time_after(wc->framecount, fxo->display_fxovoltage)) {
@@ -2240,7 +2248,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) {
@@ -3387,10 +3395,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/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=10165&r1=10164&r2=10165
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Tue Aug 30 11:38:19 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 svn-commits
mailing list