aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-09-28 18:54:32 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-11-30 12:20:36 +0100
commit76d767cbe84fbfecfd3003af622f949f04aadbe4 (patch)
tree99c55c940359acca5722406eb2fb9631f8fb3b7b
parent953c78987a2dc99d4afcd3752507fcedabc9830f (diff)
edge: Support EGPRS in packet uplink assignment message
Currently the Encoding::write_packet_uplink_assignment method only supports the GPRS variant of the message. This commit adds the missing EGPRS variant to the encoder. Sponsored-by: On-Waves ehf
-rw-r--r--src/encoding.cpp48
-rw-r--r--src/encoding.h2
-rw-r--r--src/tbf.cpp2
3 files changed, 39 insertions, 13 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index e0b545c..7f4bf79 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -167,7 +167,7 @@ void Encoding::write_packet_uplink_assignment(
bitvec * dest, uint8_t old_tfi,
uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli,
struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t alpha,
- uint8_t gamma, int8_t ta_idx)
+ uint8_t gamma, int8_t ta_idx, int8_t use_egprs)
{
// TODO We should use our implementation of encode RLC/MAC Control messages.
unsigned wp = 0;
@@ -191,16 +191,42 @@ void Encoding::write_packet_uplink_assignment(
bitvec_write_field(dest, wp,old_tfi,5); // TFI
}
- bitvec_write_field(dest, wp,0x0,1); // Message escape
- bitvec_write_field(dest, wp,tbf->current_cs()-1, 2); // CHANNEL_CODING_COMMAND
- bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING
- bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on
- bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE
- if (ta_idx < 0) {
- bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off
- } else {
- bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on
- bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX
+ if (!use_egprs) {
+ bitvec_write_field(dest, wp,0x0,1); // Message escape
+ bitvec_write_field(dest, wp,tbf->current_cs()-1, 2); // CHANNEL_CODING_COMMAND
+ bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING
+ bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on
+ bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE
+ if (ta_idx < 0) {
+ bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off
+ } else {
+ bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on
+ bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX
+ }
+
+ } else { /* EPGRS */
+ bitvec_write_field(dest, wp,0x1,1); // Message escape
+ bitvec_write_field(dest, wp,0x0,2); // EGPRS message contents
+ bitvec_write_field(dest, wp,0x0,1); // No CONTENTION_RESOLUTION_TLLI
+ bitvec_write_field(dest, wp,0x0,1); // No COMPACT reduced MA
+ bitvec_write_field(dest, wp,tbf->current_cs()-1, 4); // EGPRS Modulation and Coding IE
+ bitvec_write_field(dest, wp,0x0,1); // No RESEGMENT
+ bitvec_write_field(dest, wp,0x0,5); // EGPRS Window Size = 64
+ bitvec_write_field(dest, wp,0x0,1); // No Access Technologies Request
+ bitvec_write_field(dest, wp,0x0,1); // No ARAC RETRANSMISSION REQUEST
+ bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING
+ bitvec_write_field(dest, wp,0x0,1); // No BEP_PERIOD2
+
+ bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on
+ bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE
+ if (ta_idx < 0) {
+ bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off
+ } else {
+ bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on
+ bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX
+ }
+
+ bitvec_write_field(dest, wp,0x0,1); // No Packet Extended Timing Advance
}
#if 1
diff --git a/src/encoding.h b/src/encoding.h
index 0004c42..ac66838 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -48,7 +48,7 @@ public:
bitvec * dest, uint8_t old_tfi,
uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli,
struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t alpha,
- uint8_t gamma, int8_t ta_idx);
+ uint8_t gamma, int8_t ta_idx, int8_t use_egprs);
static void write_packet_downlink_assignment(RlcMacDownlink_t * block, uint8_t old_tfi,
uint8_t old_downlink, struct gprs_rlcmac_tbf *tbf, uint8_t poll,
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 6c1320f..0eb9983 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -923,7 +923,7 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn)
Encoding::write_packet_uplink_assignment(bts_data(), ass_vec, m_tfi,
(direction == GPRS_RLCMAC_DL_TBF), tlli(),
is_tlli_valid(), new_tbf, 1, bts_data()->alpha,
- bts_data()->gamma, -1);
+ bts_data()->gamma, -1, 0);
bitvec_pack(ass_vec, msgb_put(msg, 23));
RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Uplink Assignment +++++++++++++++++++++++++\n");