summaryrefslogtreecommitdiff
path: root/cesar/cp/av/sta/action/src/poweron.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/av/sta/action/src/poweron.c')
-rw-r--r--cesar/cp/av/sta/action/src/poweron.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/cesar/cp/av/sta/action/src/poweron.c b/cesar/cp/av/sta/action/src/poweron.c
index 91a270cc6d..a46a86b892 100644
--- a/cesar/cp/av/sta/action/src/poweron.c
+++ b/cesar/cp/av/sta/action/src/poweron.c
@@ -54,6 +54,8 @@ cp_av_sta_action_poweron__many__to_idle (cp_t *ctx)
void
cp_av_sta_action_poweron__idle__to_poweron (cp_t *ctx)
{
+ cp_sta_own_data_t *own;
+
cp_beacon_poweron_init (ctx);
bsu_power_on (ctx->bsu, cp_sta_own_data_get_snid (ctx));
/* Update beacon data program a timer is a wrong values beacon ACLF is
@@ -62,6 +64,31 @@ cp_av_sta_action_poweron__idle__to_poweron (cp_t *ctx)
cp_beacon_reconfigure_timer (ctx, false);
sar_activate (ctx->sar, true);
pbproc_activate (ctx->pbproc, true);
+
+ if (ctx->sta_action.poweron.enter.need_set)
+ {
+ cp_sta_own_data_set_nid (ctx, ctx->sta_action.poweron.enter.nid);
+ cp_sta_own_data_set_nmk (ctx, ctx->sta_action.poweron.enter.nmk,
+ ctx->sta_action.poweron.enter.type);
+
+ ctx->sta_action.poweron.enter.need_set = false;
+ }
+
+ own = cp_sta_mgr_get_sta_own_data (ctx);
+ switch (own->force_role)
+ {
+ case MAC_FORCE_ROLE_STA:
+ cp_fsm_branch (ctx, IDLE, to_poweron, sta_forced);
+ break;
+
+ case MAC_FORCE_ROLE_CCO:
+ cp_fsm_branch (ctx, IDLE, to_poweron, cco_forced);
+ break;
+
+ default:
+ cp_fsm_branch (ctx, IDLE, to_poweron, homeplug_av);
+ break;
+ }
}
void
@@ -131,15 +158,6 @@ cp_av_sta_action_poweron__poweron__enter (cp_t *ctx)
/* USTT timer. */
cp_av_sta_action_poweron_ustt_start (ctx, CP_USTA_IND_INTERVAL_MS);
- if (ctx->sta_action.poweron.enter.need_set)
- {
- cp_sta_own_data_set_nid (ctx, ctx->sta_action.poweron.enter.nid);
- cp_sta_own_data_set_nmk (ctx, ctx->sta_action.poweron.enter.nmk,
- ctx->sta_action.poweron.enter.type);
-
- ctx->sta_action.poweron.enter.need_set = false;
- }
-
bsu_beacon_t beacon;
cp_beacon_fill (ctx, &beacon);
/* Act as STA, for BSU corresponds to only hear the central beacon from