summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-04-29 23:04:34 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-04-29 23:04:34 +0000
commit86952759dcdb07b5cada67f976d4d8eb14b55ebf (patch)
tree4e5a94d2a8ee219ab8ba6009400ff1d06665b73c
parent6b3c3dd9d8b272e86dbb059a97d41fab3cc4264d (diff)
Fix TDM card with big endian architectures (Mac, ARM)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@633 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwctdm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/wctdm.c b/wctdm.c
index c0de7cf..128b9ed 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -379,6 +379,16 @@ static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char ints)
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 @@ static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char ints)
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 @@ static inline void wctdm_receiveprep(struct wctdm *wc, unsigned char ints)
/* 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 @@ static inline void wctdm_receiveprep(struct wctdm *wc, unsigned char ints)
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++)