aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-14 10:21:26 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-15 15:19:43 +0100
commit6c3dc61db58bf469c504ffbfcbe061de2f18ceac (patch)
tree10cc7351fc6b1e9fefb50087693999093ee77160
parent3b802e3c4ab59e6714d42298ca7b0b793e063f21 (diff)
edge: Add header type property to GprsCodingScheme
The header type depends on the coding scheme, for GPRS there is a single data header type per direction, for EGPRS there are 3 per direction. In addition, control block header types are used with CS-1 only, so there is one of the per direction altogether for GRPS and EGPRS. This commit adds the header type enum and two methods headerTypeData and headerTypeControl. Sponsored-by: On-Waves ehf
-rw-r--r--src/gprs_coding_scheme.cpp38
-rw-r--r--src/gprs_coding_scheme.h16
-rw-r--r--tests/edge/EdgeTest.cpp6
3 files changed, 44 insertions, 16 deletions
diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp
index 3488b32..9fff2c9 100644
--- a/src/gprs_coding_scheme.cpp
+++ b/src/gprs_coding_scheme.cpp
@@ -27,23 +27,24 @@ static struct {
unsigned ext_bits;
} uplink, downlink;
const char *name;
+ GprsCodingScheme::HeaderType data_hdr;
} mcs_info[GprsCodingScheme::NUM_SCHEMES] = {
- {{0, 0}, {0, 0}, "UNKNOWN"},
- {{23, 0}, {23, 0}, "CS-1"},
- {{33, 7}, {33, 7}, "CS-2"},
- {{39, 3}, {39, 3}, "CS-3"},
- {{53, 7}, {53, 7}, "CS-4"},
-
- {{26, 1}, {26, 1}, "MCS-1"},
- {{32, 1}, {32, 1}, "MCS-2"},
- {{41, 1}, {41, 1}, "MCS-3"},
- {{48, 1}, {48, 1}, "MCS-4"},
-
- {{60, 7}, {59, 6}, "MCS-5"},
- {{78, 7}, {77, 6}, "MCS-6"},
- {{118, 2}, {117, 4}, "MCS-7"},
- {{142, 2}, {141, 4}, "MCS-8"},
- {{154, 2}, {153, 4}, "MCS-9"},
+ {{0, 0}, {0, 0}, "UNKNOWN", GprsCodingScheme::HEADER_INVALID},
+ {{23, 0}, {23, 0}, "CS-1", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{33, 7}, {33, 7}, "CS-2", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{39, 3}, {39, 3}, "CS-3", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{53, 7}, {53, 7}, "CS-4", GprsCodingScheme::HEADER_GPRS_DATA},
+
+ {{26, 1}, {26, 1}, "MCS-1", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{32, 1}, {32, 1}, "MCS-2", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{41, 1}, {41, 1}, "MCS-3", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{48, 1}, {48, 1}, "MCS-4", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+
+ {{60, 7}, {59, 6}, "MCS-5", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
+ {{78, 7}, {77, 6}, "MCS-6", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
+ {{118, 2}, {117, 4}, "MCS-7", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
+ {{142, 2}, {141, 4}, "MCS-8", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
+ {{154, 2}, {153, 4}, "MCS-9", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
};
@@ -102,3 +103,8 @@ const char *GprsCodingScheme::name() const
{
return mcs_info[m_scheme].name;
}
+
+GprsCodingScheme::HeaderType GprsCodingScheme::headerTypeData() const
+{
+ return mcs_info[m_scheme].data_hdr;
+}
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index 71b64cf..7ba24de 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -40,6 +40,15 @@ public:
EGPRS,
};
+ enum HeaderType {
+ HEADER_INVALID,
+ HEADER_GPRS_CONTROL,
+ HEADER_GPRS_DATA,
+ HEADER_EGPRS_DATA_TYPE_1,
+ HEADER_EGPRS_DATA_TYPE_2,
+ HEADER_EGPRS_DATA_TYPE_3,
+ };
+
GprsCodingScheme(Scheme s = UNKNOWN);
operator bool() const {return m_scheme != UNKNOWN;}
@@ -62,6 +71,8 @@ public:
unsigned int spareBitsUL() const;
unsigned int spareBitsDL() const;
const char *name() const;
+ HeaderType headerTypeData() const;
+ HeaderType headerTypeControl() const;
static GprsCodingScheme getBySizeUL(unsigned size);
@@ -108,6 +119,11 @@ inline void GprsCodingScheme::dec(Mode mode)
m_scheme = new_cs;
}
+inline GprsCodingScheme::HeaderType GprsCodingScheme::headerTypeControl() const
+{
+ return HEADER_GPRS_CONTROL;
+}
+
inline GprsCodingScheme::GprsCodingScheme(Scheme s)
: m_scheme(s)
{
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index ae29221..5d4fdf7 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -129,6 +129,12 @@ static void test_coding_scheme()
last_size_UL = current_cs.maxBytesUL();
last_size_DL = current_cs.maxBytesDL();
+ /* Check header types */
+ OSMO_ASSERT(current_cs.headerTypeData() ==
+ GprsCodingScheme::HEADER_GPRS_DATA);
+ OSMO_ASSERT(current_cs.headerTypeControl() ==
+ GprsCodingScheme::HEADER_GPRS_CONTROL);
+
check_coding_scheme(current_cs, GprsCodingScheme::GPRS);
}
OSMO_ASSERT(i == 4);