aboutsummaryrefslogtreecommitdiffstats
path: root/src/sba.cpp
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-05-16 16:10:45 +0200
committerMax <msuraev@sysmocom.de>2017-05-26 07:55:52 +0000
commit9dabfa2c2b882bf4ce72c941f021f7a439de041a (patch)
tree6f060cdd5d071f9b156b5cbaafd1e167a4b3b71f /src/sba.cpp
parent356ac618f1f4b455e411507c4be4c9909fe927bb (diff)
Cleanup FN scheduling
* replace magic number with defined constant * move copy-pasted code to inline functions * remove unused code Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331 Related: OS#1524
Diffstat (limited to 'src/sba.cpp')
-rw-r--r--src/sba.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sba.cpp b/src/sba.cpp
index 5d75b17e..56a75432 100644
--- a/src/sba.cpp
+++ b/src/sba.cpp
@@ -23,6 +23,7 @@
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <bts.h>
+#include <pcu_utils.h>
extern "C" {
#include <osmocom/core/talloc.h>
@@ -75,7 +76,7 @@ int SBAController::alloc(
return -EINVAL;
}
- fn = (pdch->last_rts_fn + AGCH_START_OFFSET) % 2715648;
+ fn = next_fn(pdch->last_rts_fn, AGCH_START_OFFSET);
sba->trx_no = trx;
sba->ts_no = ts;
@@ -110,14 +111,13 @@ gprs_rlcmac_sba *SBAController::find(const gprs_rlcmac_pdch *pdch, uint32_t fn)
uint32_t SBAController::sched(uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr)
{
- uint32_t sba_fn;
+ uint32_t sba_fn = fn + 4;
struct gprs_rlcmac_sba *sba;
/* check special TBF for events */
- sba_fn = fn + 4;
if ((block_nr % 3) == 2)
- sba_fn ++;
- sba_fn = sba_fn % 2715648;
+ sba_fn++;
+ sba_fn = sba_fn % GSM_MAX_FN;
sba = find(trx, ts, sba_fn);
if (sba)
return sba_fn;