summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/beacon/stub/src/beacon.c6
-rw-r--r--cesar/cp/cco/action/inc/cco_action.h2
-rw-r--r--cesar/cp/cco/action/src/handover.c17
-rw-r--r--cesar/cp/cco/action/test/utest/override/cp/inc/context.h1
-rw-r--r--cesar/cp/inc/context.h3
-rw-r--r--cesar/cp/sta/action/inc/context.h2
-rw-r--r--cesar/cp/sta/action/src/handover.c4
-rw-r--r--cesar/cp/sta/action/test/utest/override/cp/inc/context.h1
-rw-r--r--cesar/cp/sta/core/src/core.c21
9 files changed, 34 insertions, 23 deletions
diff --git a/cesar/cp/beacon/stub/src/beacon.c b/cesar/cp/beacon/stub/src/beacon.c
index 667fd85cc0..8b7f5922a2 100644
--- a/cesar/cp/beacon/stub/src/beacon.c
+++ b/cesar/cp/beacon/stub/src/beacon.c
@@ -107,3 +107,9 @@ cp_beacon_handover (cp_t *ctx, cp_tei_t tei) __attribute__ ((weak));
void
cp_beacon_handover (cp_t *ctx, cp_tei_t tei) {}
+
+void
+cp_beacon_reconfigure_timer (cp_t *ctx) __attribute__((weak));
+
+void
+cp_beacon_reconfigure_timer (cp_t *ctx) {}
diff --git a/cesar/cp/cco/action/inc/cco_action.h b/cesar/cp/cco/action/inc/cco_action.h
index c2e820b7fe..8638139312 100644
--- a/cesar/cp/cco/action/inc/cco_action.h
+++ b/cesar/cp/cco/action/inc/cco_action.h
@@ -41,8 +41,6 @@ struct cp_cco_action_t
/** Handover reason. */
enum cp_msg_cc_handover_req_reason_t handover_reason;
enum cp_msg_cc_handover_req_soft_hard_t soft_hard;
- /** Handover timeout. */
- cp_sta_core_timed_event_def_t handover_timeout;
};
BEGIN_DECLS
diff --git a/cesar/cp/cco/action/src/handover.c b/cesar/cp/cco/action/src/handover.c
index 3be1dec36a..99a3359cad 100644
--- a/cesar/cp/cco/action/src/handover.c
+++ b/cesar/cp/cco/action/src/handover.c
@@ -17,6 +17,7 @@
#include "cp/cco/action/cco_action.h"
#include "cp/msg/msg.h"
#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/action/action.h"
#include "cp/msg/msg.h"
#include "cp/fsm/fsm.h"
@@ -50,7 +51,7 @@ cp_cco_action_handover__cc_handover_req_prepare (cp_t *ctx,
/* Program the timer for the timeout. */
event = cp_fsm_event_bare_new (ctx, CP_FSM_EVENT_TYPE_HANDOVER_TIMEOUT);
- cp_sta_core_gen_timed_event (ctx, &ctx->cco_action.handover_timeout,
+ cp_sta_core_gen_timed_event (ctx, &ctx->handover_timeout,
event, CP_TIMEOUT_MS);
}
@@ -136,8 +137,9 @@ cp_cco_action_handover__cc_handover_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme)
cp_msg_cc_handover_info_ind_send_end (ctx, mme_tx);
/* Program the timer for the timeout. */
+ cp_sta_core_stop_timed_or_cyclic_event (ctx, &ctx->handover_timeout);
event = cp_fsm_event_bare_new (ctx, CP_FSM_EVENT_TYPE_HANDOVER_TIMEOUT);
- cp_sta_core_gen_timed_event (ctx, &ctx->cco_action.handover_timeout,
+ cp_sta_core_gen_timed_event (ctx, &ctx->handover_timeout,
event, CP_TIMEOUT_MS);
}
else
@@ -163,7 +165,7 @@ cp_cco_action_handover__cc_handover_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme)
/* Cancel the timer. */
cp_sta_core_stop_timed_or_cyclic_event (ctx,
- &ctx->cco_action.handover_timeout);
+ &ctx->handover_timeout);
}
}
@@ -190,7 +192,7 @@ cp_cco_action_handover__timeout (cp_t *ctx)
/* Cancel the timer. */
cp_sta_core_stop_timed_or_cyclic_event (ctx,
- &ctx->cco_action.handover_timeout);
+ &ctx->handover_timeout);
}
void
@@ -221,6 +223,10 @@ cp_cco_action_handover__cc_handover_info_rsp_receive (cp_t *ctx,
{
cp_beacon_handover (ctx, mme->peer.tei);
}
+
+ /* Cancel the timer. */
+ cp_sta_core_stop_timed_or_cyclic_event (ctx,
+ &ctx->handover_timeout);
}
void
@@ -228,9 +234,6 @@ cp_cco_action_handover__hoip_countdown_expired (cp_t *ctx)
{
dbg_assert (ctx);
- /* Cancel the timer. */
- cp_sta_core_stop_timed_or_cyclic_event (ctx,
- &ctx->cco_action.handover_timeout);
cp_cco_action__cco__assoc_stop (ctx);
cp_sta_action_assoc__authenticated__renew (ctx);
}
diff --git a/cesar/cp/cco/action/test/utest/override/cp/inc/context.h b/cesar/cp/cco/action/test/utest/override/cp/inc/context.h
index f4b18ed336..ad20c39ad6 100644
--- a/cesar/cp/cco/action/test/utest/override/cp/inc/context.h
+++ b/cesar/cp/cco/action/test/utest/override/cp/inc/context.h
@@ -38,6 +38,7 @@ struct cp_t
mac_store_t *mac_store;
sar_t *sar;
pbproc_t *pbproc;
+ cp_sta_core_timed_event_def_t handover_timeout;
#if CONFIG_TRACE
trace_buffer_t trace;
#endif
diff --git a/cesar/cp/inc/context.h b/cesar/cp/inc/context.h
index cdd7b52fa9..d219e162ad 100644
--- a/cesar/cp/inc/context.h
+++ b/cesar/cp/inc/context.h
@@ -125,6 +125,9 @@ struct cp_t
/** Random generator. */
lib_rnd_t rnd;
+
+ /** Handover timeout. */
+ cp_sta_core_timed_event_def_t handover_timeout;
};
#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/sta/action/inc/context.h b/cesar/cp/sta/action/inc/context.h
index 6b072635fb..85314eaeb9 100644
--- a/cesar/cp/sta/action/inc/context.h
+++ b/cesar/cp/sta/action/inc/context.h
@@ -95,8 +95,6 @@ struct cp_sta_action_t
struct cp_sta_action_bridge_t bridge;
/** Simple Connect part. */
struct cp_sta_action_sc_t sc;
- /** handover timeout event. */
- cp_sta_core_timed_event_def_t handover_timeout;
};
typedef struct cp_sta_action_t cp_sta_action_t;
diff --git a/cesar/cp/sta/action/src/handover.c b/cesar/cp/sta/action/src/handover.c
index d8b00abf02..1d02648e53 100644
--- a/cesar/cp/sta/action/src/handover.c
+++ b/cesar/cp/sta/action/src/handover.c
@@ -57,7 +57,7 @@ cp_sta_action_handover__handover (cp_t *ctx, cp_mme_rx_t *mme)
event = cp_fsm_event_bare_new (ctx,
CP_FSM_EVENT_TYPE_HANDOVER_TIMEOUT);
cp_sta_core_gen_timed_event (ctx,
- &ctx->sta_action.handover_timeout,
+ &ctx->handover_timeout,
event,
CP_TIMEOUT_MS);
}
@@ -90,7 +90,7 @@ cp_sta_action_handover__handover_info_ind_receive (cp_t *ctx,
dbg_assert (mme);
cp_sta_core_stop_timed_or_cyclic_event (ctx,
- &ctx->sta_action.handover_timeout);
+ &ctx->handover_timeout);
res = cp_msg_cc_handover_info_ind_receive_begin (ctx, mme, &rsc, &bcco,
&num_sta);
diff --git a/cesar/cp/sta/action/test/utest/override/cp/inc/context.h b/cesar/cp/sta/action/test/utest/override/cp/inc/context.h
index fd362cd299..88928aaf00 100644
--- a/cesar/cp/sta/action/test/utest/override/cp/inc/context.h
+++ b/cesar/cp/sta/action/test/utest/override/cp/inc/context.h
@@ -34,6 +34,7 @@ struct cp_t
mac_store_t *mac_store;
sar_t *sar;
pbproc_t *pbproc;
+ cp_sta_core_timed_event_def_t handover_timeout;
#if CONFIG_TRACE
trace_buffer_t trace;
#endif
diff --git a/cesar/cp/sta/core/src/core.c b/cesar/cp/sta/core/src/core.c
index 1b9262ab94..92be195d8f 100644
--- a/cesar/cp/sta/core/src/core.c
+++ b/cesar/cp/sta/core/src/core.c
@@ -402,7 +402,17 @@ cp_sta_core_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data)
dbg_assert(data);
sta_core_alarm = (cp_sta_core_timed_event_def_t *)data;
- dbg_assert(sta_core_alarm->cp_ctx);
+ dbg_assert (sta_core_alarm->cp_ctx);
+ dbg_assert (sta_core_alarm->alarm_handle);
+
+ if (!sta_core_alarm->cyclic_alarm
+ && ((sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ || (sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_GARBAGE)))
+ {
+ cyg_alarm_delete(sta_core_alarm->alarm_handle);
+ // resetting alarm handle (useful for detection by external garbage collector)
+ sta_core_alarm->alarm_handle = (cyg_handle_t)0;
+ }
// depending on elapsed timer, signal sta core wait-event loop
// with relevant core event
@@ -421,15 +431,6 @@ cp_sta_core_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data)
dbg_assert (0);
break;
}
-
- if (!sta_core_alarm->cyclic_alarm
- && ((sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
- || (sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_GARBAGE)))
- {
- cyg_alarm_delete(sta_core_alarm->alarm_handle);
- // resetting alarm handle (useful for detection by external garbage collector)
- sta_core_alarm->alarm_handle = (cyg_handle_t)0;
- }
}
/**