summaryrefslogtreecommitdiff
path: root/wcfxs.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-06-20 16:20:40 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-06-20 16:20:40 +0000
commitb40acbadfeec861fee8c403d9fc019f2ec73ccbd (patch)
tree7b8d0035a7674b395bc05d77a665207130104d4e /wcfxs.c
parent29ebfe8a9da5898e9e884c41cb5091b50e29a741 (diff)
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@88 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-xwcfxs.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/wcfxs.c b/wcfxs.c
index e4a22b2..9b33b04 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -116,11 +116,11 @@ static alpha indirect_regs[] =
#define WC_REGBASE 0xc0
-#define WC_LEDS 0x0
+#define WC_SYNC 0x0
#define WC_TEST 0x1
#define WC_CS 0x2
#define WC_VER 0x3
-#define WC_SYNC 0x4
+#define WC_LEDS 0x4
#define BIT_CS (1 << 2)
#define BIT_SCLK (1 << 3)
@@ -228,7 +228,9 @@ static inline void wcfxs_receiveprep(struct wcfxs *wc, unsigned char ints)
if (wc->cards > 3)
wc->chans[3].readchunk[x] = (readchunk[x]) & 0xff;
}
-
+ /* XXX We're wasting 8 taps. We should get closer :( */
+ for (x=0;x<wc->cards;x++)
+ zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, wc->chans[x].writechunk);
zt_receive(&wc->span);
}
@@ -267,8 +269,8 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if ((wc->intcount % 10) < wc->cards) {
wcfxs_check_hook(wc, wc->intcount % 10);
}
- if (ints & 0xc) wcfxs_receiveprep(wc, ints);
- if (ints & 3) wcfxs_transmitprep(wc, ints);
+ wcfxs_receiveprep(wc, ints);
+ wcfxs_transmitprep(wc, ints);
}
}
@@ -312,14 +314,14 @@ static inline unsigned char read_8bits(struct wcfxs *wc)
/* Get SCLK */
wc->ios &= ~BIT_SCLK;
outb(wc->ios, wc->ioaddr + WC_AUXD);
- /* Now raise SCLK high again */
- wc->ios |= BIT_SCLK;
- outb(wc->ios, wc->ioaddr + WC_AUXD);
/* Read back the value */
c = inb(wc->ioaddr + WC_AUXR);
if (c & BIT_SDO)
res |= 1;
+ /* Now raise SCLK high again */
+ wc->ios |= BIT_SCLK;
+ outb(wc->ios, wc->ioaddr + WC_AUXD);
}
/* Finally raise CS back high again */
wc->ios |= BIT_CS;
@@ -956,7 +958,7 @@ static int wcfxs_hardware_init(struct wcfxs *wc)
failed = 0;
if (ver != 0x59) {
printk("Freshmaker version: %02x\n", ver);
- for (x=0;x<254;x++) {
+ for (x=0;x<255;x++) {
/* Test registers */
wcfxs_setcreg(wc, WC_TEST, x);
y = wcfxs_getcreg(wc, WC_TEST);
@@ -972,7 +974,11 @@ static int wcfxs_hardware_init(struct wcfxs *wc)
return -1;
}
/* Go to half-duty FSYNC */
- wcfxs_setcreg(wc, WC_SYNC, 1);
+ wcfxs_setcreg(wc, WC_SYNC, 0x1);
+ y = wcfxs_getcreg(wc, WC_SYNC);
+ printk("SYNC is %d\n", y);
+ /* Turn off LED's */
+ wcfxs_setcreg(wc, WC_LEDS, 0xff);
} else {
printk("No freshmaker chip\n");
}