aboutsummaryrefslogtreecommitdiffstats
path: root/src/trau_frame.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-02-09 18:13:26 +0000
committerHarald Welte <laforge@gnumonks.org>2009-02-09 18:13:26 +0000
commit1fa60c8ab04653bae5ac29d8d93ad18b44f0f354 (patch)
tree35aa1e0c66c605576bb900347c465e9120a85fc0 /src/trau_frame.c
parent0b4c34e3ca22da724de308b8154a2730b53fc388 (diff)
* add trau_mux implementation to relay from one incoming TRAU
channel to another one (simple voice call switching) * add a way more generic E1 input layer, abstracting out the misdn low-level interface. This also adds infrastructure for multiple TRX in one BTS, as well as multiple BTS on one E1 link * add a E1 subchannel multiplexer for sending multiple 16kbit sub-channels one one 64kBps E1 channel * add TRAU IDLE frame generation * terminate bsc_hack in case there is a E1 / mISDN init error * introduce 'e1_config.c' file with static configuration of our E1 setup (which TRX/BTS is configured for which TEI/SAPI/E1). This should later become a config file rather than a compiled C file. WARNING: all this compiles but is not tested yet. Expect fix-up committs over the next hours or so
Diffstat (limited to 'src/trau_frame.c')
-rw-r--r--src/trau_frame.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/trau_frame.c b/src/trau_frame.c
index 9d7e517ff..4b02c7bb2 100644
--- a/src/trau_frame.c
+++ b/src/trau_frame.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <openbsc/trau_frame.h>
+#include <openbsc/subchan_demux.h>
static u_int32_t get_bits(const u_int8_t *bitbuf, int offset, int num)
{
@@ -192,6 +193,9 @@ static void encode_fr(u_int8_t *trau_bits, const struct decoded_trau_frame *fr)
memcpy(trau_bits + 305, fr->d_bits + d_idx, 5);
/* C16 .. C21 */
memcpy(trau_bits+310, fr->c_bits+15, 6);
+
+ /* FIXME: handle timing adjustment */
+
/* T1 .. T4 */
memcpy(trau_bits+316, fr->t_bits+0, 4);
}
@@ -230,3 +234,21 @@ int encode_trau_frame(u_int8_t *trau_bits, const struct decoded_trau_frame *fr)
return 0;
}
+
+static struct decoded_trau_frame fr_idle_frame = {
+ .c_bits = { 0, 1, 1, 1, 0 }, /* IDLE DOWNLINK 3.5.5 */
+ .t_bits = { 1, 1, 1, 1 },
+};
+static u_int8_t encoded_idle_frame[TRAU_FRAME_BITS];
+static int dbits_initted;
+
+u_int8_t *trau_idle_frame(void)
+{
+ /* only initialize during the first call */
+ if (!dbits_initted) {
+ /* set all D-bits to 1 */
+ memset(&fr_idle_frame.d_bits, 0x01, 260);
+ encode_fr(encoded_idle_frame, &fr_idle_frame);
+ }
+ return encoded_idle_frame;
+}