aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-11 10:56:50 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-05 13:26:33 +0100
commit22f8087b982af3e077311d5dbc4e1eebc7153ea3 (patch)
treefeb0a0b639850c62b005bbd8f8797e30f9e6cbee /src
parentfc1b3e6c9076ddc38e07715b2cc30319bac19b9c (diff)
edge: Add numDataHeaderBitsUL/DL and numDataBlockHeaderBits methods
These methods are added to GprsCodingScheme to avoid related switch statements in the RLC block encoder for EGPRS. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/gprs_coding_scheme.cpp66
-rw-r--r--src/gprs_coding_scheme.h4
2 files changed, 52 insertions, 18 deletions
diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp
index 629ba4a..aaa8b20 100644
--- a/src/gprs_coding_scheme.cpp
+++ b/src/gprs_coding_scheme.cpp
@@ -25,30 +25,45 @@ static struct {
struct {
unsigned int bytes;
unsigned int ext_bits;
+ unsigned int data_header_bits;
} uplink, downlink;
unsigned int data_bytes;
- unsigned int num_blocks;
const char *name;
GprsCodingScheme::HeaderType data_hdr;
} mcs_info[GprsCodingScheme::NUM_SCHEMES] = {
- {{0, 0}, {0, 0}, 0, 0, "UNKNOWN", GprsCodingScheme::HEADER_INVALID},
- {{23, 0}, {23, 0}, 20, 1, "CS-1", GprsCodingScheme::HEADER_GPRS_DATA},
- {{33, 7}, {33, 7}, 30, 1, "CS-2", GprsCodingScheme::HEADER_GPRS_DATA},
- {{39, 3}, {39, 3}, 36, 1, "CS-3", GprsCodingScheme::HEADER_GPRS_DATA},
- {{53, 7}, {53, 7}, 50, 1, "CS-4", GprsCodingScheme::HEADER_GPRS_DATA},
-
- {{26, 1}, {26, 1}, 22, 1, "MCS-1", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
- {{32, 1}, {32, 1}, 28, 1, "MCS-2", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
- {{41, 1}, {41, 1}, 37, 1, "MCS-3", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
- {{48, 1}, {48, 1}, 44, 1, "MCS-4", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
-
- {{60, 7}, {59, 6}, 56, 1, "MCS-5", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
- {{78, 7}, {77, 6}, 74, 1, "MCS-6", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
- {{118, 2}, {117, 4}, 56, 2, "MCS-7", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
- {{142, 2}, {141, 4}, 68, 2, "MCS-8", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
- {{154, 2}, {153, 4}, 74, 2, "MCS-9", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
+ {{0, 0}, {0, 0}, 0, "UNKNOWN", GprsCodingScheme::HEADER_INVALID},
+ {{23, 0}, {23, 0}, 20, "CS-1", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{33, 7}, {33, 7}, 30, "CS-2", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{39, 3}, {39, 3}, 36, "CS-3", GprsCodingScheme::HEADER_GPRS_DATA},
+ {{53, 7}, {53, 7}, 50, "CS-4", GprsCodingScheme::HEADER_GPRS_DATA},
+
+ {{26, 1}, {26, 1}, 22, "MCS-1", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{32, 1}, {32, 1}, 28, "MCS-2", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{41, 1}, {41, 1}, 37, "MCS-3", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+ {{48, 1}, {48, 1}, 44, "MCS-4", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3},
+
+ {{60, 7}, {59, 6}, 56, "MCS-5", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
+ {{78, 7}, {77, 6}, 74, "MCS-6", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2},
+ {{118, 2}, {117, 4}, 56, "MCS-7", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
+ {{142, 2}, {141, 4}, 68, "MCS-8", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
+ {{154, 2}, {153, 4}, 74, "MCS-9", GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1},
};
+static struct {
+ struct {
+ int data_header_bits;
+ } uplink, downlink;
+ unsigned int data_block_header_bits;
+ unsigned int num_blocks;
+ const char *name;
+} hdr_type_info[GprsCodingScheme::NUM_HEADER_TYPES] = {
+ {{0}, {0}, 0, 0, "INVALID"},
+ {{1*8 + 0}, {1*8 + 0}, 0, 0, "CONTROL"},
+ {{3*8 + 0}, {3*8 + 0}, 0, 1, "GPRS_DATA"},
+ {{5*8 + 6}, {5*8 + 0}, 2, 2, "EGPRS_DATA_TYPE1"},
+ {{4*8 + 5}, {3*8 + 4}, 2, 1, "EGPRS_DATA_TYPE2"},
+ {{3*8 + 7}, {3*8 + 7}, 2, 1, "EGPRS_DATA_TYPE3"},
+};
GprsCodingScheme GprsCodingScheme::getBySizeUL(unsigned size)
{
@@ -124,7 +139,22 @@ unsigned int GprsCodingScheme::maxDataBlockBytes() const
unsigned int GprsCodingScheme::numDataBlocks() const
{
- return mcs_info[m_scheme].num_blocks;
+ return hdr_type_info[headerTypeData()].num_blocks;
+}
+
+unsigned int GprsCodingScheme::numDataHeaderBitsUL() const
+{
+ return hdr_type_info[headerTypeData()].uplink.data_header_bits;
+}
+
+unsigned int GprsCodingScheme::numDataHeaderBitsDL() const
+{
+ return hdr_type_info[headerTypeData()].downlink.data_header_bits;
+}
+
+unsigned int GprsCodingScheme::numDataBlockHeaderBits() const
+{
+ return hdr_type_info[headerTypeData()].data_block_header_bits;
}
const char *GprsCodingScheme::name() const
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index 854deb6..348aefb 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -47,6 +47,7 @@ public:
HEADER_EGPRS_DATA_TYPE_1,
HEADER_EGPRS_DATA_TYPE_2,
HEADER_EGPRS_DATA_TYPE_3,
+ NUM_HEADER_TYPES
};
GprsCodingScheme(Scheme s = UNKNOWN);
@@ -80,6 +81,9 @@ public:
unsigned int spareBitsDL() const;
unsigned int maxDataBlockBytes() const;
unsigned int numDataBlocks() const;
+ unsigned int numDataHeaderBitsUL() const;
+ unsigned int numDataHeaderBitsDL() const;
+ unsigned int numDataBlockHeaderBits() const;
const char *name() const;
HeaderType headerTypeData() const;
HeaderType headerTypeControl() const;