aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-13 13:09:09 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-05 18:27:10 +0100
commit70955c765cbd7d58f8e9fec134becfd53ea395e1 (patch)
tree1a0eac55436138b31a87b9299e5de104da80d138 /src
parenta88d065606a29f5cd7d140fbacb49d78428ceb98 (diff)
edge: Provide and use CS -> CPS conversion
The MS' RLC receiver needs a valid CPS field to decode the block. Add the function gprs_rlc_mcs_cps to generate the CPS value based on coding scheme, puncturing, and padding. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/rlc.cpp15
-rw-r--r--src/rlc.h1
-rw-r--r--src/tbf_dl.cpp1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 44ce817..1a8efdf 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -311,3 +311,18 @@ void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
rdbi->pi = 0;
rdbi->spb = 0;
}
+
+unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int with_padding)
+{
+ switch (GprsCodingScheme::Scheme(cs)) {
+ case GprsCodingScheme::MCS1: return 0b1011 + punct % 2;
+ case GprsCodingScheme::MCS2: return 0b1001 + punct % 2;
+ case GprsCodingScheme::MCS3: return (with_padding ? 0b0110 : 0b0011) +
+ punct % 3;
+ case GprsCodingScheme::MCS4: return 0b0000 + punct % 3;
+ /* TODO: Add missing MCS */
+ default: ;
+ }
+
+ return -1;
+}
diff --git a/src/rlc.h b/src/rlc.h
index a11b4ce..76af4e1 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -105,6 +105,7 @@ void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
GprsCodingScheme cs);
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
GprsCodingScheme cs);
+unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int with_padding);
/*
* I hold the currently transferred blocks and will provide
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 5607e9e..e742c79 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -539,6 +539,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
rlc.usf = 7; /* will be set at scheduler */
rlc.pr = 0; /* FIXME: power reduction */
rlc.tfi = m_tfi; /* TFI */
+ rlc.cps = gprs_rlc_mcs_cps(cs, 0, 0);
rlc.block_info[data_block_idx] = m_rlc.block(index)->block_info;
rdbi = &rlc.block_info[data_block_idx];