TRX: Replaced GSM 06.10 ordering table by table in libosmocodec
This commit is contained in:
parent
89e36c0e64
commit
d692b6e054
|
@ -28,6 +28,7 @@ PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.3)
|
||||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
|
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
|
||||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis)
|
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis)
|
||||||
PKG_CHECK_MODULES(LIBGPS, libgps)
|
PKG_CHECK_MODULES(LIBGPS, libgps)
|
||||||
|
PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec)
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to enable sysmocom-bts hardware support])
|
AC_MSG_CHECKING([whether to enable sysmocom-bts hardware support])
|
||||||
AC_ARG_ENABLE(sysmocom-bts,
|
AC_ARG_ENABLE(sysmocom-bts,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR)
|
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR)
|
||||||
AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS)
|
AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS)
|
||||||
LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) -lortp
|
LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) -lortp
|
||||||
|
|
||||||
EXTRA_DIST = trx_if.h l1_if.h scheduler.h gsm0503_parity.h gsm0503_conv.h gsm0503_interleaving.h gsm0503_mapping.h gsm0503_coding.h gsm0503_tables.h
|
EXTRA_DIST = trx_if.h l1_if.h scheduler.h gsm0503_parity.h gsm0503_conv.h gsm0503_interleaving.h gsm0503_mapping.h gsm0503_coding.h gsm0503_tables.h
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <osmocom/core/bits.h>
|
#include <osmocom/core/bits.h>
|
||||||
#include <osmocom/core/conv.h>
|
#include <osmocom/core/conv.h>
|
||||||
#include <osmocom/core/crcgen.h>
|
#include <osmocom/core/crcgen.h>
|
||||||
|
#include <osmocom/codec/codec.h>
|
||||||
|
|
||||||
#include "gsm0503_conv.h"
|
#include "gsm0503_conv.h"
|
||||||
#include "gsm0503_parity.h"
|
#include "gsm0503_parity.h"
|
||||||
|
@ -302,12 +303,24 @@ int pdtch_encode(ubit_t *bursts, uint8_t *l2_data, uint8_t l2_len)
|
||||||
* GSM TCH/F FR transcoding
|
* GSM TCH/F FR transcoding
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void tch_fr_reassemble(uint8_t *tch_data, ubit_t *b_bits)
|
static void tch_fr_reassemble(uint8_t *tch_data, ubit_t *b_bits, int net_order)
|
||||||
{
|
{
|
||||||
int i, j, k, l, o;
|
int i, j, k, l, o;
|
||||||
|
|
||||||
tch_data[0] = 0xd << 4;
|
tch_data[0] = 0xd << 4;
|
||||||
memset(tch_data + 1, 0, 32);
|
memset(tch_data + 1, 0, 32);
|
||||||
|
|
||||||
|
if (net_order) {
|
||||||
|
i = 0; /* counts bits */
|
||||||
|
j = 4; /* counts output bits */
|
||||||
|
while (i < 260) {
|
||||||
|
tch_data[j>>3] |= (b_bits[i] << (7-(j&7)));
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* reassemble d-bits */
|
/* reassemble d-bits */
|
||||||
i = 0; /* counts bits */
|
i = 0; /* counts bits */
|
||||||
j = 4; /* counts output bits */
|
j = 4; /* counts output bits */
|
||||||
|
@ -327,10 +340,21 @@ static void tch_fr_reassemble(uint8_t *tch_data, ubit_t *b_bits)
|
||||||
/* rearrange according to Table 2 of TS 05.03 */
|
/* rearrange according to Table 2 of TS 05.03 */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tch_fr_disassemble(ubit_t *b_bits, uint8_t *tch_data)
|
static void tch_fr_disassemble(ubit_t *b_bits, uint8_t *tch_data, int net_order)
|
||||||
{
|
{
|
||||||
int i, j, k, l, o;
|
int i, j, k, l, o;
|
||||||
|
|
||||||
|
if (net_order) {
|
||||||
|
i = 0; /* counts bits */
|
||||||
|
j = 4; /* counts output bits */
|
||||||
|
while (i < 260) {
|
||||||
|
b_bits[i] = (tch_data[j>>3] >> (7-(j&7))) & 1;
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
i = 0; /* counts bits */
|
i = 0; /* counts bits */
|
||||||
j = 4; /* counts input bits */
|
j = 4; /* counts input bits */
|
||||||
k = gsm0503_gsm_fr_map[0]-1; /* current number bit in element */
|
k = gsm0503_gsm_fr_map[0]-1; /* current number bit in element */
|
||||||
|
@ -353,7 +377,7 @@ static void tch_fr_d_to_b(ubit_t *b_bits, ubit_t *d_bits)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 260; i++)
|
for (i = 0; i < 260; i++)
|
||||||
b_bits[gsm0503_d_to_b_index[i]] = d_bits[i];
|
b_bits[gsm610_bitorder[i]] = d_bits[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tch_fr_b_to_d(ubit_t *d_bits, ubit_t *b_bits)
|
static void tch_fr_b_to_d(ubit_t *d_bits, ubit_t *b_bits)
|
||||||
|
@ -361,7 +385,7 @@ static void tch_fr_b_to_d(ubit_t *d_bits, ubit_t *b_bits)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 260; i++)
|
for (i = 0; i < 260; i++)
|
||||||
d_bits[i] = b_bits[gsm0503_d_to_b_index[i]];
|
d_bits[i] = b_bits[gsm610_bitorder[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tch_fr_unreorder(ubit_t *d, ubit_t *p, ubit_t *u)
|
static void tch_fr_unreorder(ubit_t *d, ubit_t *p, ubit_t *u)
|
||||||
|
@ -414,12 +438,9 @@ int tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int net_order)
|
||||||
if (rv)
|
if (rv)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (net_order) {
|
tch_fr_d_to_b(b, d);
|
||||||
tch_fr_d_to_b(b, d);
|
|
||||||
|
|
||||||
tch_fr_reassemble(tch_data, b);
|
tch_fr_reassemble(tch_data, b, net_order);
|
||||||
} else
|
|
||||||
tch_fr_d_to_b(tch_data, d);
|
|
||||||
|
|
||||||
len = 33;
|
len = 33;
|
||||||
} else {
|
} else {
|
||||||
|
@ -441,12 +462,9 @@ int tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len, int net_order)
|
||||||
|
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 33: /* TCH FR */
|
case 33: /* TCH FR */
|
||||||
if (net_order) {
|
tch_fr_disassemble(b, tch_data, net_order);
|
||||||
tch_fr_disassemble(b, tch_data);
|
|
||||||
|
|
||||||
tch_fr_b_to_d(d, b);
|
tch_fr_b_to_d(d, b);
|
||||||
} else
|
|
||||||
tch_fr_b_to_d(d, tch_data);
|
|
||||||
|
|
||||||
osmo_crc8gen_set_bits(&gsm0503_tch_fr_crc3, d, 50, p);
|
osmo_crc8gen_set_bits(&gsm0503_tch_fr_crc3, d, 50, p);
|
||||||
|
|
||||||
|
|
|
@ -115,25 +115,3 @@ const uint8_t gsm0503_gsm_fr_map[76] = {
|
||||||
3, 3, 3, 3
|
3, 3, 3, 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* b(0..259) from d(0..259) according to (corrected) Table 2 of T 05.03 */
|
|
||||||
const uint16_t gsm0503_d_to_b_index[260] = {
|
|
||||||
5, 52,108,164,220, 4, 11, 16, 3, 10, 15, 21, 42, 98,154,210,
|
|
||||||
51,107,163,219, 9, 25, 29, 41, 97,153,209, 40, 96,152,208, 39,
|
|
||||||
95,151,207, 38, 94,150,206, 50,106,162,218, 2, 20, 32, 37, 93,
|
|
||||||
149,205, 24, 28, 44,100,156,212, 36, 92,148,204, 46,102,158,214,
|
|
||||||
1, 8, 14, 35, 19, 23, 31, 43, 99,155,211, 49,105,161,217, 55,
|
|
||||||
58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91,111,114,117,120,
|
|
||||||
123,126,129,132,135,138,141,144,147,167,170,173,176,179,182,185,
|
|
||||||
188,191,194,197,200,203,223,226,229,232,235,238,241,244,247,250,
|
|
||||||
253,256,259, 45,101,157,213, 48,104,160,216, 54, 57, 60, 63, 66,
|
|
||||||
69, 72, 75, 78, 81, 84, 87, 90,110,113,116,119,122,125,128,131,
|
|
||||||
134,137,140,143,146,166,169,172,175,178,181,184,187,190,193,196,
|
|
||||||
199,202,222,225,228,231,234,237,240,243,246,249,252,255,258, 0,
|
|
||||||
7, 13, 27, 30, 34, 33, 12, 18, 17, 22, 47,103,159,215, 53, 56,
|
|
||||||
59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89,109,112,115,118,121,
|
|
||||||
124,127,130,133,136,139,142,145,165,168,171,174,177,180,183,186,
|
|
||||||
189,192,195,198,201,221,224,227,230,233,236,239,242,245,248,251,
|
|
||||||
254,257, 6, 26,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,5 @@ extern const sbit_t gsm0503_usf2twelve_sbit[8][12];
|
||||||
extern const uint8_t gsm0503_puncture_cs2[588];
|
extern const uint8_t gsm0503_puncture_cs2[588];
|
||||||
extern const uint8_t gsm0503_puncture_cs3[676];
|
extern const uint8_t gsm0503_puncture_cs3[676];
|
||||||
extern const uint8_t gsm0503_gsm_fr_map[76];
|
extern const uint8_t gsm0503_gsm_fr_map[76];
|
||||||
extern const uint16_t gsm0503_d_to_b_index[260];
|
|
||||||
|
|
||||||
#endif /* _0503_TABLES_H */
|
#endif /* _0503_TABLES_H */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR)
|
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR)
|
||||||
AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
|
AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS)
|
||||||
LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
|
LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS)
|
||||||
noinst_PROGRAMS = bursts_test
|
noinst_PROGRAMS = bursts_test
|
||||||
EXTRA_DIST = bursts_test.ok
|
EXTRA_DIST = bursts_test.ok
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue