aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding_scheme.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-03-12 15:50:57 +0100
committerMax <msuraev@sysmocom.de>2019-03-27 12:32:04 +0000
commit898dddb1d122068700694b59b9261fe07fa9cdef (patch)
tree6035fb7f0eaa15f4c5dffcf51c4a4f5c9df31fc2 /src/coding_scheme.c
parent48b1e7a86f2923c9de466c4e30697b3d2b13072b (diff)
MCS: add Channel Coding Command encoder
Add function to encode MCS value as proper EDGE or GPRS Channel Coding value according to 3GPP TS 44.060 and corresponding helpers. Use it for everything except IA Rest Octet encoding which is done in a follow-up patches to make sure that we distinguish between encoding-related changes to test output and unrelated changes. Change-Id: I127fb29f5aaf77a7f6c4c565dfeb3b711af9845d
Diffstat (limited to 'src/coding_scheme.c')
-rw-r--r--src/coding_scheme.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/coding_scheme.c b/src/coding_scheme.c
index 4a5d0d4d..a4ae8827 100644
--- a/src/coding_scheme.c
+++ b/src/coding_scheme.c
@@ -64,6 +64,19 @@ bool mcs_is_edge_gmsk(enum CodingScheme cs)
return false;
}
+/* Return 3GPP TS 44.060 ยง12.10d (EDGE) or Table 11.2.28.2 (GPRS) Channel Coding Command value */
+uint8_t mcs_chan_code(enum CodingScheme cs)
+{
+ if (mcs_is_gprs(cs))
+ return cs - CS1;
+
+ if (mcs_is_edge(cs))
+ return cs - MCS1;
+
+ /* Defaults to (M)CS1 */
+ return 0;
+}
+
static struct {
struct {
uint8_t data_header_bits;