summaryrefslogtreecommitdiff
path: root/cesar/bsu/test/utest
diff options
context:
space:
mode:
authorlaranjeiro2010-05-17 09:38:42 +0000
committerlaranjeiro2010-05-17 09:38:42 +0000
commit124c58f4dd32f5185fe165a16dfd1969da894e06 (patch)
tree5cae35cc69abaae585a52039749cd90c0aad2f6f /cesar/bsu/test/utest
parent8c7a01c0052495f7887c36f862f7ae834aaafe49 (diff)
cesar/bsu: changed callback to send beacon to CP
bsu_beacon_params_t is now bsu_params_t which contains: * direction, TO PLC or FROM PLC. * frequency error as a 32bits with fixed point (30 bits after the dot). * tick offset corresponding to the offset of the NTB clock with the phy_date clock. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7035 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/test/utest')
-rw-r--r--cesar/bsu/test/utest/src/bsut.c2
-rw-r--r--cesar/bsu/test/utest/src/interface.c24
-rw-r--r--cesar/bsu/test/utest/src/tests.c7
-rw-r--r--cesar/bsu/test/utest/tests.h2
4 files changed, 25 insertions, 10 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index 12a0498da5..139e2a7acf 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -274,7 +274,6 @@ test_case_bsu_timer_event (test_t test)
bsu_timer_event_process (t.bsu);
test_fail_unless (t.ul.beacon != INVALID_PTR);
test_fail_unless (t.ul.pparams != INVALID_PTR);
- test_fail_unless (t.ul.bparams != INVALID_PTR);
/* Release the reference handled by the CP. */
blk_release_desc ((blk_t*) t.ul.beacon);
mfs = mac_store_mfs_get (t.mac_store, true, true, false,
@@ -291,7 +290,6 @@ test_case_bsu_timer_event (test_t test)
bsu_timer_event_process (t.bsu);
test_fail_unless (t.ul.beacon != INVALID_PTR);
test_fail_unless (t.ul.pparams != INVALID_PTR);
- test_fail_unless (t.ul.bparams != INVALID_PTR);
blk_release_desc ((blk_t*) t.ul.beacon);
for (j = 0; j < cmp_avln.bs.schedules.ps.nb; j++)
{
diff --git a/cesar/bsu/test/utest/src/interface.c b/cesar/bsu/test/utest/src/interface.c
index 5c1d95264a..bdd78da771 100644
--- a/cesar/bsu/test/utest/src/interface.c
+++ b/cesar/bsu/test/utest/src/interface.c
@@ -12,10 +12,12 @@
*/
#include "common/std.h"
#include "lib/test.h"
+#include "lib/fixed.h"
#include "bsu/test/utest/tests.h"
#include "bsu/beacon/beacon.h"
#include <string.h>
#include "bsu/inc/interface.h"
+#include "bsu/inc/context.h"
void
test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
@@ -27,7 +29,6 @@ test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
bsu_test_t test;
pb_beacon_t *beacon;
bsu_beacon_t bsu_beacon;
- bsu_beacon_params_t bsu_params;
pbproc_tx_beacon_params_t params;
bsu_test_init (&test);
bsu_test_create_beacon (&test, &bsu_beacon);
@@ -38,7 +39,7 @@ test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
{
dbg_fatal_try_begin
{
- bsu_beacon_send (test.bsu, type, beacon, &bsu_params, &params);
+ bsu_beacon_send (test.bsu, type, beacon, &params);
test_fail_unless (0);
}
dbg_fatal_try_catch (const char *fatal_message)
@@ -51,7 +52,9 @@ test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
}
else
{
- bsu_beacon_send (test.bsu, type, beacon, &bsu_params, &params);
+ test.bsu->avlns[0].sync.ntb_offset_tck = 0x3;
+ test.bsu->avlns[0].sync.fe = 0.34;
+ bsu_beacon_send (test.bsu, type, beacon, &params);
test_fail_unless (test.sar.beacon == beacon);
test_fail_unless (test.sar.mfs->beacon == true);
if (type == BSU_BEACON_TYPE_CENTRAL)
@@ -60,7 +63,12 @@ test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
test_fail_unless (test.sar.mfs->cap == 0x2);
test_fail_unless (test.ul.beacon == beacon);
test_fail_unless (test.ul.pparams == NULL);
- test_fail_unless (test.ul.bparams == &bsu_params);
+ test_fail_unless (test.ul.bparams.direction
+ == BSU_BEACON_DIRECTION_TO_PLC);
+ test_fail_unless (test.ul.bparams.frequency_error
+ == FIXED(test.bsu->avlns[0].sync.fe, 30));
+ test_fail_unless (test.ul.bparams.tick_offset
+ == test.bsu->avlns[0].sync.ntb_offset_tck);
/* Free the beacon. */
blk_release_desc ((blk_t*) beacon);
/* Remove the MFS from the store. */
@@ -86,6 +94,8 @@ test_case_bsu_interface_rx (test_t t)
memset (&rx_params, 0, sizeof (pbproc_rx_beacon_params_t));
bsu_test_init (&test);
bsu_test_create_beacon (&test, &bbeacon);
+ test.bsu->avlns[0].sync.ntb_offset_tck = 0x3;
+ test.bsu->avlns[0].sync.fe = 0.34;
beacon = bsu_beacon_write (&bbeacon,
BSU_BEACON_TYPE_CENTRAL,
&test.mac_config,
@@ -94,6 +104,12 @@ test_case_bsu_interface_rx (test_t t)
bsu_beacon_recv (test.bsu, beacon, &rx_params);
test_fail_unless (test.ul.beacon == beacon);
test_fail_unless (test.ul.pparams == &rx_params);
+ test_fail_unless (test.ul.bparams.direction
+ == BSU_BEACON_DIRECTION_FROM_PLC);
+ test_fail_unless (test.ul.bparams.frequency_error
+ == FIXED(test.bsu->avlns[0].sync.fe, 30));
+ test_fail_unless (test.ul.bparams.tick_offset
+ == test.bsu->avlns[0].sync.ntb_offset_tck);
bsu_test_uninit (&test);
blk_release_desc ((blk_t*) beacon);
}
diff --git a/cesar/bsu/test/utest/src/tests.c b/cesar/bsu/test/utest/src/tests.c
index 3c35be491e..1fd72598ad 100644
--- a/cesar/bsu/test/utest/src/tests.c
+++ b/cesar/bsu/test/utest/src/tests.c
@@ -21,13 +21,15 @@
static void
bsu_test_upper_layer_beacon_received (void *ctx, pb_beacon_t *beacon,
pbproc_rx_beacon_params_t *params,
- bsu_beacon_params_t *bparams)
+ bsu_params_t bparams)
{
bsu_test_t *test = (bsu_test_t*) ctx;
dbg_assert (ctx);
test->ul.beacon = beacon;
test->ul.pparams = params;
- test->ul.bparams = bparams;
+ test->ul.bparams.direction = bparams.direction;
+ test->ul.bparams.frequency_error = bparams.frequency_error;
+ test->ul.bparams.tick_offset = bparams.tick_offset;
}
void
@@ -36,7 +38,6 @@ bsu_test_upper_layer_beacon_received_init (bsu_test_t *ctx)
dbg_assert (ctx);
ctx->ul.beacon = INVALID_PTR;
ctx->ul.pparams = INVALID_PTR;
- ctx->ul.bparams = INVALID_PTR;
}
void
diff --git a/cesar/bsu/test/utest/tests.h b/cesar/bsu/test/utest/tests.h
index 337d4e6bee..a649bd5a3d 100644
--- a/cesar/bsu/test/utest/tests.h
+++ b/cesar/bsu/test/utest/tests.h
@@ -55,7 +55,7 @@ struct bsu_test_ul_t
/** PHY RX params. */
pbproc_rx_beacon_params_t *pparams;
/** BSU beacon params. */
- bsu_beacon_params_t *bparams;
+ bsu_params_t bparams;
};
typedef struct bsu_test_ul_t bsu_test_ul_t;