diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-06-30 09:18:30 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-03 15:37:16 +0200 |
commit | 617c7127f434fc866ca370e8812f1ad01ad90d27 (patch) | |
tree | f96ea2cf5416e1b0d97075cea94e413191d132a4 /src/tbf.cpp | |
parent | 23f93a15ca759b55b4713148f06d9a2d152278ab (diff) |
ms: Get the set of slots currently active
This commits adds methods to GprsMs and gprs_rlcmac_tbf to retrieve
the slots that are actively used.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r-- | src/tbf.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp index e83873ab..006f66e0 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -935,6 +935,42 @@ uint8_t gprs_rlcmac_tbf::tsc() const return trx->pdch[first_ts].tsc; } +uint8_t gprs_rlcmac_tbf::dl_slots() const +{ + uint8_t slots = 0; + size_t i; + + if (direction == GPRS_RLCMAC_UL_TBF) + return 0; + + for (i = 0; i < ARRAY_SIZE(pdch); i += 1) + if (pdch[i]) + slots |= 1 << i; + + return slots; +} + +uint8_t gprs_rlcmac_tbf::ul_slots() const +{ + uint8_t slots = 0; + size_t i; + + if (direction == GPRS_RLCMAC_DL_TBF) { + if (control_ts < 8) + slots |= 1 << control_ts; + if (first_common_ts < 8) + slots |= 1 << first_common_ts; + + return slots; + } + + for (i = 0; i < ARRAY_SIZE(pdch); i += 1) + if (pdch[i]) + slots |= 1 << i; + + return slots; +} + void tbf_print_vty_info(struct vty *vty, struct llist_head *ltbf) { gprs_rlcmac_tbf *tbf = llist_pods_entry(ltbf, gprs_rlcmac_tbf); |