diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2012-10-03 14:20:53 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2012-10-03 14:20:53 +0200 |
commit | 3b1332cdb4a2b9e61ca71386072e915e6f5d30ba (patch) | |
tree | 8185ce2fac4bad11907be3f9d57d90f471cdde56 /src/gprs_rlcmac_data.cpp | |
parent | 5f14bd941074b978ff92594544a9b62f9c366984 (diff) |
Replace switch/case construct by a structure, to define coding schemes
A new attribute at TBF instance indicates the current scheme used.
Diffstat (limited to 'src/gprs_rlcmac_data.cpp')
-rw-r--r-- | src/gprs_rlcmac_data.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp index 147054e0..2d03ac59 100644 --- a/src/gprs_rlcmac_data.cpp +++ b/src/gprs_rlcmac_data.cpp @@ -1289,23 +1289,13 @@ do_resend: /* now we still have untransmitted LLC data, so we fill mac block */ index = tbf->dir.dl.v_s & mod_sns_half; data = tbf->rlc_block[index]; - switch (bts->initial_cs) { - case 2: /* CS-2 */ - block_length = 34; - block_data = 33; - break; - case 3: /* CS-3 */ - block_length = 40; - block_data = 39; - break; - case 4: /* CS-4 */ - block_length = 54; - block_data = 53; - break; - default: /* CS-1 */ - block_length = 23; - block_data = 23; + if (tbf->cs == 0) { + tbf->cs = bts->initial_cs; + if (tbf->cs < 1 || tbf->cs > 4) + tbf->cs = 1; } + block_length = gprs_rlcmac_cs[tbf->cs].block_length; + block_data = gprs_rlcmac_cs[tbf->cs].block_data; memset(data, 0x2b, block_data); /* spare bits will be left 0 */ rh = (struct rlc_dl_header *)data; rh->pt = 0; /* Data Block */ |