A function is_single_block is added to get request type of RACH.
GPRS 11 bit RACH is handled.
---
src/bts.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++----------
src/bts.h | 2 ++
2 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/src/bts.cpp b/src/bts.cpp
index 62b00c4..2166132 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -473,18 +473,11 @@ int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t
is_11bit,
uint16_t ta;
rach_frame();
-
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF on RACH, so we provide "
"one:\n");
- if ((ra & 0xf8) == 0x70) {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block "
- "allocation\n");
- sb = 1;
- } else if (m_bts.force_two_phase) {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single phase access, "
- "but we force two phase access\n");
- sb = 1;
- }
+
+ sb = is_single_block(ra, burst, is_11bit);
+
if (qta < 0)
qta = 0;
if (qta > 252)
@@ -556,6 +549,49 @@ int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t
is_11bit,
return 0;
}
+uint8_t BTS::is_single_block(uint16_t ra, enum ph_burst_type burst,
+ uint8_t is_11bit)
+{
+ uint8_t sb = 0;
+
+ if ((is_11bit == 0) && (burst == GSM_L1_BURST_TYPE_ACCESS_0)) {
+ if ((ra & 0xf8) == 0x70) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block "
+ "allocation\n");
+ sb = 1;
+ } else if (m_bts.force_two_phase) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single phase "
+ "access, but we force two phase access\n");
+ sb = 1;
+ }
+ } else if ((is_11bit == 1) && (burst == GSM_L1_BURST_TYPE_ACCESS_0)) {
+ if ((ra & 0x7e0) == 0x0600) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "GPRS 11 bit RACH received. "
+ "MS requests single block allocation\n");
+ sb = 1;
+ } else if (m_bts.force_two_phase) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "GPRS 11 bit RACH received."
+ "MS requests single phase access but we force "
+ "two phase access\n");
+ sb = 1;
+ }
+ } else if ((is_11bit == 1) && ((burst == GSM_L1_BURST_TYPE_ACCESS_1) ||
+ (burst == GSM_L1_BURST_TYPE_ACCESS_2))) {
+ if ((ra & 0x7e0) == 0x0600) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH received. "
+ "MS requests single block allocation\n");
+ sb = 1;
+ } else if (m_bts.force_two_phase) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH received. "
+ "MS requests single phase access but we force "
+ "two phase access\n");
+ sb = 1;
+ }
+ }
+
+ return sb;
+}
+
/* depending on the current TBF, we assign on PACCH or AGCH */
void BTS::trigger_dl_ass(
struct gprs_rlcmac_dl_tbf *dl_tbf,
diff --git a/src/bts.h b/src/bts.h
index f0fe970..1c5b749 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -276,6 +276,8 @@ public:
int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx);
int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn);
+ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst,
+ uint8_t is_11bit);
int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit,
enum ph_burst_type burst);
--
2.5.0