aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2020-02-28 14:23:55 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2020-03-09 13:40:27 +0100
commit1c46d19e4316ffd898d505559b2af90e6b930e27 (patch)
tree492d7ec2d3ee3c53b0d110c78e149d0a869e58e6
parentd8c74b81f9a1fa8a89d2e7b1a3e5cd31a9090ca3 (diff)
parity: add amr crc14 definition
AMR not only specifies a 6 bit CRC for regular voice information. It also specifies a 14 bit CRC to protect the comfort noise updates contained in the SID_UPDATE frames. Change-Id: I5cfd8ca806aba8d42cb9787f69605cea7de6e900 Related: OS#2978
-rw-r--r--include/osmocom/coding/gsm0503_parity.h1
-rw-r--r--src/coding/gsm0503_parity.c11
-rw-r--r--src/coding/libosmocoding.map1
3 files changed, 13 insertions, 0 deletions
diff --git a/include/osmocom/coding/gsm0503_parity.h b/include/osmocom/coding/gsm0503_parity.h
index 28a54443..c35477f3 100644
--- a/include/osmocom/coding/gsm0503_parity.h
+++ b/include/osmocom/coding/gsm0503_parity.h
@@ -19,5 +19,6 @@ const struct osmo_crc16gen_code gsm0503_sch_crc10;
const struct osmo_crc8gen_code gsm0503_tch_fr_crc3;
const struct osmo_crc8gen_code gsm0503_tch_efr_crc8;
const struct osmo_crc8gen_code gsm0503_amr_crc6;
+const struct osmo_crc16gen_code gsm0503_amr_crc14;
/*! @} */
diff --git a/src/coding/gsm0503_parity.c b/src/coding/gsm0503_parity.c
index 874114ff..a8daacc7 100644
--- a/src/coding/gsm0503_parity.c
+++ b/src/coding/gsm0503_parity.c
@@ -134,4 +134,15 @@ const struct osmo_crc8gen_code gsm0503_amr_crc6 = {
.remainder = 0x3f,
};
+/*! GSM AMR parity (SID_UPDATE)
+ *
+ * g(x) = x^14 + x^13 + x^5 + x^3 + x^2 + 1
+ */
+const struct osmo_crc16gen_code gsm0503_amr_crc14 = {
+ .bits = 14,
+ .poly = 0x202d,
+ .init = 0x0000,
+ .remainder = 0x3fff,
+};
+
/*! @} */
diff --git a/src/coding/libosmocoding.map b/src/coding/libosmocoding.map
index 87b38864..7f88111f 100644
--- a/src/coding/libosmocoding.map
+++ b/src/coding/libosmocoding.map
@@ -56,6 +56,7 @@ gsm0503_sch_crc10;
gsm0503_tch_fr_crc3;
gsm0503_tch_efr_crc8;
gsm0503_amr_crc6;
+gsm0503_amr_crc14;
gsm0503_xcch_burst_unmap;
gsm0503_xcch_burst_map;