diff options
author | Max <msuraev@sysmocom.de> | 2016-06-24 10:47:59 +0200 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2016-06-24 10:47:59 +0200 |
commit | bb1e3b089b9818e9d62f5a673d31ea39ff7cec6e (patch) | |
tree | c4d25f9389c72e5e7204348bb652fa32b9ff9e01 /src | |
parent | c03d3ae7af27edc035316f9d21aab5437f934b07 (diff) |
Remove duplicated nibble shift code
Those functions are now part of libosmocore.
Change-Id: Iab3206e3b41caff23f656a727605032df9798953
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bts-litecell15/tch.c | 39 | ||||
-rw-r--r-- | src/osmo-bts-octphy/l1_tch.c | 38 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/tch.c | 40 |
3 files changed, 0 insertions, 117 deletions
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index b061fe93..187f6884 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -55,45 +55,6 @@ #include "lc15bts.h" #include "l1_if.h" -/* input octet-aligned, output not octet-aligned */ -void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - /* first byte: upper nibble empty, lower nibble from src */ - out[0] = (in[0] >> 4); - - /* bytes 1.. */ - for (i = 1; i < num_whole_bytes; i++) - out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4); - else - out[i] = (in[i-1] & 0xF) << 4; -} - - -/* input unaligned, output octet-aligned */ -void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - for (i = 0; i < num_whole_bytes; i++) - out[i] = ((in[i] & 0xF) << 4) | (in[i+1] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = (in[i] & 0xF) << 4; -} - static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len, struct gsm_lchan *lchan) { diff --git a/src/osmo-bts-octphy/l1_tch.c b/src/osmo-bts-octphy/l1_tch.c index af789802..d12a1cb5 100644 --- a/src/osmo-bts-octphy/l1_tch.c +++ b/src/osmo-bts-octphy/l1_tch.c @@ -38,44 +38,6 @@ #include "l1_if.h" -/* input octet-aligned, output not octet-aligned */ -void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - /* first byte: upper nibble empty, lower nibble from src */ - out[0] = (in[0] >> 4); - - /* bytes 1.. */ - for (i = 1; i < num_whole_bytes; i++) - out[i] = ((in[i - 1] & 0xF) << 4) | (in[i] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = ((in[i - 1] & 0xF) << 4) | (in[i] >> 4); - else - out[i] = (in[i - 1] & 0xF) << 4; -} - -/* input unaligned, output octet-aligned */ -void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - for (i = 0; i < num_whole_bytes; i++) - out[i] = ((in[i] & 0xF) << 4) | (in[i + 1] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = (in[i] & 0xF) << 4; -} - struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len) { struct msgb *msg; diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 527f9e16..39feae10 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -52,46 +52,6 @@ #include "femtobts.h" #include "l1_if.h" -/* input octet-aligned, output not octet-aligned */ -void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - /* first byte: upper nibble empty, lower nibble from src */ - out[0] = (in[0] >> 4); - - /* bytes 1.. */ - for (i = 1; i < num_whole_bytes; i++) - out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4); - else - out[i] = (in[i-1] & 0xF) << 4; -} - - -/* input unaligned, output octet-aligned */ -void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in, - unsigned int num_nibbles) -{ - unsigned int i; - unsigned int num_whole_bytes = num_nibbles / 2; - - for (i = 0; i < num_whole_bytes; i++) - out[i] = ((in[i] & 0xF) << 4) | (in[i+1] >> 4); - - /* shift the last nibble, in case there's an odd count */ - i = num_whole_bytes; - if (num_nibbles & 1) - out[i] = (in[i] & 0xF) << 4; -} - - static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len, struct gsm_lchan *lchan) { |