aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/gsm0503_mapping.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-02-24 10:12:09 +0100
committerHarald Welte <laforge@gnumonks.org>2015-09-22 16:41:26 +0200
commit89e36c0e646a9e73728ee65cc6ac32f01d388885 (patch)
treef7b903bf7f8d0b6c61f6717b21ce59531d919d62 /src/osmo-bts-trx/gsm0503_mapping.c
parent801c182c02a38c9e3fb89c431caabc4c5abddf6f (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.c65
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;
+}
+