summaryrefslogtreecommitdiff
path: root/mac/pbproc/test/maximus
diff options
context:
space:
mode:
authorschodet2007-11-26 14:13:08 +0000
committerschodet2007-11-26 14:13:08 +0000
commit0be1c9ea54ac5563dfe3f0f8fc0ecd67efeaea2f (patch)
tree711d89eb352cbf676cba4c4aed5ae7a9c9193da5 /mac/pbproc/test/maximus
parent9b3fd9443c5c7838fcb8f2cde9c51270816cef67 (diff)
* mac/pbproc:
- handle hybrid mode for RX. - added AIFS support. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1050 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/pbproc/test/maximus')
-rw-r--r--mac/pbproc/test/maximus/inc/context.h11
-rw-r--r--mac/pbproc/test/maximus/py/host_test_pbproc.py30
-rw-r--r--mac/pbproc/test/maximus/py/test_pbproc.py14
-rw-r--r--mac/pbproc/test/maximus/src/add_beacon_period.c30
-rw-r--r--mac/pbproc/test/maximus/src/test_pbproc.c3
5 files changed, 60 insertions, 28 deletions
diff --git a/mac/pbproc/test/maximus/inc/context.h b/mac/pbproc/test/maximus/inc/context.h
index fcaf19c81e..1a1fb93c6f 100644
--- a/mac/pbproc/test/maximus/inc/context.h
+++ b/mac/pbproc/test/maximus/inc/context.h
@@ -23,6 +23,9 @@
#include "inc/msg.h"
+/** Number of beacon periods to keep. */
+#define TEST_PBPROC_NB_BEACON_PERIOD 3
+
typedef void
(*test_pbproc_msg_handler_cb_t) (test_pbproc_t *ctx, test_pbproc_msg_t *msg);
@@ -40,10 +43,10 @@ struct test_pbproc_t
/** Channel Access context. */
ca_t *ca;
- /** Lastly added beacon period start date. */
- u32 last_beacon_period_start_date;
- /** Lastly added schedule index. */
- uint last_schedule_index;
+ /** Beacon periods. */
+ ca_beacon_period_t beacon_periods[TEST_PBPROC_NB_BEACON_PERIOD];
+ /** Number of beacon periods. */
+ uint beacon_periods_nb;
/** Event semaphore. */
cyg_sem_t event_sem;
diff --git a/mac/pbproc/test/maximus/py/host_test_pbproc.py b/mac/pbproc/test/maximus/py/host_test_pbproc.py
index 43dcf508d6..b50813c6b1 100644
--- a/mac/pbproc/test/maximus/py/host_test_pbproc.py
+++ b/mac/pbproc/test/maximus/py/host_test_pbproc.py
@@ -25,22 +25,38 @@ t2.set_config (tei = 2, snid = 1)
t1.add_beacon_period (start_date = 0, glid = 0xff)
t1.add_beacon_period (start_date = bp_tck, glid = 0xff)
+t1.add_beacon_period (start_date = 2 * bp_tck, glid = 0xff)
t2.add_beacon_period (start_date = 0, glid = 0xff)
t2.add_beacon_period (start_date = bp_tck, glid = 0xff)
+t2.add_beacon_period (start_date = 2 * bp_tck, glid = 0xff)
-t1.add_seg (mme = False, lid = 0, tei = 2, seg_nb = 8, gen = 0)
-t1.add_seg (mme = True, lid = 0, tei = 2, seg_nb = 8, gen = 0)
-t2.rx_seg_refill (seg_nb = 16)
+t1.add_seg (mme = False, lid = 0, tei = 2, seg_nb = 16, gen = 0)
+t1.add_seg (mme = True, lid = 0, tei = 2, seg_nb = 16, gen = 0)
+t1.add_seg (mme = False, lid = 1, tei = 2, seg_nb = 10, gen = 0)
+t2.rx_seg_refill (seg_nb = 42)
t2.activate ()
t1.activate ()
-assert (t2.get_seg (seg_nb = 16).seg_nb == 16)
-maximus.wait (- 250 + 3500 + 1280 + 1482 + 126)
+
+stop = False
+
+def get_seg_cb (r):
+ print 'get_seg'
+ assert (r.seg_nb == 42)
+ global stop
+ stop = True
+t2.get_seg_async (get_seg_cb, seg_nb = 42)
+
+bp = 0
+while not stop:
+ bp += 1
+ maximus.wait (bp_tck)
+ t1.add_beacon_period (start_date = (bp + 2) * bp_tck, glid = 0xff)
+ t2.add_beacon_period (start_date = (bp + 2) * bp_tck, glid = 0xff)
+
t1.activate (False)
t2.activate (False)
-#maximus.wait (bp_tck - 10000)
-
print 'trace sta1:'
t1.trace_dump ()
print '\ntrace sta2:'
diff --git a/mac/pbproc/test/maximus/py/test_pbproc.py b/mac/pbproc/test/maximus/py/test_pbproc.py
index 17f5500078..be17cc7d65 100644
--- a/mac/pbproc/test/maximus/py/test_pbproc.py
+++ b/mac/pbproc/test/maximus/py/test_pbproc.py
@@ -4,6 +4,8 @@ class TestPBProc:
def __init__ (self, maximus, sta):
self.maximus = maximus
self.sta = sta
+ # Temporary hack.
+ self.async_fc = []
def create_fcall (self, name, **args):
"""Create a function call with given name and parameters."""
@@ -32,6 +34,18 @@ class TestPBProc:
self.seg_nb = m.bind_param_ulong ('seg_nb')
return get_seg_rsp (m)
+ def get_seg_async (self, cb, seg_nb):
+ m = self.create_fcall ('get_seg', seg_nb = seg_nb)
+ class get_seg_rsp:
+ def __init__ (self, m):
+ self.seg_nb = m.bind_param_ulong ('seg_nb')
+ def get_seg_cb (msg):
+ cb (get_seg_rsp (msg))
+ m.set_cb (get_seg_cb)
+ m.send_async (self.sta)
+ self.async_fc.append (m)
+ self.async_fc.append (get_seg_cb)
+
def rx_seg_refill (self, **args):
self.create_fcall ('rx_seg_refill', **args).send (self.sta)
diff --git a/mac/pbproc/test/maximus/src/add_beacon_period.c b/mac/pbproc/test/maximus/src/add_beacon_period.c
index de60b0f923..331681a651 100644
--- a/mac/pbproc/test/maximus/src/add_beacon_period.c
+++ b/mac/pbproc/test/maximus/src/add_beacon_period.c
@@ -39,29 +39,29 @@ test_pbproc_add_beacon_period (test_pbproc_t *ctx, u32 start_date, uint glid)
{
dbg_assert (ctx);
/* Get and fill schedule. */
- uint schedule_index = ctx->last_schedule_index == CA_SCHEDULE_NB ? 0
- : 1 - ctx->last_schedule_index;
+ uint schedule_index = ctx->beacon_periods_nb == 0 ? 0 :
+ ((ctx->beacon_periods[ctx->beacon_periods_nb - 1].schedule_index + 1)
+ % (TEST_PBPROC_NB_BEACON_PERIOD + 1));
ca_schedule_t *sched = ca_alloc_get_schedule (ctx->ca, schedule_index);
sched->coexistence_mode = MAC_COEXISTENCE_AV_ONLY_MODE;
sched->allocations_nb = 1;
sched->allocations[0].end_offset_tck = MAC_MS_TO_TCK (1000) / 50;
sched->allocations[0].glid = glid;
- /* Make the beacon period table. */
- ca_beacon_period_t bp[2], *bpp = bp;
- if (ctx->last_schedule_index != CA_SCHEDULE_NB)
+ /* Update the beacon period table. */
+ if (ctx->beacon_periods_nb == TEST_PBPROC_NB_BEACON_PERIOD)
{
- bpp->start_date = ctx->last_beacon_period_start_date;
- bpp->schedule_index = ctx->last_schedule_index;
- bpp++;
+ uint i;
+ for (i = 0; i < TEST_PBPROC_NB_BEACON_PERIOD - 1; i++)
+ ctx->beacon_periods[i] = ctx->beacon_periods[i + 1];
+ ctx->beacon_periods_nb--;
}
- bpp->start_date = start_date;
- bpp->schedule_index = schedule_index;
- bpp++;
+ ctx->beacon_periods[ctx->beacon_periods_nb].start_date = start_date;
+ ctx->beacon_periods[ctx->beacon_periods_nb].schedule_index =
+ schedule_index;
+ ctx->beacon_periods_nb++;
/* Use the new one. */
- ca_alloc_update_beacon_periods (ctx->ca, bp, bpp - bp);
- /* Save for next time. */
- ctx->last_beacon_period_start_date = start_date;
- ctx->last_schedule_index = schedule_index;
+ ca_alloc_update_beacon_periods (ctx->ca, ctx->beacon_periods,
+ ctx->beacon_periods_nb);
}
static int
diff --git a/mac/pbproc/test/maximus/src/test_pbproc.c b/mac/pbproc/test/maximus/src/test_pbproc.c
index f9eb79ac60..7f32c3aab4 100644
--- a/mac/pbproc/test/maximus/src/test_pbproc.c
+++ b/mac/pbproc/test/maximus/src/test_pbproc.c
@@ -179,8 +179,7 @@ test_pbproc_init (test_pbproc_t *ctx)
ctx->pbproc = NULL;
ctx->ca = NULL;
/* Beacon period. */
- ctx->last_beacon_period_start_date = 0;
- ctx->last_schedule_index = CA_SCHEDULE_NB;
+ ctx->beacon_periods_nb = 0;
/* Semaphore, mbox... */
cyg_semaphore_init (&ctx->event_sem, 0);
cyg_mbox_create (&ctx->mbox, &ctx->mbox_storage);