summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/cp/beacon/Module2
-rw-r--r--cesar/cp/beacon/inc/beacon.h15
-rw-r--r--cesar/cp/beacon/src/beacon.c228
-rwxr-xr-xcesar/cp/beacon/test/Makefile10
-rw-r--r--cesar/cp/beacon/test/src/beacon.c86
-rw-r--r--cesar/cp/fsm/src/fsm/cp.fsm1
-rw-r--r--cesar/cp/sta/action/src/poweron.c2
7 files changed, 4 insertions, 340 deletions
diff --git a/cesar/cp/beacon/Module b/cesar/cp/beacon/Module
index 36c5a93753..c11aa7360b 100644
--- a/cesar/cp/beacon/Module
+++ b/cesar/cp/beacon/Module
@@ -1 +1 @@
-SOURCES:= beacon.c common.c beacon_discover.c unpack.c
+SOURCES:= beacon.c beacon_discover.c unpack.c
diff --git a/cesar/cp/beacon/inc/beacon.h b/cesar/cp/beacon/inc/beacon.h
index 690a70f02a..cbc6943ced 100644
--- a/cesar/cp/beacon/inc/beacon.h
+++ b/cesar/cp/beacon/inc/beacon.h
@@ -20,7 +20,6 @@
#include "cp/sta/mgr/net.h"
// Private ones.
-#include "cp/beacon/inc/common.h"
#include "cp/beacon/inc/beacon_discover.h"
#include "cp/beacon/inc/unpack.h"
@@ -98,20 +97,6 @@ struct cp_beacon_t
cp_beacon_desc_t *list_tail;
/**
- * Central beacon environment.
- */
- cp_beacon_common_t common[3];
-
- /**
- * Schedules index corresponding to the one in the Channel Access.
- */
- u16 ca_schedule_index;
- /**
- * First Shoot.
- */
- bool ca_sched_first_shoot;
-
- /**
* The leon timer to be programmed and awake each beacon period.
* Each time the timer expires, the function register by the beacon
* shall post an event in the FSM.
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index ba77acd86e..dbe4ace46b 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -265,128 +265,6 @@ cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon)
}
/**
- * Describe the current allocation for the Channel access schedule.
- * \param ctx the module context.
- * \param sched the CA schedule.
- * \param index the index of the schedule.
- */
-static inline void
-cp_beacon_ca_schedule_fill (cp_t *ctx, ca_schedule_t *sched, uint index)
-{
- cp_cco_bw_alloc_t *alloc;
- dbg_assert (ctx);
- dbg_assert (sched);
-
- for (alloc = cp_cco_bw_alloc_get_first (ctx, &ctx->bw.alloc_list);
- alloc;
- alloc = cp_cco_bw_alloc_get_next (ctx, &ctx->bw.alloc_list, alloc))
- {
- // If the allocation has a start time present flag a hole must be
- // added before this time.
- if (alloc->stpf
- && (MAC_ATU_TO_TCK(alloc->start_time_atu)
- != sched->allocations[sched->allocations_nb - 1]
- .end_offset_tck))
- {
- sched->allocations[sched->allocations_nb].end_offset_tck =
- MAC_ATU_TO_TCK(alloc->start_time_atu);
- sched->allocations[sched->allocations_nb].glid =
- MAC_LID_SPC_HOLE;
- sched->allocations_nb ++;
- }
-
- sched->allocations[sched->allocations_nb].end_offset_tck =
- MAC_ATU_TO_TCK (alloc->end_time_atu);
- sched->allocations[sched->allocations_nb].glid =
- alloc->glid | 0x80;
-
- sched->allocations_nb ++;
- }
-}
-
-/** Compute the CA schedules using the allocation defined in the bw module.
- * \param ctx the CP context.
- * \param hybrid_mode the hybrid mode of the medium
- * \param schedules the schedules computed from the BW or read in the
- * beacon.
- */
-void
-cp_beacon_compute_ca_schedules (cp_t *ctx)
-{
- ca_beacon_period_t beacon_period[CP_SCHED_BEACON_PERIODS_MAX];
- ca_schedule_t *ca_sched;
- uint i;
- cp_sta_own_data_t *own;
-
- dbg_assert (ctx);
-
- own = cp_sta_mgr_get_sta_own_data (ctx);
-
- /* ADD the beacon periods to the CA. */
- for (i = 0; i < CP_SCHED_BEACON_PERIODS_MAX; i++)
- {
- ca_sched = ca_alloc_get_schedule (ctx->ca,
- ctx->beacon.ca_schedule_index);
- ca_sched->allocations_nb = 0;
-
- if (ctx->beacon.snids.snidcd)
- {
- if (((int)(ctx->beacon.snids.snidcd - i)) > 0)
- /* Until the countdown is not complete, the SNID is still the
- * one in the station own data. */
- ca_sched->snid = cp_sta_own_data_get_snid (ctx);
- else
- /* The snid is the one in the snid context. */
- ca_sched->snid = ctx->beacon.snids.snid;
- }
- else
- ca_sched->snid = cp_sta_own_data_get_snid (ctx);
-
- if (ctx->beacon.hm.hmcd)
- {
- if (((int)(ctx->beacon.hm.hmcd - i)) > 0)
- /* Until the countdown is not complete, the Hybrid mode is still the
- * one in the station own data. */
- ca_sched->coexistence_mode = own->hybrid_mode;
- else
- /* The snid is the one in the snid context. */
- ca_sched->coexistence_mode = ctx->beacon.hm.hm;
- }
- else
- ca_sched->coexistence_mode = own->hybrid_mode;
-
- if ((ctx->beacon.eks.kccd)
- && (((int) (ctx->beacon.eks.kccd - i)) <= 0))
- {
- if (ctx->beacon.eks.kbc == CP_BEACON_EKS_KBC_NEK)
- ca_sched->nek_switch = !ctx->beacon.nek_index;
- else
- dbg_assert_default ();
- }
- else
- ca_sched->nek_switch = ctx->beacon.nek_index;
-
- cp_beacon_ca_schedule_fill (ctx, ca_sched, i);
-
- beacon_period[i].start_date =
- cp_pwl_get_beacon_period_start_date (ctx, i);
- beacon_period[i].schedule_index = ctx->beacon.ca_schedule_index;
-
- if ((++ctx->beacon.ca_schedule_index) >= CA_SCHEDULE_NB)
- ctx->beacon.ca_schedule_index = 0;
- }
-
- CP_TRACE_VERBOSE (BEACON_SCHEDULES, phy_date (),
- beacon_period[0].start_date,
- beacon_period[1].start_date,
- beacon_period[2].start_date,
- ctx->mac_config->ntb_offset_tck);
-
- ca_alloc_update_beacon_periods (ctx->ca, beacon_period,
- CP_SCHED_BEACON_PERIODS_MAX);
-}
-
-/**
* Add the allocation of the beacon to the bandwidth manager.
* \param ctx the Module context.
* \param unpack the unpack structure.
@@ -407,7 +285,6 @@ cp_beacon_sta_compute_schedules (cp_t *ctx,
cp_cco_bw_allocation_list_swap (ctx, unpack->bmis.schedules.set);
cp_cco_region_allocation_list_swap (ctx, unpack->bmis.regions.set);
- cp_beacon_compute_ca_schedules (ctx);
}
/**
@@ -431,9 +308,6 @@ cp_beacon_update_sta_peer (cp_t *ctx,
dbg_assert (net);
bt = unpack->variant_fields.bt;
- ctx->beacon.common[bt].nb_beacon_recv++;
- ctx->beacon.common[bt].last_beacon_ntb = mac_ntb();
-
/** Handle the absence of Mac address bentry in the Central beacon. */
mac = unpack->bmis.mac_address.present ?
unpack->bmis.mac_address.mac_addr : MAC_BROADCAST;
@@ -568,7 +442,6 @@ cp_beacon_countdowns (cp_t *ctx)
void
cp_beacon_init (cp_t *ctx)
{
- uint i;
dbg_assert (ctx);
// Initialise the beacon module.
@@ -577,13 +450,7 @@ cp_beacon_init (cp_t *ctx)
// Initialise the instance of the leon timer.
hal_timer_instance_init (ctx->hal_timer, &ctx->beacon.leon_timer,
ctx,
- (hal_timer_instance_cb_t) cp_beacon_timer_expires);
-
- // Initialise the central beacon common data.
- for (i = 0; i < CP_BEACON_TYPE_NB; i++)
- cp_beacon_common_init (&ctx->beacon.common[i]);
-
- ctx->beacon.ca_sched_first_shoot = true;
+ (hal_timer_instance_cb_t)cp_beacon_timer_expires);
// Initialise the callback in the interface module.
interface_callback_beacon_init (ctx->interface,
@@ -602,7 +469,6 @@ cp_beacon_init (cp_t *ctx)
void
cp_beacon_uninit (cp_t *ctx)
{
- uint i;
cp_beacon_desc_t *beacon;
// Cancel the Hal timer.
@@ -618,10 +484,6 @@ cp_beacon_uninit (cp_t *ctx)
}
ctx->beacon.list_tail = NULL;
- // Uninitialise the central beacon common data.
- for (i = 0; i < CP_BEACON_TYPE_NB; i++)
- cp_beacon_common_uninit (&ctx->beacon.common[i], ctx);
-
cp_beacon_discover_uninit (&ctx->beacon.discover);
}
@@ -647,72 +509,6 @@ cp_beacon_update_beacon_data (cp_t *ctx)
CP_TRACE_VERBOSE (BEACON_BEACON_SEND, phy_date (), beacon_type);
}
-void
-cp_beacon_create_default_schedules (cp_t *ctx)
-{
- uint i;
- dbg_assert (ctx);
- ca_beacon_period_t beacon_period[CP_SCHED_BEACON_PERIODS_MAX];
- ca_schedule_t *ca_sched;
-
- /* Clear the NTB history due to a synchronisation loose with the CCo or
- * the station is starting. */
- cp_beacon_ntb_clear (ctx);
-
- ca_sched = ca_alloc_get_schedule (ctx->ca,
- ctx->beacon.ca_schedule_index);
- ca_sched->allocations_nb = 1;
- ca_sched->coexistence_mode = MAC_COEXISTENCE_HYBRID_DELIMITERS_MODE;
- ca_sched->nek_switch = 0; //TODO
-
- ca_sched->allocations[0].end_offset_tck = cp_pwl_get_beacon_period_ntb(ctx);
- ca_sched->allocations[0].glid = MAC_LID_SHARED_CSMA;
-
- /* Only use to synchronise the BP.
- * useful when the station becomes CCo or UCCo.
- */
- cp_pwl__tracker__compute_beacon_period_start_time_ntb (ctx);
-
- // Create the beacon periods.
- for (i = 0; i < CP_SCHED_BEACON_PERIODS_MAX; i++)
- {
- beacon_period[i].start_date =
- cp_pwl_get_beacon_period_start_date (ctx, i);
- beacon_period[i].schedule_index = ctx->beacon.ca_schedule_index;
- }
-
- // Special case if it is not the first shoot.
- if (!ctx->beacon.ca_sched_first_shoot && !beacon_period[0].schedule_index)
- {
- beacon_period[0].schedule_index = CA_SCHEDULE_NB - 1;
- }
-
- CP_TRACE_VERBOSE (BEACON_SCHEDULES_DEF, phy_date (),
- beacon_period[0].start_date,
- beacon_period[1].start_date,
- beacon_period[2].start_date,
- ctx->mac_config->ntb_offset_tck);
-
- // Provide the beacon period to the CA.
- ca_alloc_update_beacon_periods (ctx->ca, beacon_period,
- CP_SCHED_BEACON_PERIODS_MAX);
-
- // Program the timer.
- hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
- hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
- cp_pwl_get_next_timer_date(ctx, true));
- CP_TRACE_VERBOSE (BEACON_TIMER_PRGM, phy_date (),
- cp_pwl_get_next_timer_date(ctx, true));
-
- if (ctx->beacon.ca_sched_first_shoot)
- ctx->beacon.ca_sched_first_shoot = false;
-
- // Increment the schedule index and verify it does not exceed the max
- // value of schedule index.
- if ( (++ctx->beacon.ca_schedule_index) >= CA_SCHEDULE_NB)
- ctx->beacon.ca_schedule_index = 0;
-}
-
/**
* Process the first beacon in the received list.
* \param ctx the control plane context.
@@ -975,7 +771,6 @@ cp_beacon_beacon_not_received (cp_t *ctx)
// Track the frequency.
cp_pwl__tracker__compute_beacon_period_start_time_ntb (ctx);
- cp_beacon_compute_ca_schedules (ctx);
// Program the timer.
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
@@ -1031,7 +826,6 @@ cp_beacon_change_nek (cp_t *ctx, uint eks, cp_key_t nek, bool now)
void
cp_beacon_deactivate (cp_t *ctx)
{
- uint i;
dbg_assert (ctx);
/* Stop the hal timer. */
@@ -1045,26 +839,6 @@ cp_beacon_deactivate (cp_t *ctx)
ctx->beacon.list = NULL;
ctx->beacon.list_tail = NULL;
}
-
- /* release MFS. */
- for (i = 0; i < 3; i++)
- {
- if (ctx->beacon.common[i].mfs)
- {
- /* Remove the MFS from the CA and release the reference provided
- * to the CA. */
- ca_mfs_remove (ctx->ca, ctx->beacon.common[i].mfs);
- blk_release (ctx->beacon.common[i].mfs);
-
- /* Remove the MFS from the mac store. */
- mac_store_mfs_remove (ctx->mac_store,
- (mfs_t*) ctx->beacon.common[i].mfs);
-
- /* Release the reference on the MFS hold by the beacon module. */
- blk_release (ctx->beacon.common[i].mfs);
- }
- cp_beacon_common_init (&ctx->beacon.common[i]);
- }
}
void
diff --git a/cesar/cp/beacon/test/Makefile b/cesar/cp/beacon/test/Makefile
index 2dc21af092..2602862161 100755
--- a/cesar/cp/beacon/test/Makefile
+++ b/cesar/cp/beacon/test/Makefile
@@ -4,7 +4,7 @@ INCLUDES = cp/beacon/test/override
ECOS = y
-TARGET_PROGRAMS = beacon bentry discover_process schedules
+TARGET_PROGRAMS = beacon bentry discover_process
beacon_SOURCES = beacon.c \
ca_stub.c ntb_stub.c secu_stub.c bsu_stub.c
@@ -28,14 +28,6 @@ discover_process_MODULES = lib cp/beacon mac/common cp/sta/mgr cp/pwl \
cp/fsm/stub cp/cco/action/stub hal/timer/stub \
cp/sta/core/stub mac/sar/stub cl/stub cp/cco/bw
-schedules_SOURCES = schedules.c \
- interface_stub.c ca_stub.c ntb_stub.c \
- sar_stub.c secu_stub.c bsu_stub.c
-schedules_MODULES = lib cp/beacon cp/sta/mgr cp/cco/bw mac/common cp/pwl \
- cp/cco/region \
- hal/timer/stub cp/sta/core/stub cp/fsm/stub \
- cp/cco/action/stub mac/sar/stub cl/stub
-
mac_common_MODULE_SOURCES = config.c mfs.c store.c tonemap.c tonemask.c sta.c
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/beacon/test/src/beacon.c b/cesar/cp/beacon/test/src/beacon.c
index 1e632e63b9..75789b1356 100644
--- a/cesar/cp/beacon/test/src/beacon.c
+++ b/cesar/cp/beacon/test/src/beacon.c
@@ -48,32 +48,6 @@ struct interface_t
static cp_t cp;
-/** Common test for the init and uninit function.
- *
- * \param test the test object.
- */
-void
-test_case_beacon_common_init_uninit (test_t test)
-{
- uint i;
- test_begin (test, "verify")
- {
- for (i = 0; i < 3; i++)
- {
- // Central beacon common data.
- test_fail_if (cp.beacon.common[i].bpsto.bpsto != NULL,
- "beacon BPSTO pointer shall be null");
- test_fail_if (cp.beacon.common[i].nb_beacon_recv != 0,
- "Counter shall be equal to 0");
- test_fail_if (cp.beacon.common[i].nb_beacon_failed != 0,
- "Counter shall be equal to 0");
- test_fail_if (cp.beacon.common[i].mfs != NULL,
- "MFS pointer shall be null");
- }
- }
- test_end;
-}
-
/** Initialise
*
* At the end of this test, all the variables present in the beacon context
@@ -86,8 +60,6 @@ test_case_beacon_init (test_t test)
cp_beacon_init (&cp);
test_case_begin (test, "beacon init");
-
- test_case_beacon_common_init_uninit (test);
}
/** Uninitialise
@@ -115,8 +87,6 @@ test_case_beacon_init (test_t test)
void
test_case_beacon_uninit (test_t test)
{
- bool added;
-
test_case_begin (test, "Beacon uninit");
cp_beacon_init (&cp);
@@ -126,43 +96,22 @@ test_case_beacon_uninit (test_t test)
cp_beacon_receive (&cp, (cp_beacon_desc_t *) blk_alloc_desc ());
cp_beacon_receive (&cp, (cp_beacon_desc_t *) blk_alloc_desc ());
- // Add a central beacon.
- cp.beacon.common[0].mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
- MAC_LID_SPC_CENTRAL,
- 0xff, &added);
- cp.beacon.common[0].mfs->cap = 0x3;
-
- cp.beacon.common[1].mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
- MAC_LID_DISCOVER,
- 0xff, &added);
- cp.beacon.common[1].mfs->cap = 0x2;
-
- cp.beacon.common[2].mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
- 0x1,
- 0xff, &added);
-
cp_beacon_uninit (&cp);
-
- test_case_beacon_common_init_uninit (test);
}
void
test_case_beacon__deactivate (test_t test)
{
- bool added;
-
test_case_begin (test, "Deactivate");
test_begin (test, "Deactivate beacon module")
{
uint nb_beacons = 2;
- cp_beacon_common_t cmp;
mac_store_t *mac_store = mac_store_init();
uint ca;
/* Configure the test. */
memset (&cp, 0, sizeof (cp_t));
- memset (&cmp, 0, sizeof (cp_beacon_common_t));
cp.mac_store = mac_store;
cp.ca = (ca_t *) &ca;
@@ -170,35 +119,6 @@ test_case_beacon__deactivate (test_t test)
/* Still configuring the test... */
cp.beacon.leon_timer.status = true;
- cp.beacon.common[0].nb_beacon_recv = 10;
- cp.beacon.common[0].nb_beacon_sent = 10;
- cp.beacon.common[0].nb_beacon_failed = 34;
- cp.beacon.common[0].mfs = mac_store_mfs_add_tx (mac_store, true,
- false,
- MAC_LID_SPC_CENTRAL,
- MAC_TEI_BCAST,
- &added);
-
- blk_addref (cp.beacon.common[0].mfs);
- ca_mfs_add (cp.ca, cp.beacon.common[0].mfs);
-
- cp.beacon.common[1].nb_beacon_recv = 12;
- cp.beacon.common[1].nb_beacon_sent = 14;
- cp.beacon.common[1].nb_beacon_failed = 24;
- cp.beacon.common[1].mfs = mac_store_mfs_add_tx (mac_store, true,
- false,
- MAC_LID_DISCOVER,
- MAC_TEI_BCAST,
- &added);
- blk_addref (cp.beacon.common[1].mfs);
- ca_mfs_add (cp.ca, cp.beacon.common[1].mfs);
-
-
- cp.beacon.common[2].nb_beacon_recv = 2;
- cp.beacon.common[2].nb_beacon_sent = 13;
- cp.beacon.common[2].nb_beacon_failed = 20;
- cp.beacon.common[2].mfs = NULL;
-
/* Allocate some beacons. */
cp.beacon.list = (cp_beacon_desc_t *) blk_alloc_desc_range (
@@ -208,12 +128,6 @@ test_case_beacon__deactivate (test_t test)
/* test. */
cp_beacon_deactivate (&cp);
- test_fail_if (memcmp (&cp.beacon.common[0], &cmp,
- sizeof (cp_beacon_common_t)) != 0);
- test_fail_if (memcmp (&cp.beacon.common[1], &cmp,
- sizeof (cp_beacon_common_t)) != 0);
- test_fail_if (memcmp (&cp.beacon.common[2], &cmp,
- sizeof (cp_beacon_common_t)) != 0);
test_fail_if (cp.beacon.list != NULL);
test_fail_if (cp.beacon.list_tail != NULL);
diff --git a/cesar/cp/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/src/fsm/cp.fsm
index 93bdb6abe4..afb3dd8d74 100644
--- a/cesar/cp/fsm/src/fsm/cp.fsm
+++ b/cesar/cp/fsm/src/fsm/cp.fsm
@@ -428,7 +428,6 @@ SC_USTA:
to_stop -> IDLE [cp_sta_action_poweron__many__to_idle]
POWERON_JOINING:
- BEACON_TIMER_EXPIRES -> . [cp_beacon_create_default_schedules]
left -> POWERON [cp_sta_action_poweron__poweron_joining__left]
USTA_JOINING:
diff --git a/cesar/cp/sta/action/src/poweron.c b/cesar/cp/sta/action/src/poweron.c
index 97a1b22e03..82903da6a3 100644
--- a/cesar/cp/sta/action/src/poweron.c
+++ b/cesar/cp/sta/action/src/poweron.c
@@ -150,7 +150,7 @@ cp_sta_action_poweron__many__to_idle (cp_t *ctx)
void
cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
{
- cp_beacon_create_default_schedules (ctx);
+// TODO remove cp_beacon_create_default_schedules (ctx);
sar_activate (ctx->sar, true);
pbproc_activate (ctx->pbproc, true);
}