diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2005-04-29 23:04:34 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2005-04-29 23:04:34 +0000 |
commit | 86952759dcdb07b5cada67f976d4d8eb14b55ebf (patch) | |
tree | 4e5a94d2a8ee219ab8ba6009400ff1d06665b73c | |
parent | 6b3c3dd9d8b272e86dbb059a97d41fab3cc4264d (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-x | wctdm.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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++) |