summaryrefslogtreecommitdiff
path: root/cesar/bsu/src
diff options
context:
space:
mode:
authorlaranjeiro2010-05-17 09:57:17 +0000
committerlaranjeiro2010-05-17 09:57:17 +0000
commit4a0f75368eb4ad5b3476b51c62ea6f29dbfee15a (patch)
tree99366ae1acad5267d9e2f1699a1e0d16fc0a0872 /cesar/bsu/src
parent90ca77eda29003d926b9ce86421b259c5548b30c (diff)
cesar/bsu: add UCCo support
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7063 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/src')
-rw-r--r--cesar/bsu/src/bsu.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index d0fb885f1f..18b45854d5 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -326,7 +326,7 @@ bsu_timer_event_process (void *ud)
{
u32 bpsd[BSU_BEACON_PERIOD_NB];
dbg_assert (ctx);
- if (ctx->is_sta)
+ if (ctx->is_sta == BSU_UPDATE_STA_TYPE_STA)
{
/* If it reached this point, the beacon has not been received. */
bsu_aclf_beacon_period_start_date (ctx->aclf, bpsd, COUNT (bpsd));
@@ -342,10 +342,26 @@ bsu_timer_event_process (void *ud)
if (less_mod2p32 (ctx->beacon.beacon_period_start_date, bpsd[0]))
/* Create and send the beacon. */
bsu_beacon_countdown (&ctx->beacon);
- beacon = bsu_beacon_write (&ctx->beacon, BSU_BEACON_TYPE_CENTRAL,
- ctx->mac_config, &params);
- /* Send the beacon. */
- bsu_beacon_send (ctx, BSU_BEACON_TYPE_CENTRAL, beacon, &params);
+ if (ctx->is_sta == BSU_UPDATE_STA_TYPE_CCO)
+ {
+ beacon = bsu_beacon_write (&ctx->beacon,
+ BSU_BEACON_TYPE_CENTRAL,
+ ctx->mac_config, &params);
+ /* Send the beacon. */
+ bsu_beacon_send (ctx, BSU_BEACON_TYPE_CENTRAL, beacon,
+ &params);
+ }
+ if (ctx->is_sta == BSU_UPDATE_STA_TYPE_UCCO
+ || (ctx->beacon.bmis.discover.present
+ && ctx->beacon.bmis.discover.tei == ctx->mac_config->tei))
+ {
+ beacon = bsu_beacon_write (&ctx->beacon,
+ BSU_BEACON_TYPE_DISCOVER,
+ ctx->mac_config, &params);
+ /* Send the beacon. */
+ bsu_beacon_send (ctx, BSU_BEACON_TYPE_DISCOVER, beacon,
+ &params);
+ }
}
bsu_ca_schedules (ctx, ctx->sta_avln);
/* Reprogram the timer. */
@@ -390,6 +406,7 @@ bsu_init (bsu_aclf_t *aclf, mac_config_t *mac_config, phy_t *phy,
hal_timer_instance_init (timer, &ctx->timer, ctx,
bsu_timer_event_process);
ctx->activate = false;
+ ctx->is_sta = BSU_UPDATE_STA_TYPE_STA;
return ctx;
}
@@ -492,13 +509,13 @@ bsu_update__persistent_schedules (bsu_t *ctx, bsu_beacon_t *beacon)
}
void
-bsu_update (bsu_beacon_t *beacon, bool is_sta)
+bsu_update (bsu_beacon_t *beacon, bsu_update_sta_type_t is_sta)
{
bsu_t *ctx = &bsu_global;
dbg_assert (ctx);
dbg_assert (beacon);
ctx->is_sta = is_sta;
- bsu_aclf_aclsc (ctx->aclf, !is_sta);
+ bsu_aclf_aclsc (ctx->aclf, is_sta != BSU_UPDATE_STA_TYPE_STA);
/* If persistent schedules are present and there is more than one. The
* second can only be present if the first one has its PSCD equal to 0.
* See specification section 5.1.2 Beacon Period Structure Figure 5-3. */