diff mbox

[3/4] Add convolutional code generators for CS2/3

Message ID 1460384569-13790-3-git-send-email-msuraev@sysmocom.de
State Not Applicable
Headers show

Commit Message

Max April 11, 2016, 2:22 p.m. UTC
From: Max <msuraev@sysmocom.de>

---
 include/osmocom/gsm/gsm0503.h | 26 +++++++++++++++++++++
 src/gsm/Makefile.am           |  2 +-
 src/gsm/conv_csx.c            | 53 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 src/gsm/conv_csx.c
diff mbox

Patch

diff --git a/include/osmocom/gsm/gsm0503.h b/include/osmocom/gsm/gsm0503.h
index e68aa9a..3896821 100644
--- a/include/osmocom/gsm/gsm0503.h
+++ b/include/osmocom/gsm/gsm0503.h
@@ -45,3 +45,29 @@  static const struct osmo_conv_code osmo_conv_gsm0503_xcch = {
 	.next_output = osmo_conv_gsm0503_xcch_output,
 	.next_state  = osmo_conv_gsm0503_xcch_state,
 };
+
+extern const int osmo_conv_gsm0503_cs2_puncture[];
+
+/*! \brief structure describing convolutional code CS2
+ */
+static const struct osmo_conv_code osmo_conv_gsm0503_cs2 = {
+	.N = 2,
+	.K = 5,
+	.len = 290,
+	.next_output = osmo_conv_gsm0503_xcch_output,
+	.next_state  = osmo_conv_gsm0503_xcch_state,
+	.puncture = osmo_conv_gsm0503_cs2_puncture
+};
+
+extern const int osmo_conv_gsm0503_cs3_puncture[];
+
+/*! \brief structure describing convolutional code CS2
+ */
+static const struct osmo_conv_code osmo_conv_gsm0503_cs3 = {
+	.N = 2,
+	.K = 5,
+	.len = 334,
+	.next_output = osmo_conv_gsm0503_xcch_output,
+	.next_state  = osmo_conv_gsm0503_xcch_state,
+	.puncture = osmo_conv_gsm0503_cs3_puncture
+};
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 0ab2bd8..8c7f2be 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -17,7 +17,7 @@  libgsmint_la_SOURCES =  a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
 			gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \
 			gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c \
 			gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c \
-			lapd_core.c lapdm.c kasumi.c conv_xcch_gen.c \
+			lapd_core.c lapdm.c kasumi.c conv_xcch_gen.c conv_csx.c \
 			auth_core.c auth_comp128v1.c auth_comp128v23.c \
 			auth_milenage.c milenage/aes-encblock.c \
 			milenage/aes-internal.c milenage/aes-internal-enc.c \
diff --git a/src/gsm/conv_csx.c b/src/gsm/conv_csx.c
new file mode 100644
index 0000000..1f94cd4
--- /dev/null
+++ b/src/gsm/conv_csx.c
@@ -0,0 +1,53 @@ 
+/*
+ * conv_csx.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.
+ */
+
+const int osmo_conv_gsm0503_cs2_puncture[] = {
+	15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 91,
+	95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 139, 143, 147, 151, 155,
+	159, 163, 167, 171, 175, 179, 187, 191, 195, 199, 203, 207, 211, 215,
+	219, 223, 227, 235, 239, 243, 247, 251, 255, 259, 263, 267, 271, 275,
+	283, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 331, 335, 339,
+	343, 347, 351, 355, 359, 363, 367, 371, 379, 383, 387, 391, 395, 399,
+	403, 407, 411, 415, 419, 427, 431, 435, 439, 443, 447, 451, 455, 459,
+	463, 467, 475, 479, 483, 487, 491, 495, 499, 503, 507, 511, 515, 523,
+	527, 531, 535, 539, 543, 547, 551, 555, 559, 563, 571, 575, 579, 583,
+	587, -1
+};
+
+const int osmo_conv_gsm0503_cs3_puncture[] = {
+	15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45, 47, 51, 53, 57, 59, 63, 65,
+	69, 71, 75, 77, 81, 83, 87, 89, 93, 95, 99, 101, 105, 107, 111, 113,
+	117, 119, 123, 125, 129, 131, 135, 137, 141, 143, 147, 149, 153, 155,
+	159, 161, 165, 167, 171, 173, 177, 179, 183, 185, 189, 191, 195, 197,
+	201, 203, 207, 209, 213, 215, 219, 221, 225, 227, 231, 233, 237, 239,
+	243, 245, 249, 251, 255, 257, 261, 263, 267, 269, 273, 275, 279, 281,
+	285, 287, 291, 293, 297, 299, 303, 305, 309, 311, 315, 317, 321, 323,
+	327, 329, 333, 335, 339, 341, 345, 347, 351, 353, 357, 359, 363, 365,
+	369, 371, 375, 377, 381, 383, 387, 389, 393, 395, 399, 401, 405, 407,
+	411, 413, 417, 419, 423, 425, 429, 431, 435, 437, 441, 443, 447, 449,
+	453, 455, 459, 461, 465, 467, 471, 473, 477, 479, 483, 485, 489, 491,
+	495, 497, 501, 503, 507, 509, 513, 515, 519, 521, 525, 527, 531, 533,
+	537, 539, 543, 545, 549, 551, 555, 557, 561, 563, 567, 569, 573, 575,
+	579, 581, 585, 587, 591, 593, 597, 599, 603, 605, 609, 611, 615, 617,
+	621, 623, 627, 629, 633, 635, 639, 641, 645, 647, 651, 653, 657, 659,
+	663, 665, 669, 671, -1
+};