[Asterisk-cvs] zaptel wctdm.c,1.109,1.110
markster at lists.digium.com
markster at lists.digium.com
Fri Apr 29 18:15:03 CDT 2005
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv14260
Modified Files:
wctdm.c
Log Message:
Fix TDM card with big endian architectures (Mac, ARM)
Index: wctdm.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- wctdm.c 21 Mar 2005 05:14:11 -0000 1.109
+++ wctdm.c 29 Apr 2005 23:04:34 -0000 1.110
@@ -379,6 +379,16 @@
for (x=0;x<ZT_CHUNKSIZE;x++) {
/* Send a sample, as a 32-bit word */
writechunk[x] = 0;
+#ifdef __BIG_ENDIAN
+ if (wc->cardflag & (1 << 3))
+ writechunk[x] |= (wc->chans[3].writechunk[x]);
+ if (wc->cardflag & (1 << 2))
+ writechunk[x] |= (wc->chans[2].writechunk[x] << 8);
+ if (wc->cardflag & (1 << 1))
+ writechunk[x] |= (wc->chans[1].writechunk[x] << 16);
+ if (wc->cardflag & (1 << 0))
+ writechunk[x] |= (wc->chans[0].writechunk[x] << 24);
+#else
if (wc->cardflag & (1 << 3))
writechunk[x] |= (wc->chans[3].writechunk[x] << 24);
if (wc->cardflag & (1 << 2))
@@ -387,7 +397,7 @@
writechunk[x] |= (wc->chans[1].writechunk[x] << 8);
if (wc->cardflag & (1 << 0))
writechunk[x] |= (wc->chans[0].writechunk[x]);
-
+#endif
}
}
@@ -454,6 +464,16 @@
/* Read is at interrupt address. Valid data is available at normal offset */
readchunk = wc->readchunk;
for (x=0;x<ZT_CHUNKSIZE;x++) {
+#ifdef __BIG_ENDIAN
+ if (wc->cardflag & (1 << 3))
+ wc->chans[3].readchunk[x] = (readchunk[x]) & 0xff;
+ if (wc->cardflag & (1 << 2))
+ wc->chans[2].readchunk[x] = (readchunk[x] >> 8) & 0xff;
+ if (wc->cardflag & (1 << 1))
+ wc->chans[1].readchunk[x] = (readchunk[x] >> 16) & 0xff;
+ if (wc->cardflag & (1 << 0))
+ wc->chans[0].readchunk[x] = (readchunk[x] >> 24) & 0xff;
+#else
if (wc->cardflag & (1 << 3))
wc->chans[3].readchunk[x] = (readchunk[x] >> 24) & 0xff;
if (wc->cardflag & (1 << 2))
@@ -462,6 +482,7 @@
wc->chans[1].readchunk[x] = (readchunk[x] >> 8) & 0xff;
if (wc->cardflag & (1 << 0))
wc->chans[0].readchunk[x] = (readchunk[x]) & 0xff;
+#endif
}
#ifdef AUDIO_RINGCHECK
for (x=0;x<wc->cards;x++)
More information about the svn-commits
mailing list