fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/38750?usp=email )
Change subject: csd_v110: use osmo_csd_ra2_* API from libosmotrau ......................................................................
csd_v110: use osmo_csd_ra2_* API from libosmotrau
Change-Id: I0be44b15a812397377fe7772b988724dd205737c Depends: libosmo-abis.git I7b98b958651b3fc1a814d119d1b8644c91f98676 --- M TODO-RELEASE M src/common/csd_v110.c 2 files changed, 10 insertions(+), 25 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/38750/1
diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..81aa834 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmotrau >1.6.0 osmo_csd_ra2_{16k,8k}_{pack,unpack}() API diff --git a/src/common/csd_v110.c b/src/common/csd_v110.c index e307a6e..f60624f 100644 --- a/src/common/csd_v110.c +++ b/src/common/csd_v110.c @@ -29,6 +29,7 @@ #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/isdn/v110.h> +#include <osmocom/trau/csd_ra2.h>
#include <osmo-bts/csd_v110.h> #include <osmo-bts/lchan.h> @@ -133,20 +134,10 @@
ra1_ra2: /* RA1/RA2: convert from an intermediate rate to 64 kbit/s */ - if (desc->ra2_ir == 16) { - /* 4 * 80 bits (16 kbit/s) => 2 bits per octet */ - for (unsigned int i = 0, j = 0; i < RFC4040_RTP_PLEN; i++) { - rtp[i] = (0xff >> 2); - rtp[i] |= (ra_bits[j++] << 7); - rtp[i] |= (ra_bits[j++] << 6); - } - } else { - /* 2 * 80 bits (8 kbit/s) => 1 bit per octet */ - for (unsigned int i = 0; i < RFC4040_RTP_PLEN; i++) { - rtp[i] = (0xff >> 1); - rtp[i] |= (ra_bits[i] << 7); - } - } + if (desc->ra2_ir == 16) + osmo_csd_ra2_16k_pack(&rtp[0], &ra_bits[0], RFC4040_RTP_PLEN); + else /* desc->ra2_ir == 8 */ + osmo_csd_ra2_8k_pack(&rtp[0], &ra_bits[0], RFC4040_RTP_PLEN);
return RFC4040_RTP_PLEN; } @@ -181,17 +172,10 @@ return -EINVAL;
/* RA1/RA2: convert from 64 kbit/s to an intermediate rate */ - if (desc->ra2_ir == 16) { - /* 4 * 80 bits (16 kbit/s) => 2 bits per octet */ - for (unsigned int i = 0, j = 0; i < RFC4040_RTP_PLEN; i++) { - ra_bits[j++] = (rtp[i] >> 7); - ra_bits[j++] = (rtp[i] >> 6) & 0x01; - } - } else { - /* 2 * 80 bits (8 kbit/s) => 1 bit per octet */ - for (unsigned int i = 0; i < RFC4040_RTP_PLEN; i++) - ra_bits[i] = (rtp[i] >> 7); - } + if (desc->ra2_ir == 16) + osmo_csd_ra2_16k_unpack(&ra_bits[0], &rtp[0], RFC4040_RTP_PLEN); + else /* desc->ra2_ir == 8 */ + osmo_csd_ra2_8k_unpack(&ra_bits[0], &rtp[0], RFC4040_RTP_PLEN);
/* RA1'/RA1: convert from an intermediate rate to radio rate */ for (unsigned int i = 0; i < desc->num_blocks; i++) {