fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/33934 )
Change subject: csd_v110_rtp_encode(): properly set E1/E2/E3 bits ......................................................................
csd_v110_rtp_encode(): properly set E1/E2/E3 bits
The E1/E2/E3 bits are set based on out-of-band knowledge of the current user data rate. The actual bit values are defined in 3GPP TS 44.021, Figure 4 "Coding of data rates".
TODO: this is only valid for transparent services, for non-transparent services see 3GPP TS 48.020. TODO: lchan->csd_mode is never set to the actual CSD mode...
Change-Id: I1a14597dff746cf975140b294400a2cc05badccd Related: OS#1572 --- M include/osmo-bts/lchan.h M src/common/csd_v110.c 2 files changed, 38 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/34/33934/1
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h index a0e99bf..05c395a 100644 --- a/include/osmo-bts/lchan.h +++ b/include/osmo-bts/lchan.h @@ -75,15 +75,17 @@ };
enum lchan_csd_mode { - LCHAN_CSD_M_NT, + LCHAN_CSD_M_NT = 0, LCHAN_CSD_M_T_1200_75, LCHAN_CSD_M_T_600, LCHAN_CSD_M_T_1200, LCHAN_CSD_M_T_2400, + LCHAN_CSD_M_T_4800, LCHAN_CSD_M_T_9600, LCHAN_CSD_M_T_14400, LCHAN_CSD_M_T_29000, LCHAN_CSD_M_T_32000, + _LCHAN_CSD_M_NUM, };
/* State of the SAPIs in the lchan */ diff --git a/src/common/csd_v110.c b/src/common/csd_v110.c index 8870732..0061935 100644 --- a/src/common/csd_v110.c +++ b/src/common/csd_v110.c @@ -34,6 +34,19 @@
#define DATA_RATE(type, mode) ((type << 8) | mode)
+/* 3GPP TS 44.021, Figure 4: Coding of data rates (E1/E2/E3 bits) */ +static const uint8_t e1e2e3_map[_LCHAN_CSD_M_NUM][3] = { + [LCHAN_CSD_M_T_600] = { 1, 0, 0 }, + [LCHAN_CSD_M_T_1200] = { 0, 1, 0 }, + [LCHAN_CSD_M_T_2400] = { 1, 1, 0 }, + [LCHAN_CSD_M_T_4800] = { 0, 1, 1 }, + [LCHAN_CSD_M_T_9600] = { 0, 1, 1 }, +/* [LCHAN_CSD_M_T_19200] = { 0, 1, 1 }, */ +/* [LCHAN_CSD_M_T_38400] = { 0, 1, 1 }, */ + [LCHAN_CSD_M_T_14400] = { 1, 0, 1 }, +/* [LCHAN_CSD_M_T_28800] = { 1, 0, 1 }, */ +}; + static int lchan_data_rate(const struct gsm_lchan *lchan, size_t *num_blocks, size_t *num_bits) @@ -98,8 +111,10 @@ else /* num_bits == 36 */ osmo_csd_3k6_decode_frame(&df, &data[i * 36], 36);
- /* FIXME: E1 .. E3 must be set by out-of-band knowledge! */ - memset(&df.e_bits[0], 0, 3); + /* E1 .. E3 must set by out-of-band knowledge */ + df.e_bits[0] = e1e2e3_map[lchan->csd_mode][0]; + df.e_bits[1] = e1e2e3_map[lchan->csd_mode][1]; + df.e_bits[2] = e1e2e3_map[lchan->csd_mode][2];
osmo_v110_encode_frame(&ra_bits[i * 80], 80, &df); }