wctdm24xxp: Group the per-module information together
Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9956 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -151,6 +151,82 @@ struct wctdm_chan {
|
||||
int timeslot;
|
||||
};
|
||||
|
||||
struct fxo {
|
||||
int wasringing;
|
||||
int lastrdtx;
|
||||
int lastrdtx_count;
|
||||
int ringdebounce;
|
||||
int offhook;
|
||||
int battdebounce;
|
||||
int battalarm;
|
||||
enum battery_state battery;
|
||||
int lastpol;
|
||||
int polarity;
|
||||
int polaritydebounce;
|
||||
int neonmwi_state;
|
||||
int neonmwi_last_voltage;
|
||||
unsigned int neonmwi_debounce;
|
||||
unsigned int neonmwi_offcounter;
|
||||
};
|
||||
|
||||
struct fxs {
|
||||
int oldrxhook;
|
||||
int debouncehook;
|
||||
int lastrxhook;
|
||||
int debounce;
|
||||
int ohttimer;
|
||||
int idletxhookstate; /* IDLE changing hook state */
|
||||
/* lasttxhook reflects the last value written to the proslic's reg
|
||||
* 64 (LINEFEED_CONTROL) in bits 0-2. Bit 4 indicates if the last
|
||||
* write is pending i.e. it is in process of being written to the
|
||||
* register
|
||||
* NOTE: in order for this value to actually be written to the
|
||||
* proslic, the appropriate matching value must be written into the
|
||||
* sethook variable so that it gets queued and handled by the
|
||||
* voicebus ISR.
|
||||
*/
|
||||
int lasttxhook;
|
||||
int oppending_ms;
|
||||
spinlock_t lasttxhooklock;
|
||||
int palarms;
|
||||
struct dahdi_vmwi_info vmwisetting;
|
||||
int vmwi_active_messages;
|
||||
int vmwi_linereverse;
|
||||
int reversepolarity; /* polarity reversal */
|
||||
struct calregs calregs;
|
||||
};
|
||||
|
||||
struct wctdm_module {
|
||||
union {
|
||||
struct fxo fxo;
|
||||
struct fxs fxs;
|
||||
struct b400m *bri;
|
||||
} mod;
|
||||
struct cmdq cmdq;
|
||||
|
||||
int type; /* type of module (FXO/FXS/QRV/etc.) */
|
||||
int sethook; /* pending hook state command */
|
||||
int dacssrc;
|
||||
int flags; /* bitmap of board-specific + module-specific flags */
|
||||
|
||||
#define RADMODE_INVERTCOR 1
|
||||
#define RADMODE_IGNORECOR 2
|
||||
#define RADMODE_EXTTONE 4
|
||||
#define RADMODE_EXTINVERT 8
|
||||
#define RADMODE_IGNORECT 16
|
||||
#define RADMODE_PREEMP 32
|
||||
#define RADMODE_DEEMP 64
|
||||
unsigned short debouncetime;
|
||||
signed short rxgain;
|
||||
signed short txgain;
|
||||
/* FIXME: why are all of these QRV-only members part of the main card
|
||||
* structure? */
|
||||
char qrvhook;
|
||||
unsigned short qrvdebtime;
|
||||
int radmode;
|
||||
int altcs;
|
||||
};
|
||||
|
||||
struct wctdm {
|
||||
const struct wctdm_desc *desc;
|
||||
const char *board_name;
|
||||
@@ -163,7 +239,6 @@ struct wctdm {
|
||||
unsigned char txident;
|
||||
unsigned char rxident;
|
||||
|
||||
int flags[NUM_MODULES]; /* bitmap of board-specific + module-specific flags */
|
||||
u8 ctlreg;
|
||||
u8 tdm410leds;
|
||||
|
||||
@@ -171,77 +246,10 @@ struct wctdm {
|
||||
int digi_mods; /* number of digital modules present */
|
||||
int avchannels; /* active "voice" (voice, B and D) channels */
|
||||
|
||||
int altcs[NUM_MODULES];
|
||||
|
||||
/* FIXME: why are all of these QRV-only members part of the main card structure? */
|
||||
char qrvhook[NUM_MODULES];
|
||||
unsigned short qrvdebtime[NUM_MODULES];
|
||||
int radmode[NUM_MODULES];
|
||||
#define RADMODE_INVERTCOR 1
|
||||
#define RADMODE_IGNORECOR 2
|
||||
#define RADMODE_EXTTONE 4
|
||||
#define RADMODE_EXTINVERT 8
|
||||
#define RADMODE_IGNORECT 16
|
||||
#define RADMODE_PREEMP 32
|
||||
#define RADMODE_DEEMP 64
|
||||
unsigned short debouncetime[NUM_MODULES];
|
||||
signed short rxgain[NUM_MODULES];
|
||||
signed short txgain[NUM_MODULES];
|
||||
|
||||
spinlock_t reglock; /* held when accessing anything affecting the module array */
|
||||
wait_queue_head_t regq;
|
||||
|
||||
union {
|
||||
struct fxo {
|
||||
int wasringing;
|
||||
int lastrdtx;
|
||||
int lastrdtx_count;
|
||||
int ringdebounce;
|
||||
int offhook;
|
||||
int battdebounce;
|
||||
int battalarm;
|
||||
enum battery_state battery;
|
||||
int lastpol;
|
||||
int polarity;
|
||||
int polaritydebounce;
|
||||
int neonmwi_state;
|
||||
int neonmwi_last_voltage;
|
||||
unsigned int neonmwi_debounce;
|
||||
unsigned int neonmwi_offcounter;
|
||||
} fxo;
|
||||
struct fxs {
|
||||
int oldrxhook;
|
||||
int debouncehook;
|
||||
int lastrxhook;
|
||||
int debounce;
|
||||
int ohttimer;
|
||||
int idletxhookstate; /* IDLE changing hook state */
|
||||
/* lasttxhook reflects the last value written to the proslic's reg
|
||||
* 64 (LINEFEED_CONTROL) in bits 0-2. Bit 4 indicates if the last
|
||||
* write is pending i.e. it is in process of being written to the
|
||||
* register
|
||||
* NOTE: in order for this value to actually be written to the
|
||||
* proslic, the appropriate matching value must be written into the
|
||||
* sethook variable so that it gets queued and handled by the
|
||||
* voicebus ISR.
|
||||
*/
|
||||
int lasttxhook;
|
||||
int oppending_ms;
|
||||
spinlock_t lasttxhooklock;
|
||||
int palarms;
|
||||
struct dahdi_vmwi_info vmwisetting;
|
||||
int vmwi_active_messages;
|
||||
int vmwi_linereverse;
|
||||
int reversepolarity; /* polarity reversal */
|
||||
struct calregs calregs;
|
||||
} fxs;
|
||||
struct b400m *bri;
|
||||
} mods[NUM_MODULES];
|
||||
|
||||
struct cmdq cmdq[NUM_MODULES];
|
||||
int modtype[NUM_MODULES]; /* type of module (FXO/FXS/QRV/etc.) */
|
||||
int sethook[NUM_MODULES]; /* pending hook state command */
|
||||
int dacssrc[NUM_MODULES];
|
||||
struct wctdm_module mods[NUM_MODULES];
|
||||
|
||||
struct vpmadt032 *vpmadt032;
|
||||
|
||||
|
||||
@@ -2091,8 +2091,8 @@ static void b400m_enable_workqueues(struct wctdm *wc)
|
||||
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
for (i = 0; i < wc->mods_per_board; i += 4) {
|
||||
if (wc->modtype[i] == MOD_TYPE_BRI)
|
||||
b4s[numb4s++] = wc->mods[i].bri;
|
||||
if (wc->mods[i].type == MOD_TYPE_BRI)
|
||||
b4s[numb4s++] = wc->mods[i].mod.bri;
|
||||
}
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
|
||||
@@ -2111,8 +2111,8 @@ static void b400m_disable_workqueues(struct wctdm *wc)
|
||||
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
for (i = 0; i < wc->mods_per_board; i += 4) {
|
||||
if (wc->modtype[i] == MOD_TYPE_BRI)
|
||||
b4s[numb4s++] = wc->mods[i].bri;
|
||||
if (wc->mods[i].type == MOD_TYPE_BRI)
|
||||
b4s[numb4s++] = wc->mods[i].mod.bri;
|
||||
}
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
|
||||
@@ -2513,12 +2513,12 @@ int wctdm_bri_checkisr(struct wctdm *wc, int modpos, int offset)
|
||||
return 0;
|
||||
|
||||
/* DEFINITELY don't do anything if our structures aren't ready! */
|
||||
if (!wc || !wc->initialized || !(wc->mods[modpos].bri) ||
|
||||
!((struct b400m *)wc->mods[modpos].bri)->inited) {
|
||||
if (!wc || !wc->initialized || !(wc->mods[modpos].mod.bri) ||
|
||||
!((struct b400m *)wc->mods[modpos].mod.bri)->inited) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
b4 = (struct b400m *)wc->mods[modpos].bri;
|
||||
b4 = (struct b400m *)wc->mods[modpos].mod.bri;
|
||||
if (offset == 0) {
|
||||
if (!b4->shutdown) {
|
||||
/* if (!(wc->intcount % 50)) */
|
||||
@@ -2584,7 +2584,7 @@ static int b400m_probe(struct wctdm *wc, int modpos)
|
||||
/* which B400M in the system is this one? count all of them found so
|
||||
* far */
|
||||
for (x = 0; x < modpos; x += 4) {
|
||||
if (wc->modtype[x] == MOD_TYPE_BRI)
|
||||
if (wc->mods[x].type == MOD_TYPE_BRI)
|
||||
++b4->b400m_no;
|
||||
}
|
||||
|
||||
@@ -2617,7 +2617,7 @@ static int b400m_probe(struct wctdm *wc, int modpos)
|
||||
hfc_enable_interrupts(b4);
|
||||
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
wc->mods[modpos].bri = (void *)b4;
|
||||
wc->mods[modpos].mod.bri = (void *)b4;
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
|
||||
return 0;
|
||||
@@ -2642,33 +2642,33 @@ int wctdm_init_b400m(struct wctdm *wc, int card)
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
if (wc->modtype[card & 0xfc] == MOD_TYPE_QRV)
|
||||
if (wc->mods[card & 0xfc].type == MOD_TYPE_QRV)
|
||||
return -2;
|
||||
|
||||
if (!(card & 0x03)) { /* only init if at lowest port in module */
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
wc->modtype[card + 0] = MOD_TYPE_BRI;
|
||||
wc->modtype[card + 1] = MOD_TYPE_BRI;
|
||||
wc->modtype[card + 2] = MOD_TYPE_BRI;
|
||||
wc->modtype[card + 3] = MOD_TYPE_BRI;
|
||||
wc->mods[card + 0].type = MOD_TYPE_BRI;
|
||||
wc->mods[card + 1].type = MOD_TYPE_BRI;
|
||||
wc->mods[card + 2].type = MOD_TYPE_BRI;
|
||||
wc->mods[card + 3].type = MOD_TYPE_BRI;
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
|
||||
msleep(20);
|
||||
|
||||
if (b400m_probe(wc, card) != 0) {
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
wc->modtype[card + 0] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 1] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 2] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 3] = MOD_TYPE_NONE;
|
||||
wc->mods[card + 0].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 1].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 2].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 3].type = MOD_TYPE_NONE;
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
ret = -2;
|
||||
}
|
||||
} else { /* for the "sub-cards" */
|
||||
if (wc->modtype[card & 0xfc] == MOD_TYPE_BRI) {
|
||||
if (wc->mods[card & 0xfc].type == MOD_TYPE_BRI) {
|
||||
spin_lock_irqsave(&wc->reglock, flags);
|
||||
wc->modtype[card] = MOD_TYPE_BRI;
|
||||
wc->mods[card].bri = wc->mods[card & 0xfc].bri;
|
||||
wc->mods[card].type = MOD_TYPE_BRI;
|
||||
wc->mods[card].mod.bri = wc->mods[card & 0xfc].mod.bri;
|
||||
spin_unlock_irqrestore(&wc->reglock, flags);
|
||||
} else {
|
||||
ret = -2;
|
||||
@@ -2680,7 +2680,7 @@ int wctdm_init_b400m(struct wctdm *wc, int card)
|
||||
|
||||
void wctdm_unload_b400m(struct wctdm *wc, int card)
|
||||
{
|
||||
struct b400m *b4 = wc->mods[card].bri;
|
||||
struct b400m *b4 = wc->mods[card].mod.bri;
|
||||
int i;
|
||||
|
||||
/* TODO: shutdown once won't work if just a single card is hotswapped
|
||||
@@ -2748,15 +2748,15 @@ void wctdm_unload_b400m(struct wctdm *wc, int card)
|
||||
|
||||
/* Set these to MOD_TYPE_NONE to ensure that our checkisr
|
||||
* routines are not entered */
|
||||
wc->modtype[card] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 1] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 2] = MOD_TYPE_NONE;
|
||||
wc->modtype[card + 3] = MOD_TYPE_NONE;
|
||||
wc->mods[card].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 1].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 2].type = MOD_TYPE_NONE;
|
||||
wc->mods[card + 3].type = MOD_TYPE_NONE;
|
||||
|
||||
wc->mods[card].bri = NULL;
|
||||
wc->mods[card + 1].bri = NULL;
|
||||
wc->mods[card + 2].bri = NULL;
|
||||
wc->mods[card + 3].bri = NULL;
|
||||
wc->mods[card].mod.bri = NULL;
|
||||
wc->mods[card + 1].mod.bri = NULL;
|
||||
wc->mods[card + 2].mod.bri = NULL;
|
||||
wc->mods[card + 3].mod.bri = NULL;
|
||||
|
||||
msleep(voicebus_current_latency(&wc->vb) << 1);
|
||||
b4_info(b4, "Driver unloaded.\n");
|
||||
|
||||
Reference in New Issue
Block a user