aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-03 18:22:34 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-03 19:23:49 +0100
commit6c273dc8e7b020856062aa0d6d8ba5f56638d9d4 (patch)
treedb5e88dd275fe846d44a9ae2a9f30ede6c9cadbb
parent21252bd737c9a33e1fdce1da9d20474fed9bcd2a (diff)
cs: Add GprsCodingScheme::optionalPaddingBits
Return the amount of optional padding bits, which is 6*8 for MCS-3 and MCS-6 and 0 for all other coding schemes. The padding is needed the encode 68 byte data blocks (MCS-8) with these schemes. See TS 44.060, 9.3.2.1 and Annex J for details. Sponsored-by: On-Waves ehf
-rw-r--r--src/gprs_coding_scheme.cpp34
-rw-r--r--src/gprs_coding_scheme.h1
-rw-r--r--tests/edge/EdgeTest.cpp3
3 files changed, 23 insertions, 15 deletions
diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp
index 4f1db1d..8601d4f 100644
--- a/src/gprs_coding_scheme.cpp
+++ b/src/gprs_coding_scheme.cpp
@@ -28,39 +28,40 @@ static struct {
unsigned int data_header_bits;
} uplink, downlink;
unsigned int data_bytes;
+ unsigned int optional_padding_bits;
const char *name;
GprsCodingScheme::HeaderType data_hdr;
GprsCodingScheme::Family family;
} mcs_info[GprsCodingScheme::NUM_SCHEMES] = {
- {{0, 0}, {0, 0}, 0, "UNKNOWN",
+ {{0, 0}, {0, 0}, 0, 0, "UNKNOWN",
GprsCodingScheme::HEADER_INVALID, GprsCodingScheme::FAMILY_INVALID},
- {{23, 0}, {23, 0}, 20, "CS-1",
+ {{23, 0}, {23, 0}, 20, 0, "CS-1",
GprsCodingScheme::HEADER_GPRS_DATA, GprsCodingScheme::FAMILY_INVALID},
- {{33, 7}, {33, 7}, 30, "CS-2",
+ {{33, 7}, {33, 7}, 30, 0, "CS-2",
GprsCodingScheme::HEADER_GPRS_DATA, GprsCodingScheme::FAMILY_INVALID},
- {{39, 3}, {39, 3}, 36, "CS-3",
+ {{39, 3}, {39, 3}, 36, 0, "CS-3",
GprsCodingScheme::HEADER_GPRS_DATA, GprsCodingScheme::FAMILY_INVALID},
- {{53, 7}, {53, 7}, 50, "CS-4",
+ {{53, 7}, {53, 7}, 50, 0, "CS-4",
GprsCodingScheme::HEADER_GPRS_DATA, GprsCodingScheme::FAMILY_INVALID},
- {{26, 1}, {26, 1}, 22, "MCS-1",
+ {{26, 1}, {26, 1}, 22, 0, "MCS-1",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3, GprsCodingScheme::FAMILY_C},
- {{32, 1}, {32, 1}, 28, "MCS-2",
+ {{32, 1}, {32, 1}, 28, 0, "MCS-2",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3, GprsCodingScheme::FAMILY_B},
- {{41, 1}, {41, 1}, 37, "MCS-3",
+ {{41, 1}, {41, 1}, 37, 48, "MCS-3",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3, GprsCodingScheme::FAMILY_A},
- {{48, 1}, {48, 1}, 44, "MCS-4",
+ {{48, 1}, {48, 1}, 44, 0, "MCS-4",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3, GprsCodingScheme::FAMILY_C},
- {{60, 7}, {59, 6}, 56, "MCS-5",
+ {{60, 7}, {59, 6}, 56, 0, "MCS-5",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2, GprsCodingScheme::FAMILY_B},
- {{78, 7}, {77, 6}, 74, "MCS-6",
+ {{78, 7}, {77, 6}, 74, 48, "MCS-6",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2, GprsCodingScheme::FAMILY_A},
- {{118, 2}, {117, 4}, 56, "MCS-7",
+ {{118, 2}, {117, 4}, 56, 0, "MCS-7",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1, GprsCodingScheme::FAMILY_B},
- {{142, 2}, {141, 4}, 68, "MCS-8",
+ {{142, 2}, {141, 4}, 68, 0, "MCS-8",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1, GprsCodingScheme::FAMILY_A},
- {{154, 2}, {153, 4}, 74, "MCS-9",
+ {{154, 2}, {153, 4}, 74, 0, "MCS-9",
GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1, GprsCodingScheme::FAMILY_A},
};
@@ -152,6 +153,11 @@ unsigned int GprsCodingScheme::maxDataBlockBytes() const
return mcs_info[m_scheme].data_bytes;
}
+unsigned int GprsCodingScheme::optionalPaddingBits() const
+{
+ return mcs_info[m_scheme].optional_padding_bits;
+}
+
unsigned int GprsCodingScheme::numDataBlocks() const
{
return hdr_type_info[headerTypeData()].num_blocks;
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index e9a06a5..aec3762 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -94,6 +94,7 @@ public:
unsigned int numDataHeaderBitsUL() const;
unsigned int numDataHeaderBitsDL() const;
unsigned int numDataBlockHeaderBits() const;
+ unsigned int optionalPaddingBits() const;
const char *name() const;
HeaderType headerTypeData() const;
HeaderType headerTypeControl() const;
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 341567e..39875b0 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -92,7 +92,8 @@ static void check_coding_scheme(GprsCodingScheme& cs, GprsCodingScheme::Mode mod
OSMO_ASSERT(cs.isFamilyCompatible(new_cs));
OSMO_ASSERT(cs.isCompatible(new_cs));
if (need_padding) {
- OSMO_ASSERT(new_cs.maxDataBlockBytes() > cs.maxDataBlockBytes());
+ OSMO_ASSERT(new_cs.maxDataBlockBytes() ==
+ new_cs.optionalPaddingBits()/8 + cs.maxDataBlockBytes());
} else {
OSMO_ASSERT(new_cs.maxDataBlockBytes() == cs.maxDataBlockBytes());
}