summaryrefslogtreecommitdiff
path: root/cesar/bsu/src/bsu.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/bsu/src/bsu.c')
-rw-r--r--cesar/bsu/src/bsu.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index da12e6d185..d7b58cb220 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -522,19 +522,20 @@ bsu_avln_schedules_decrease_countdown (bsu_t *ctx, bsu_avln_t *avln)
* Create the beacon to be send over the PLC.
* \param ctx the module context.
* \param type the beacon type.
+ * \param bsu_beacon the beacon to use to write the PB.
*/
static void
-bsu_beacon_send_prepare (bsu_t *ctx, bsu_beacon_type_t type)
+bsu_beacon_send_prepare (bsu_t *ctx, bsu_beacon_type_t type,
+ bsu_beacon_t *bsu_beacon)
{
pb_beacon_t *beacon;
pbproc_tx_beacon_params_t params;
bsu_aclf_bto (ctx->aclf, (s16*) params.bto, COUNT (params.bto));
- beacon = bsu_beacon_write (&ctx->sta_avln->beacon, type,
- ctx->mac_config, &params);
+ bsu_beacon->bmis.discover_info = ctx->discover_info;
+ beacon = bsu_beacon_write (bsu_beacon, type, ctx->mac_config, &params);
/* Reset the updated flag in the discover info beacon entry. */
if (type == BSU_BEACON_TYPE_DISCOVER)
- bitstream_direct_write (
- &ctx->sta_avln->beacon.bmis.discover_info.info_data, 0, 0, 1);
+ bitstream_direct_write (&ctx->discover_info.info_data, 0, 0, 1);
/* Send the beacon. */
bsu_beacon_send (ctx, type, beacon, &params);
}
@@ -576,14 +577,16 @@ bsu_timer_event_process (void *ud)
ctx->pbproc,
bsu_aclf_beacon_period_start_date_next (ctx->aclf)
+ bsu_aclf_beacon_period_tck (ctx->aclf));
- bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_CENTRAL);
+ bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_CENTRAL,
+ &ctx->sta_avln->beacon);
}
if (ctx->is_sta == BSU_UPDATE_STA_TYPE_UCCO
|| (ctx->sta_avln->beacon.bmis.discover.present
&& ctx->sta_avln->beacon.bmis.discover.tei
== ctx->mac_config->tei))
{
- bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_DISCOVER);
+ bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_DISCOVER,
+ &ctx->sta_avln->beacon);
/* Not UCCo discover beacon had been sent set the flag to
* false to avoid to resend a discover beacon on next wake up. */
if (ctx->is_sta != BSU_UPDATE_STA_TYPE_UCCO)
@@ -740,7 +743,8 @@ bsu_beacon_process (bsu_t *ctx, pb_beacon_t *beacon,
if (ctx->sta_avln->beacon.bmis.discover.present
&& ctx->sta_avln->beacon.bmis.discover.tei
== ctx->mac_config->tei)
- bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_DISCOVER);
+ bsu_beacon_send_prepare (ctx, BSU_BEACON_TYPE_DISCOVER,
+ &bsu_beacon);
ctx->sta_avln->beacon.beacon_period_start_date = params->bts -
ctx->sta_avln->sync.ntb_offset_tck;
avln = ctx->sta_avln;
@@ -1034,13 +1038,12 @@ bsu_update_discover_info (bsu_beacon_bmi_discover_info_t *discover)
arch_dsr_lock ();
bool discover_updated = bitstream_direct_read
(&discover->info_data, 0, 1);
- bool current_discover_updated = bitstream_direct_read
- (&ctx->sta_avln->beacon.bmis.discover_info.info_data, 0, 1);
- ctx->sta_avln->beacon.bmis.discover_info = *discover;
+ bool current_discover_updated =
+ bitstream_direct_read (&ctx->discover_info.info_data, 0, 1);
+ ctx->discover_info = *discover;
/* BSU is responsible for reseting the updated flag in this entry. */
if (current_discover_updated || discover_updated)
- bitstream_direct_write (
- &ctx->sta_avln->beacon.bmis.discover_info.info_data, 0, 1, 1);
+ bitstream_direct_write (&ctx->discover_info.info_data, 0, 1, 1);
arch_dsr_unlock ();
}