aboutsummaryrefslogtreecommitdiffstats
path: root/src/mslot_class.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-01-23 20:58:49 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-25 16:12:58 +0000
commit01bd0cc42ff067cd5eb8c6613418713cfccfd3eb (patch)
tree22057460afaa8806c671af811ed9c831687aafa5 /src/mslot_class.c
parent9f46071409d1ac17a4be5442185f88c4829c310c (diff)
Add multislot classes from latest spec
The table B.1 is copy-pasted from 3GPP TS 45.002 and reformatted via Emacs macros into C struct to avoid typos. The test output expanded accordingly. The allocation test expectations and output are adjusted accordingly. Note: classes 35-45 which need TA offset are not properly supported yet. This can be extended once we have such devices available for tests. Change-Id: I1ef2eb99c517f25e7d1e71b985a3e0eb3879eb2c Related: OS#2282
Diffstat (limited to 'src/mslot_class.c')
-rw-r--r--src/mslot_class.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/mslot_class.c b/src/mslot_class.c
index 19fea3ed..12d6d9e2 100644
--- a/src/mslot_class.c
+++ b/src/mslot_class.c
@@ -27,7 +27,7 @@
#include <errno.h>
-/* 3GPP TS 05.02 Annex B.1 */
+/* 3GPP TS 45.002 Annex B Table B.1 */
struct gprs_ms_multislot_class {
uint8_t rx, tx, sum; /* Maximum Number of Slots: RX, Tx, Sum Rx+Tx */
@@ -35,7 +35,7 @@ struct gprs_ms_multislot_class {
uint8_t type; /* Type of Mobile */
};
-static const struct gprs_ms_multislot_class gprs_ms_multislot_class[32] = {
+static const struct gprs_ms_multislot_class gprs_ms_multislot_class[] = {
/* M-S Class | Max # of slots | Min # of slots | Type */
/* | Rx Tx Sum | Tta Ttb Tra Trb | */
/* N/A */ { MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA },
@@ -68,8 +68,22 @@ static const struct gprs_ms_multislot_class gprs_ms_multislot_class[32] = {
/* 27 */ { 8, 4, MS_NA, 2, MS_B, 2, MS_C, 1 },
/* 28 */ { 8, 6, MS_NA, 2, MS_B, 2, MS_C, 1 },
/* 29 */ { 8, 8, MS_NA, 2, MS_B, 2, MS_C, 1 },
-/* N/A */ { MS_NA,MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA },
-/* N/A */ { MS_NA,MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA },
+ /* 30 */ { 5, 1, 6, 2, 1, 1, 1, 1 },
+ /* 31 */ { 5, 2, 6, 2, 1, 1, 1, 1 },
+ /* 32 */ { 5, 3, 6, 2, 1, 1, 1, 1 },
+ /* 33 */ { 5, 4, 6, 2, 1, 1, 1, 1 },
+ /* 34 */ { 5, 5, 6, 2, 1, 1, 1, 1 },
+ /* 35 */ { 5, 1, 6, 2, 1, MS_TO, 1, 1 },
+ /* 36 */ { 5, 2, 6, 2, 1, MS_TO, 1, 1 },
+ /* 37 */ { 5, 3, 6, 2, 1, MS_TO, 1, 1 },
+ /* 38 */ { 5, 4, 6, 2, 1, MS_TO, 1, 1 },
+ /* 39 */ { 5, 5, 6, 2, 1, MS_TO, 1, 1 },
+ /* 40 */ { 6, 1, 7, 1, 1, 1, MS_TO, 1 },
+ /* 41 */ { 6, 2, 7, 1, 1, 1, MS_TO, 1 },
+ /* 42 */ { 6, 3, 7, 1, 1, 1, MS_TO, 1 },
+ /* 43 */ { 6, 4, 7, 1, 1, 1, MS_TO, 1 },
+ /* 44 */ { 6, 5, 7, 1, 1, 1, MS_TO, 1 },
+ /* 45 */ { 6, 6, 7, 1, 1, 1, MS_TO, 1 },
};
static inline const struct gprs_ms_multislot_class *get_mslot_table(uint8_t ms_cl)
@@ -109,12 +123,19 @@ uint8_t mslot_class_get_tb(uint8_t ms_cl)
}
}
-uint8_t mslot_class_get_ra(uint8_t ms_cl)
+uint8_t mslot_class_get_ra(uint8_t ms_cl, uint8_t ta)
{
- return get_mslot_table(ms_cl)->ra;
+ const struct gprs_ms_multislot_class *t = get_mslot_table(ms_cl);
+
+ switch (t->ra) {
+ case MS_TO:
+ return ta + 1;
+ default:
+ return t->ra;
+ }
}
-uint8_t mslot_class_get_rb(uint8_t ms_cl)
+uint8_t mslot_class_get_rb(uint8_t ms_cl, uint8_t ta)
{
const struct gprs_ms_multislot_class *t = get_mslot_table(ms_cl);
@@ -123,6 +144,8 @@ uint8_t mslot_class_get_rb(uint8_t ms_cl)
return 0;
case MS_C:
return 1;
+ case MS_TO:
+ return ta;
default:
return t->rb;
}