summaryrefslogtreecommitdiff
path: root/cesar/cp/beacon/src/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/beacon/src/beacon.c')
-rw-r--r--cesar/cp/beacon/src/beacon.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index d3dddde43d..9966b52b5a 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -95,7 +95,8 @@ cp_beacon_fill_share_memory (cp_t *ctx)
beacon = cp_get_next_beacon_shared_memory (ctx);
dbg_assert (beacon);
-
+ beacon->beacon_period_start_date =
+ bsu_aclf_beacon_period_start_date_next (ctx->bsu_aclf);
sta = cp_sta_mgr_get_sta_own_data (ctx);
if (cp_sta_own_data_get_tei (ctx))
net = cp_sta_mgr_get_our_avln (ctx);
@@ -573,8 +574,6 @@ cp_beacon_init (cp_t *ctx)
(hal_timer_instance_cb_t)cp_beacon_timer_expires);
// Initialise the mem_share_slot_id so that the next slot is 0.
ctx->beacon.shared_mem_slot_id = CP_SHARED_MEM_SLOT_NB - 1;
- ctx->beacon.last_countdown_date = phy_date ();
- ctx->beacon.countdown_limit_date = ctx->beacon.last_countdown_date;
/* Setup beacon indicator. */
GPIO_SETUP (LED_BEACON_TX_RX, GPIO_DIRECTION_OUT);
GPIO_SET (LED_BEACON_TX_RX, 0);
@@ -647,7 +646,8 @@ void
cp_beacon_poweron_init (cp_t *ctx)
{
dbg_assert (ctx);
-
+ ctx->beacon.countdown_limit_date =
+ ctx->beacon.last_countdown_date = phy_date ();
/* Generate the beacon and send. */
bsu_beacon_t *beacon = cp_beacon_fill_share_memory (ctx);
bsu_update (beacon, BSU_UPDATE_STA_TYPE_STA);
@@ -689,7 +689,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
&((cp_beacon_payload_t*)pb_beacon->data)->bsu_params;
snid = bsu_params->rx_parameters.snid;
- if (!bsu_beacon_read (pb_beacon, &beacon_data, &type, (u8*)&tei,
+ u8 btei;
+ if (!bsu_beacon_read (pb_beacon, &beacon_data, &type, &btei,
&mac_address))
{
/* The beacon contains some strange values. */
@@ -699,6 +700,7 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
blk_release_desc ((blk_t *)pb_beacon);
return;
}
+ tei = btei;
/** Beacon received ok. */
GPIO_TOGGLE (LED_BEACON_TX_RX);
@@ -716,8 +718,9 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
cp_net_set_slot_id_and_usage (ctx, net, beacon_data.vf.slotid,
beacon_data.vf.slotusage);
+ dbg_assert (tei == MAC_TEI_UNASSOCIATED || MAC_TEI_IS_STA (tei));
sta = cp_beacon_update_sta_peer (ctx, &beacon_data, net, type, tei,
- mac_address);
+ mac_address);
/** Check handover in progress status. */
if ((!ctx->beacon.hoip.hoipcd)
@@ -959,9 +962,6 @@ cp_beacon_reconfigure_timer (cp_t *ctx, bool cco)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
date);
-
- dbg_assert (phy_date () < date);
-
CP_TRACE_VERBOSE (BEACON_TIMER_PRGM, phy_date (), date);
}