summaryrefslogtreecommitdiff
path: root/cp/beacon/test/cco/src/cco.c
diff options
context:
space:
mode:
Diffstat (limited to 'cp/beacon/test/cco/src/cco.c')
-rw-r--r--cp/beacon/test/cco/src/cco.c231
1 files changed, 0 insertions, 231 deletions
diff --git a/cp/beacon/test/cco/src/cco.c b/cp/beacon/test/cco/src/cco.c
deleted file mode 100644
index 5c7c47afa3..0000000000
--- a/cp/beacon/test/cco/src/cco.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/test/ucco/src/cco.c
- * \brief Test the schedule procedure with the leon timer.
- * \ingroup cp/beacon
- *
- */
-#include "common/std.h"
-
-#include "hal/timer/timer.h"
-
-#include "cp/station/station.h"
-#include "cp/cco/cco.h"
-#include "cp/secu/secu.h"
-#include "cp/beacon/beacons.h"
-
-#include "hal/phy/phy.h"
-
-#include "cl/cl.h"
-
-#include "mac/common/ntb.h"
-#include "mac/common/config.h"
-#include "mac/common/store.h"
-
-#include "lib/test.h"
-#include "lib/read_word.h"
-#include "lib/bitstream.h"
-
-#include <stdio.h>
-
-#include "cp/beacon/inc/beacons_ctx.h"
-
-
-cp_beacon_t *cp_beacon;
-test_t test;
-uint count_beacon;
-
-void
-cp_beacon_expired (void *user_data)
-{
-
-}
-
-void
-test_emetting_discover_beacons(void)
-{
- uint i;
- count_beacon = 0;
-
- for (i = 0; i < 10; i++)
- {
- // Create the default schedules for the CA.
- cp_beacon_cco_send_central_beacon (cp_beacon);
- }
-}
-
-int
-cyg_user_start (void)
-{
- phy_t *phy;
- ca_t *ca;
- pbproc_t *pbproc;
- mac_config_t *mac_config;
- mac_store_t *mac_store;
- hal_timer_t *timer;
- cp_sta_t *sta;
- cp_secu_t *secu;
- cp_cco_t *cco;
- cl_t *cl;
- interface_t *interface;
- hle_t *hle;
-
- test_init (test, 0, NULL);
-
- cl = blk_alloc ();
- phy = blk_alloc ();
- ca = blk_alloc ();
- mac_config = blk_alloc ();
- pbproc = blk_alloc ();
- secu = blk_alloc ();
- cco = blk_alloc ();
- hle = blk_alloc ();
-
- mac_ntb_init (phy, mac_config);
- timer = hal_timer_init (phy);
- mac_store = mac_store_init ();
-
- // Configure the STA to be CCo.
- cp_cco_set_cco_status (cco, true);
- // Add the mac_config to the sta.
- sta = cp_station_init (mac_store, cl, pbproc, mac_config);
- mac_config->sta_mac_address = 0x123456789abcull;
-
- interface = interface_init (hle , cl, (sar_t *) cl, mac_config);
-
- cp_beacon = cp_beacon_init(interface, phy, sta, secu, ca, pbproc, mac_store, cco, timer, NULL,
- cp_beacon_expired);
- cp_beacon_acl_frequency_detection (cp_beacon);
- cp_beacon_acl_frequency_detection (cp_beacon);
-
- test_emetting_discover_beacons ();
-
- cp_beacon_uninit (cp_beacon);
- hal_timer_uninit(timer);
- mac_ntb_uninit ();
- cp_station_uninit (sta);
- mac_store_uninit (mac_store);
-
- blk_release (cco);
- blk_release (secu);
- blk_release (pbproc);
- blk_release (mac_config);
- blk_release (ca);
- blk_release (phy);
- blk_release (cl);
- blk_release (hle);
-
-
- blk_print_memory ();
-
- test_case_begin (test, "Memory");
- test_begin (test, "Memory")
- {
- test_fail_if (blk_check_memory () != true, "Memory not freed");
- }
- test_end;
-
- test_result (test);
- HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
- return test_nb_failed (test) == 0 ? 0 : 1;
-}
-
-/**
- * Prepare a beacon for transmission.
- * \param ctx pbproc context
- * \param mfs corresponding special MFS
- * \param pb beacon payload
- * \param params extra parameters for beacon transmission
- *
- * There can only be one beacon prepared in advance (for a given MFS).
- *
- * This will cancel the preceding prepared beacon if it was not sent.
- *
- * PB reference is transfered to PB Processing. Extra parameters are copied.
- */
-void
-pbproc_mfs_beacon_prepare (pbproc_t *ctx, mfs_tx_t *mfs, pb_beacon_t *pb,
- const pbproc_tx_beacon_params_t *params)
-{
- cp_beacon_work_beacon_t beacon_work;
- cp_beacon_desc_t *beacon;
- bitstream_t bitstream;
- cp_bentry_sai_t sai;
-
- uint res;
-
- dbg_assert (pb);
-
- beacon = (cp_beacon_desc_t *) pb;
-
- bitstream_init (&bitstream, beacon->payload->beacon_mpdu_payload, 32,
- BITSTREAM_READ);
- bitstream_access (&bitstream, &beacon_work.nid_lsb, 22);
- bitstream_access (&bitstream, &beacon_work.hm, 2);
- bitstream_access (&bitstream, &beacon_work.stei, 8);
- bitstream_finalise (&bitstream);
-
- bitstream_init (&bitstream, beacon->payload->beacon_mpdu_payload + 4, 32,
- BITSTREAM_READ);
- bitstream_access (&bitstream, &beacon_work.bt, 3);
- beacon_work.bt = CP_BEACON_WORK_MASK_BT (beacon_work.bt);
-
- bitstream_access (&bitstream, &beacon_work.ncnr, 1);
- bitstream_access (&bitstream, &beacon_work.npsm, 1);
- bitstream_access (&bitstream, &beacon_work.num_slots, 3);
- beacon_work.num_slots =
- CP_BEACON_WORK_MASK_NUM_SLOTS(beacon_work.num_slots);
-
- bitstream_access (&bitstream, &beacon_work.slot_usage, 8);
- bitstream_access (&bitstream, &beacon_work.slot_id, 3);
- beacon_work.slot_id = CP_BEACON_WORK_MASK_SLOT_ID(beacon_work.slot_id);
-
- bitstream_access (&bitstream, &beacon_work.aclss, 3);
- beacon_work.aclss = CP_BEACON_WORK_MASK_ACLSS(beacon_work.aclss);
-
- bitstream_access (&bitstream, &beacon_work.hoip, 1);
- bitstream_access (&bitstream, &beacon_work.rtsbf, 1);
- bitstream_access (&bitstream, &beacon_work.nm, 2);
- beacon_work.nm = CP_BEACON_WORK_MASK_NM(beacon_work.nm);
-
- bitstream_access (&bitstream, &beacon_work.cco_cap, 2);
- beacon_work.cco_cap = CP_BEACON_WORK_MASK_CCO_CAP(beacon_work.cco_cap);
- bitstream_finalise (&bitstream);
-
- res = read_u32_from_word (&beacon->payload->bmis[22]);
- sai.stpf = res & true;
- res = res >> 1;
- sai.glid = res & 0x7f;
- res = res >> 7;
- sai.st = res & 0xFFF;
- res = res >> 12;
- sai.et = res & 0xFFF;
-
- test_case_begin (test, "Verify the beacon");
-
- test_begin (test, "Verifying the beacon")
- {
- test_fail_if (beacon_work.bt != CP_BEACON_CENTRAL_BEACON,
- "Wrong beacon type");
- test_fail_if (sai.stpf != true, "Wrong SAI type");
- test_fail_if (sai.glid != 0x7F, "Wrong GLID");
- test_fail_if (sai.st != 0, "Wrong start time");
- test_fail_if (sai.et != 3906, "Wrong end time");
- }
- test_end;
-
- blk_release_desc ((blk_t *) pb);
-}
-
-void
-pbproc_activate (pbproc_t *ctx, bool flag)
-{
- dbg_assert (ctx);
-}
-