This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
msuraev at sysmocom.de msuraev at sysmocom.deFrom: Max <msuraev at sysmocom.de> Move convolutional code for *CCH channels from test to public API because it's useful not only for testing. --- include/Makefile.am | 1 + include/osmocom/core/conv.h | 2 +- include/osmocom/core/conv_gen.h | 46 +++++++++++++++++++++++++++++++ src/Makefile.am | 4 +-- src/conv_xcch_gen.c | 61 +++++++++++++++++++++++++++++++++++++++++ tests/conv/conv_test.c | 31 ++------------------- 6 files changed, 114 insertions(+), 31 deletions(-) create mode 100644 include/osmocom/core/conv_gen.h create mode 100644 src/conv_xcch_gen.c diff --git a/include/Makefile.am b/include/Makefile.am index 0e5ed74..7c10a72 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -9,6 +9,7 @@ nobase_include_HEADERS = \ osmocom/core/bitvec.h \ osmocom/core/bitcomp.h \ osmocom/core/conv.h \ + osmocom/core/conv_gen.h \ osmocom/core/crc16.h \ osmocom/core/crc16gen.h \ osmocom/core/crc32gen.h \ diff --git a/include/osmocom/core/conv.h b/include/osmocom/core/conv.h index e7f6bd6..42807fa 100644 --- a/include/osmocom/core/conv.h +++ b/include/osmocom/core/conv.h @@ -139,5 +139,5 @@ int osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder, int osmo_conv_decode(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output); - +#include <osmocom/core/conv_gen.h> /*! @} */ diff --git a/include/osmocom/core/conv_gen.h b/include/osmocom/core/conv_gen.h new file mode 100644 index 0000000..e4f1b65 --- /dev/null +++ b/include/osmocom/core/conv_gen.h @@ -0,0 +1,46 @@ +/* + * conv_gen.h + * + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#pragma once + +extern const uint8_t osmo_conv_gsm0503_xcch_output[][2]; +extern const uint8_t osmo_conv_gsm0503_xcch_state[][2]; + +/*! \file conv_gen.h + * Osmocom convolutional encoder/decoder for xCCH channels, see 3GPP TS 05.03 + */ + +/*! \brief structure describing convolutional code xCCH + * + * Non-recursive code, flushed, not punctured code. + * Generator polynomials: + * G0 = 1 + D3 + D4 + * G1 = 1 + D + D3 + D4 + */ +static const struct osmo_conv_code osmo_conv_gsm0503_xcch = { + .N = 2, + .K = 5, + .len = 224, + .term = CONV_TERM_FLUSH, + .next_output = osmo_conv_gsm0503_xcch_output, + .next_state = osmo_conv_gsm0503_xcch_state, +}; diff --git a/src/Makefile.am b/src/Makefile.am index 45a77e3..2555ff8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,14 +10,14 @@ lib_LTLIBRARIES = libosmocore.la libosmocore_la_LIBADD = $(BACKTRACE_LIB) $(TALLOC_LIBS) libosmocore_la_SOURCES = timer.c select.c signal.c msgb.c bits.c \ bitvec.c bitcomp.c statistics.c \ - write_queue.c utils.c socket.c \ + conv_xcch_gen.c write_queue.c utils.c socket.c \ logging.c logging_syslog.c rate_ctr.c \ gsmtap_util.c crc16.c panic.c backtrace.c \ conv.c application.c rbtree.c strrb.c \ loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \ macaddr.c stat_item.c stats.c stats_statsd.c prim.c -BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c +BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c conv_xcch_gen.c if ENABLE_PLUGIN libosmocore_la_SOURCES += plugin.c diff --git a/src/conv_xcch_gen.c b/src/conv_xcch_gen.c new file mode 100644 index 0000000..b948e7b --- /dev/null +++ b/src/conv_xcch_gen.c @@ -0,0 +1,61 @@ +/* + * conv_xcch_gen.c + * + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdint.h> + +const uint8_t osmo_conv_gsm0503_xcch_output[][2] = { + { 0, 3 }, + { 3, 0 }, + { 3, 0 }, + { 0, 3 }, + { 0, 3 }, + { 3, 0 }, + { 3, 0 }, + { 0, 3 }, + { 1, 2 }, + { 2, 1 }, + { 2, 1 }, + { 1, 2 }, + { 1, 2 }, + { 2, 1 }, + { 2, 1 }, + { 1, 2 }, +}; + +const uint8_t osmo_conv_gsm0503_xcch_state[][2] = { + { 0, 8 }, + { 0, 8 }, + { 1, 9 }, + { 1, 9 }, + { 2, 10 }, + { 2, 10 }, + { 3, 11 }, + { 3, 11 }, + { 4, 12 }, + { 4, 12 }, + { 5, 13 }, + { 5, 13 }, + { 6, 14 }, + { 6, 14 }, + { 7, 15 }, + { 7, 15 }, +}; diff --git a/tests/conv/conv_test.c b/tests/conv/conv_test.c index de62f23..baebdbe 100644 --- a/tests/conv/conv_test.c +++ b/tests/conv/conv_test.c @@ -15,31 +15,6 @@ /* Test codes */ /* ------------------------------------------------------------------------ */ -/* GSM xCCH -> Non-recursive code, flushed, not punctured */ -static const uint8_t conv_gsm_xcch_next_output[][2] = { - { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, - { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, - { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, - { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, -}; - -static const uint8_t conv_gsm_xcch_next_state[][2] = { - { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, - { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, - { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, - { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, -}; - -static const struct osmo_conv_code conv_gsm_xcch = { - .N = 2, - .K = 5, - .len = 224, - .term = CONV_TERM_FLUSH, - .next_output = conv_gsm_xcch_next_output, - .next_state = conv_gsm_xcch_next_state, -}; - - /* GSM TCH/AFS 7.95 -> Recursive code, flushed, with puncturing */ static const uint8_t conv_gsm_tch_afs_7_95_next_output[][2] = { { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, @@ -227,8 +202,8 @@ static const struct osmo_conv_code conv_trunc = { .K = 5, .len = 224, .term = CONV_TERM_TRUNCATION, - .next_output = conv_gsm_xcch_next_output, - .next_state = conv_gsm_xcch_next_state, + .next_output = osmo_conv_gsm0503_xcch_output, + .next_state = osmo_conv_gsm0503_xcch_state, }; @@ -249,7 +224,7 @@ struct conv_test_vector { static const struct conv_test_vector tests[] = { { .name = "GSM xCCH (non-recursive, flushed, not punctured)", - .code = &conv_gsm_xcch, + .code = &osmo_conv_gsm0503_xcch, .in_len = 224, .out_len = 456, .has_vec = 1, -- 2.8.1