diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-19 21:10:38 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-30 21:24:10 +0100 |
commit | 34bd8bdf30769b5aab50b87045ff2b621429c7be (patch) | |
tree | 2f3fcf6daeacb0666a09bacff10cb30275f31720 /tests/alloc | |
parent | 9f0c1d216a0596f733c55d787ef0eb0693362d49 (diff) |
bts/tbf: Move the lists into the BTS and do the look-up from the BTS
The list belongs to the BTS. This makes cleaning this up more easy
and establishes a hierachy of resources that start from the BTS. The
debug_diagram code is now broken.
Diffstat (limited to 'tests/alloc')
-rw-r--r-- | tests/alloc/AllocTest.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 2117b11a..281ac652 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -20,6 +20,7 @@ #include "gprs_rlcmac.h" #include "gprs_debug.h" #include "tbf.h" +#include "bts.h" #include <string.h> #include <stdio.h> @@ -39,15 +40,16 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count) { int tfi; uint8_t used_trx; - struct gprs_rlcmac_bts bts; + BTS the_bts; + struct gprs_rlcmac_bts *bts; struct gprs_rlcmac_tbf *tbfs[33] = { 0, }; printf("Testing alloc_a direction(%d)\n", dir); - memset(&bts, 0, sizeof(bts)); - bts.alloc_algorithm = alloc_algorithm_a; + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_a; - struct gprs_rlcmac_trx *trx = &bts.trx[0]; + struct gprs_rlcmac_trx *trx = &bts->trx[0]; trx->pdch[2].enable(); trx->pdch[3].enable(); @@ -60,13 +62,13 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count) for (int i = 0; i < count; ++i) { struct gprs_rlcmac_tbf *tbf; - tfi = tfi_find_free(&bts, dir, &used_trx, 0); + tfi = tfi_find_free(bts, dir, &used_trx, 0); OSMO_ASSERT(tfi >= 0); - tbfs[i] = tbf_alloc(&bts, NULL, dir, tfi, used_trx, 0, 0); + tbfs[i] = tbf_alloc(bts, NULL, dir, tfi, used_trx, 0, 0); } /* Now check that there are still some TFIs */ - tfi = tfi_find_free(&bts, dir, &used_trx, 0); + tfi = tfi_find_free(bts, dir, &used_trx, 0); switch (dir) { case GPRS_RLCMAC_UL_TBF: OSMO_ASSERT(tfi >= 0); @@ -75,16 +77,16 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count) OSMO_ASSERT(tfi < 0); break; } - OSMO_ASSERT(!tbf_alloc(&bts, NULL, dir, tfi, used_trx, 0, 0)); + OSMO_ASSERT(!tbf_alloc(bts, NULL, dir, tfi, used_trx, 0, 0)); for (int i = 0; i < ARRAY_SIZE(tbfs); ++i) if (tbfs[i]) tbf_free(tbfs[i]); - tfi = tfi_find_free(&bts, dir, &used_trx, 0); + tfi = tfi_find_free(bts, dir, &used_trx, 0); OSMO_ASSERT(tfi >= 0); - tbfs[tfi] = tbf_alloc(&bts, NULL, dir, tfi, used_trx, 0, 0); + tbfs[tfi] = tbf_alloc(bts, NULL, dir, tfi, used_trx, 0, 0); OSMO_ASSERT(tbfs[tfi]); tbf_free(tbfs[tfi]); } |