diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-02-24 10:12:09 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-09-22 16:41:26 +0200 |
commit | 89e36c0e646a9e73728ee65cc6ac32f01d388885 (patch) | |
tree | f7b903bf7f8d0b6c61f6717b21ce59531d919d62 /src/osmo-bts-trx/gsm0503_mapping.c | |
parent | 801c182c02a38c9e3fb89c431caabc4c5abddf6f (diff) |
TRX: Cleanup of channel transcoding
Diffstat (limited to 'src/osmo-bts-trx/gsm0503_mapping.c')
-rw-r--r-- | src/osmo-bts-trx/gsm0503_mapping.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/osmo-bts-trx/gsm0503_mapping.c b/src/osmo-bts-trx/gsm0503_mapping.c new file mode 100644 index 00000000..e5ee9206 --- /dev/null +++ b/src/osmo-bts-trx/gsm0503_mapping.c @@ -0,0 +1,65 @@ + +#include <stdint.h> +#include <string.h> + +#include <osmocom/core/bits.h> + +#include "gsm0503_mapping.h" + +void gsm0503_xcch_burst_unmap(sbit_t *iB, sbit_t *eB, sbit_t *hl, sbit_t *hn) +{ + memcpy(iB, eB, 57); + memcpy(iB+57, eB+59, 57); + + if (hl) + *hl = eB[57]; + + if (hn) + *hn = eB[58]; +} + +void gsm0503_xcch_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *hl, + const ubit_t *hn) +{ + memcpy(eB, iB, 57); + memcpy(eB+59, iB+57, 57); + + if (hl) + eB[57] = *hl; + if (hn) + eB[58] = *hn; +} + +void gsm0503_tch_fr_burst_unmap(sbit_t *iB, sbit_t *eB, sbit_t *h, int odd) +{ + int i; + + /* brainfuck: only copy even or odd bits */ + for (i=odd; i<57; i+=2) + iB[i] = eB[i]; + for (i=58-odd; i<114; i+=2) + iB[i] = eB[i+2]; + + if (h && !odd) + *h = eB[58]; + + if (h && odd) + *h = eB[57]; +} + +void gsm0503_tch_fr_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *h, int odd) +{ + int i; + + /* brainfuck: only copy even or odd bits */ + for (i=odd; i<57; i+=2) + eB[i] = iB[i]; + for (i=58-odd; i<114; i+=2) + eB[i+2] = iB[i]; + + if (h && !odd) + eB[58] = *h; + if (h && odd) + eB[57] = *h; +} + |