summaryrefslogtreecommitdiff
path: root/wctdm24xxp
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-11-21 23:51:48 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-11-21 23:51:48 +0000
commitc0de14aa2283e8df6a778a44d18154c9b613b5be (patch)
tree3be03bcc51e41c9805d1f40484d42e8ce0a6f120 /wctdm24xxp
parent54a03c0ce0a011b0f7d942b0f609304976b49def (diff)
Add new product support
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3243 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp')
-rw-r--r--wctdm24xxp/base.c43
-rw-r--r--wctdm24xxp/wctdm24xxp.h2
2 files changed, 41 insertions, 4 deletions
diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c
index 5101395..fbff575 100644
--- a/wctdm24xxp/base.c
+++ b/wctdm24xxp/base.c
@@ -246,6 +246,7 @@ struct wctdm_desc {
static struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 };
static struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 };
+static struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 };
static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", 0, 24 };
static struct wctdm_desc wcaex800 = { "Wildcard AEX800", 0, 8 };
@@ -280,6 +281,23 @@ static const char *vpm150m_firmware = "VPMADT032.bin";
static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane);
+static inline int CMD_BYTE(int card, int bit, int altcs)
+{
+ /* Let's add some trickery to make the TDM410 work */
+ if (altcs == 3) {
+ if (card == 2) {
+ card = 4;
+ altcs = 0;
+ } else if (card == 3) {
+ card = 5;
+ altcs = 2;
+ }
+ }
+
+ return (((((card) & 0x3) * 3 + (bit)) * 7) \
+ + ((card) >> 2) + (altcs) + ((altcs) ? -21 : 0));
+}
+
/* sleep in user space until woken up. Equivilant of tsleep() in BSD */
int schluffen(wait_queue_head_t *q)
{
@@ -719,6 +737,16 @@ static inline void wctdm_transmitprep(struct wctdm *wc, int dbl)
if (x < ZT_CHUNKSIZE - 1) {
writechunk[EFRAME_SIZE] = wc->ctlreg;
writechunk[EFRAME_SIZE + 1] = wc->txident++;
+#if 1
+ if ((wc->type == 4) && ((wc->ctlreg & 0x10) || (wc->modtype[NUM_CARDS] == MOD_TYPE_NONE))) {
+ writechunk[EFRAME_SIZE + 2] = 0;
+ for (y = 0; y < 4; y++) {
+ if (wc->modtype[y] == MOD_TYPE_NONE)
+ writechunk[EFRAME_SIZE + 2] |= (1 << y);
+ }
+ } else
+ writechunk[EFRAME_SIZE + 2] = 0xf;
+#endif
}
writechunk += (EFRAME_SIZE + EFRAME_GAP);
}
@@ -3318,11 +3346,17 @@ retry:
wc->cardflag |= (1 << x);
printk("Port %d: Installed -- AUTO FXO (%s mode)\n",x + 1, fxo_modes[_opermode].name);
} else {
- if ((wc->type == 8) && ((x & 0x3) == 1) && !wc->altcs[x]) {
+ if ((wc->type != 24) && ((x & 0x3) == 1) && !wc->altcs[x]) {
spin_lock_irqsave(&wc->reglock, flags);
+ wc->altcs[x] = 2;
+ if (wc->type == 4) {
+ wc->altcs[x+1] = 3;
+ wc->altcs[x+2] = 3;
+ }
wc->modtype[x] = MOD_TYPE_FXSINIT;
- wc->altcs[x] = 2;
spin_unlock_irqrestore(&wc->reglock, flags);
+
+ schluffen(&wc->regq);
schluffen(&wc->regq);
spin_lock_irqsave(&wc->reglock, flags);
wc->modtype[x] = MOD_TYPE_FXS;
@@ -3330,7 +3364,7 @@ retry:
if (debug & DEBUG_CARD)
printk("Trying port %d with alternate chip select\n", x + 1);
goto retry;
- } else {
+ } else {
printk("Port %d: Not installed\n", x + 1);
wc->modtype[x] = MOD_TYPE_NONE;
wc->cardflag |= (1 << x);
@@ -3345,7 +3379,7 @@ retry:
wc->ctlreg |= 0x10;
} else {
spin_lock_irqsave(&wc->reglock, flags);
- for (x = wc->cards; x < wc->cards+NUM_EC; x++)
+ for (x = NUM_CARDS; x < NUM_CARDS + NUM_EC; x++)
wc->modtype[x] = MOD_TYPE_NONE;
spin_unlock_irqrestore(&wc->reglock, flags);
wctdm_vpm150m_init(wc);
@@ -3551,6 +3585,7 @@ static struct pci_device_id wctdm_pci_tbl[] = {
{ 0xd161, 0x0800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm800 },
{ 0xd161, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcaex800 },
{ 0xd161, 0x8003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcaex2400 },
+ { 0xd161, 0x8005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm410 },
{ 0 }
};
diff --git a/wctdm24xxp/wctdm24xxp.h b/wctdm24xxp/wctdm24xxp.h
index 89d708e..40f919c 100644
--- a/wctdm24xxp/wctdm24xxp.h
+++ b/wctdm24xxp/wctdm24xxp.h
@@ -50,8 +50,10 @@
#define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR)
#define CMD_RD(a) (((a) << 8) | __CMD_RD)
+#if 0
#define CMD_BYTE(card,bit,altcs) (((((card) & 0x3) * 3 + (bit)) * 7) \
+ ((card) >> 2) + (altcs) + ((altcs) ? -21 : 0))
+#endif
#define NUM_CARDS 24
#define NUM_EC 4
#define NUM_SLOTS 6