diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-09-16 21:02:25 +0000 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-09-16 21:02:25 +0000 |
commit | dd8c73cc6da6e8bdc027bc9f05126aad60a71f72 (patch) | |
tree | c756469f26e6255ad50166daec2092888bdbd621 | |
parent | 2fd4fe6aa109c8df50baac465f0393a303a64dd2 (diff) |
Revert "gsm0808: add function to convert amr gsm0408 setings to gsm0808"
This reverts commit 2fd4fe6aa109c8df50baac465f0393a303a64dd2.
As shown in https://jenkins.osmocom.org/jenkins/view/master/job/master-libosmocore/475/a2=default,a3=default,arch=amd64,label=osmocom-master-debian9/console
This commit breaks gsm0808_test with:
stderr:
--- expout 2018-09-16 22:37:31.382280438 +0200
+++ /n/s/dev/make/libosmocore/tests/testsuite.dir/at-groups/21/stdout 2018-09-16 22:37:31.426281372 +0200
@@ -78,9 +78,9 @@
Input:
m4_75= 0 smod= 0
m5_15= 0 spare= 0
- m5_90= 0 icmi= 0
+ m5_90= 0 icmi= 1
m6_70= 0 nscb= 0
- m7_40= 0 ver= 0
+ m7_40= 0 ver= 6
m7_95= 0
m10_2= 0
m12_2= 0
@@ -92,9 +92,9 @@
Input:
m4_75= 1 smod= 0
m5_15= 0 spare= 0
- m5_90= 0 icmi= 0
+ m5_90= 0 icmi= 1
m6_70= 0 nscb= 0
- m7_40= 0 ver= 0
+ m7_40= 0 ver= 6
m7_95= 0
m10_2= 0
m12_2= 0
@@ -106,9 +106,9 @@
Input:
m4_75= 0 smod= 0
m5_15= 1 spare= 0
- m5_90= 0 icmi= 0
+ m5_90= 0 icmi= 1
[...]
Change-Id: I9e0d405e303ed86d23703ca6362e958dddb2f861
-rw-r--r-- | include/osmocom/gsm/gsm0808_utils.h | 1 | ||||
-rw-r--r-- | include/osmocom/gsm/protocol/gsm_08_08.h | 14 | ||||
-rw-r--r-- | src/gsm/gsm0808_utils.c | 43 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 1 | ||||
-rw-r--r-- | tests/gsm0808/gsm0808_test.c | 196 | ||||
-rw-r--r-- | tests/gsm0808/gsm0808_test.ok | 225 |
6 files changed, 0 insertions, 480 deletions
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 0a7429e9..242bce94 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -104,7 +104,6 @@ int gsm0808_dec_cell_id(struct gsm0808_cell_id *ci, const uint8_t *elem, uint8_t int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch); int gsm0808_speech_codec_from_chan_type(struct gsm0808_speech_codec *sc, uint8_t perm_spch); -uint16_t gsm0808_sc_cfg_from_gsm48_mr_cfg(struct gsm48_multi_rate_conf *cfg, bool fr); /*! Return 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum gsm_chan_t. */ static inline uint8_t gsm0808_current_channel_type_1(enum gsm_chan_t type) diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index 8431ace5..94338178 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -503,20 +503,6 @@ enum gsm0808_speech_codec_defaults { GSM0808_SC_CFG_DEFAULT_OHR_AMR_WB = 0x01, }; -/*! Default speech codec configurations broken down by reate. - * See also: 3GPP TS 28.062, Table 7.11.3.1.3-2: Preferred Configurations for - * the Adaptive Multi-Rate Codec Types. */ -enum gsm0808_speech_codec_rate_defaults { - GSM0808_SC_CFG_DEFAULT_AMR_4_75 = 0xff03, - GSM0808_SC_CFG_DEFAULT_AMR_5_15 = 0x0000, - GSM0808_SC_CFG_DEFAULT_AMR_5_90 = 0xff06, - GSM0808_SC_CFG_DEFAULT_AMR_6_70 = 0x3e08, - GSM0808_SC_CFG_DEFAULT_AMR_7_40 = 0x0c12, - GSM0808_SC_CFG_DEFAULT_AMR_7_95 = 0xc020, - GSM0808_SC_CFG_DEFAULT_AMR_10_2 = 0x3040, - GSM0808_SC_CFG_DEFAULT_AMR_12_2 = 0xc082 -}; - /* 3GPP TS 48.008 3.2.2.103 Speech Codec List */ #define SPEECH_CODEC_MAXLEN 255 struct gsm0808_speech_codec_list { diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 4b2a5f56..73f02341 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -1161,49 +1161,6 @@ int gsm0808_speech_codec_from_chan_type(struct gsm0808_speech_codec *sc, return 0; } -/*! Determine a set of AMR speech codec configuration bits (S0-S15) from a - * given GSM 04.08 AMR configuration struct. - * \param[in] cfg AMR configuration in GSM 04.08 format. - * \param[in] hint if the resulting configuration shall be used with a FR or HR TCH. - * \returns configuration bits (S0-S15) */ -uint16_t gsm0808_sc_cfg_from_gsm48_mr_cfg(struct gsm48_multi_rate_conf *cfg, - bool fr) -{ - uint16_t s15_s0 = 0; - - /* Check each rate bit in the AMR multirate configuration and pick the - * matching default configuration as specified in 3GPP TS 28.062, - * Table 7.11.3.1.3-2. */ - if (cfg->m4_75) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_4_75; - if (cfg->m5_15) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_5_15; - if (cfg->m5_90) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_5_90; - if (cfg->m6_70) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_6_70; - if (cfg->m7_40) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_7_40; - if (cfg->m7_95) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_7_95; - if (cfg->m10_2) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_10_2; - if (cfg->m12_2) - s15_s0 |= GSM0808_SC_CFG_DEFAULT_AMR_12_2; - - /* Note: 3GPP TS 48.008, chapter 3GPP TS 48.008 states that for AMR - * some of the configuration bits must be coded as zeros. The applied - * bitmask matches the default codec settings. See also the definition - * of enum gsm0808_speech_codec_defaults in gsm_08_08.h and - * 3GPP TS 28.062, Table 7.11.3.1.3-2. */ - if (fr) - s15_s0 &= GSM0808_SC_CFG_DEFAULT_FR_AMR; - else - s15_s0 &= GSM0808_SC_CFG_DEFAULT_HR_AMR; - - return s15_s0; -} - /*! Print a human readable name of the cell identifier to the char buffer. * This is useful both for struct gsm0808_cell_id and struct gsm0808_cell_id_list2. * See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name(). diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3d08232c..0c40c88c 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -205,7 +205,6 @@ gsm0808_cell_id_discr_names; gsm0808_cell_id_u_name; gsm0808_chan_type_to_speech_codec; gsm0808_speech_codec_from_chan_type; -gsm0808_sc_cfg_from_gsm48_mr_cfg; gsm0808_speech_codec_type_names; gsm0808_permitted_speech_names; gsm0808_chosen_enc_alg_names; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 29cecb2e..ae138be8 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -1444,200 +1444,6 @@ static void test_gsm0808_enc_dec_cell_id_global() msgb_free(msg); } -static void test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(struct gsm48_multi_rate_conf *cfg) -{ - uint16_t s15_s0; - - printf("Input:\n"); - printf(" m4_75= %u smod= %u\n", cfg->m4_75, cfg->smod); - printf(" m5_15= %u spare= %u\n", cfg->m5_15, cfg->spare); - printf(" m5_90= %u icmi= %u\n", cfg->m5_90, cfg->icmi); - printf(" m6_70= %u nscb= %u\n", cfg->m6_70, cfg->nscb); - printf(" m7_40= %u ver= %u\n", cfg->m7_40, cfg->ver); - printf(" m7_95= %u\n", cfg->m7_95); - printf(" m10_2= %u\n", cfg->m10_2); - printf(" m12_2= %u\n", cfg->m12_2); - - s15_s0 = gsm0808_sc_cfg_from_gsm48_mr_cfg(cfg, true); - printf("Result (fr):\n"); - printf(" S15-S0 = %04x = 0b" OSMO_BIN_SPEC OSMO_BIN_SPEC "\n", s15_s0, - OSMO_BIN_PRINT(s15_s0 >> 8), OSMO_BIN_PRINT(s15_s0)); - - s15_s0 = gsm0808_sc_cfg_from_gsm48_mr_cfg(cfg, false); - printf("Result (hr):\n"); - printf(" S15-S0 = %04x = 0b" OSMO_BIN_SPEC OSMO_BIN_SPEC "\n", s15_s0, - OSMO_BIN_PRINT(s15_s0 >> 8), OSMO_BIN_PRINT(s15_s0)); - - printf("\n"); -} - -static void test_gsm0808_sc_cfg_from_gsm48_mr_cfg(void) -{ - struct gsm48_multi_rate_conf cfg; - - printf("Testing gsm0808_sc_cfg_from_gsm48_mr_cfg():\n"); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 1; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 1; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 1; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 1; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 1; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 1; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 1; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 1; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 1; - cfg.m5_15 = 1; - cfg.m5_90 = 1; - cfg.m6_70 = 1; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 1; - cfg.m7_95 = 1; - cfg.m10_2 = 1; - cfg.m12_2 = 1; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 0; - cfg.m5_90 = 1; - cfg.m6_70 = 1; - cfg.m7_40 = 0; - cfg.m7_95 = 0; - cfg.m10_2 = 1; - cfg.m12_2 = 1; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 1; - cfg.m5_15 = 1; - cfg.m5_90 = 0; - cfg.m6_70 = 0; - cfg.m7_40 = 1; - cfg.m7_95 = 1; - cfg.m10_2 = 0; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 0; - cfg.m5_15 = 1; - cfg.m5_90 = 0; - cfg.m6_70 = 1; - cfg.m7_40 = 0; - cfg.m7_95 = 1; - cfg.m10_2 = 0; - cfg.m12_2 = 1; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 1; - cfg.m5_15 = 0; - cfg.m5_90 = 1; - cfg.m6_70 = 0; - cfg.m7_40 = 1; - cfg.m7_95 = 0; - cfg.m10_2 = 1; - cfg.m12_2 = 0; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); - - cfg.m4_75 = 1; - cfg.m5_15 = 1; - cfg.m5_90 = 1; - cfg.m6_70 = 1; - cfg.m7_40 = 1; - cfg.m7_95 = 1; - cfg.m10_2 = 1; - cfg.m12_2 = 1; - test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(&cfg); -} - int main(int argc, char **argv) { printf("Testing generation of GSM0808 messages\n"); @@ -1689,8 +1495,6 @@ int main(int argc, char **argv) test_gsm0808_enc_dec_cell_id_lac_and_ci(); test_gsm0808_enc_dec_cell_id_global(); - test_gsm0808_sc_cfg_from_gsm48_mr_cfg(); - printf("Done\n"); return EXIT_SUCCESS; } diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index dc1debac..6cd7982b 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -74,229 +74,4 @@ test_gsm0808_enc_dec_cell_id_lai_and_lac: encoded: 05 06 04 21 63 54 23 42 (rc = test_gsm0808_enc_dec_cell_id_ci: encoded: 05 03 02 04 23 (rc = 5) test_gsm0808_enc_dec_cell_id_lac_and_ci: encoded: 05 05 01 04 23 02 35 (rc = 7) test_gsm0808_enc_dec_cell_id_global: encoded: 05 08 00 21 63 54 23 42 04 23 (rc = 10) -Testing gsm0808_sc_cfg_from_gsm48_mr_cfg(): -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 0000 = 0b0000000000000000 -Result (hr): - S15-S0 = 0000 = 0b0000000000000000 - -Input: - m4_75= 1 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 5703 = 0b0101011100000011 -Result (hr): - S15-S0 = 0703 = 0b0000011100000011 - -Input: - m4_75= 0 smod= 0 - m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 0000 = 0b0000000000000000 -Result (hr): - S15-S0 = 0000 = 0b0000000000000000 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 1 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 5706 = 0b0101011100000110 -Result (hr): - S15-S0 = 0706 = 0b0000011100000110 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 1 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 1608 = 0b0001011000001000 -Result (hr): - S15-S0 = 0608 = 0b0000011000001000 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 1 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 0412 = 0b0000010000010010 -Result (hr): - S15-S0 = 0412 = 0b0000010000010010 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 1 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 4020 = 0b0100000000100000 -Result (hr): - S15-S0 = 0020 = 0b0000000000100000 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 1 - m12_2= 0 -Result (fr): - S15-S0 = 1040 = 0b0001000001000000 -Result (hr): - S15-S0 = 0000 = 0b0000000000000000 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 1 -Result (fr): - S15-S0 = 4082 = 0b0100000010000010 -Result (hr): - S15-S0 = 0002 = 0b0000000000000010 - -Input: - m4_75= 1 smod= 0 - m5_15= 1 spare= 0 - m5_90= 1 icmi= 0 - m6_70= 1 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 570f = 0b0101011100001111 -Result (hr): - S15-S0 = 070f = 0b0000011100001111 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 1 ver= 0 - m7_95= 1 - m10_2= 1 - m12_2= 1 -Result (fr): - S15-S0 = 54f2 = 0b0101010011110010 -Result (hr): - S15-S0 = 0432 = 0b0000010000110010 - -Input: - m4_75= 0 smod= 0 - m5_15= 0 spare= 0 - m5_90= 1 icmi= 0 - m6_70= 1 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 0 - m10_2= 1 - m12_2= 1 -Result (fr): - S15-S0 = 57ce = 0b0101011111001110 -Result (hr): - S15-S0 = 070e = 0b0000011100001110 - -Input: - m4_75= 1 smod= 0 - m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 1 ver= 0 - m7_95= 1 - m10_2= 0 - m12_2= 0 -Result (fr): - S15-S0 = 5733 = 0b0101011100110011 -Result (hr): - S15-S0 = 0733 = 0b0000011100110011 - -Input: - m4_75= 0 smod= 0 - m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 - m6_70= 1 nscb= 0 - m7_40= 0 ver= 0 - m7_95= 1 - m10_2= 0 - m12_2= 1 -Result (fr): - S15-S0 = 56aa = 0b0101011010101010 -Result (hr): - S15-S0 = 062a = 0b0000011000101010 - -Input: - m4_75= 1 smod= 0 - m5_15= 0 spare= 0 - m5_90= 1 icmi= 0 - m6_70= 0 nscb= 0 - m7_40= 1 ver= 0 - m7_95= 0 - m10_2= 1 - m12_2= 0 -Result (fr): - S15-S0 = 5757 = 0b0101011101010111 -Result (hr): - S15-S0 = 0717 = 0b0000011100010111 - -Input: - m4_75= 1 smod= 0 - m5_15= 1 spare= 0 - m5_90= 1 icmi= 0 - m6_70= 1 nscb= 0 - m7_40= 1 ver= 0 - m7_95= 1 - m10_2= 1 - m12_2= 1 -Result (fr): - S15-S0 = 57ff = 0b0101011111111111 -Result (hr): - S15-S0 = 073f = 0b0000011100111111 - Done |