summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-03-15 11:46:37 +0100
committerNélio Laranjeiro2011-04-18 09:18:48 +0200
commit949e9720fb4a09999538661cef19fc56bb776873 (patch)
tree9d83c098181ec24438631dcfd5c2ba6fea33048b /cesar/cp
parent7f2da2df1263acd699af4d300e70c32d671705b3 (diff)
cesar: add bsu context to all bsu function calls, closes #2400
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/beacon/src/beacon.c31
-rw-r--r--cesar/cp/beacon/test/override-scenario/cp/inc/context.h1
-rw-r--r--cesar/cp/beacon/test/override/cp/inc/context.h2
-rw-r--r--cesar/cp/beacon/test/src/beacon.c22
-rw-r--r--cesar/cp/beacon/test/src/beacon_scenario.c15
-rw-r--r--cesar/cp/beacon/test/src/bsu_stub.c13
-rw-r--r--cesar/cp/beacon/test/src/bsu_stub_scenario.c17
-rw-r--r--cesar/cp/cco/action/src/cco_action.c4
-rw-r--r--cesar/cp/cco/action/test/overide/cp/inc/context.h1
-rw-r--r--cesar/cp/cco/action/test/utest/override/cp/inc/context.h1
-rw-r--r--cesar/cp/cco/action/test/utest/src/assoc.c4
-rw-r--r--cesar/cp/cl_interf/test/override/cp/inc/context.h1
-rw-r--r--cesar/cp/cp.h7
-rw-r--r--cesar/cp/inc/context.h3
-rw-r--r--cesar/cp/msg/test/overide/cp/inc/context.h3
-rw-r--r--cesar/cp/msg/test/src/misc_stub.c2
-rw-r--r--cesar/cp/src/cp.c9
-rw-r--r--cesar/cp/sta/action/src/assoc.c2
-rw-r--r--cesar/cp/sta/action/src/poweron.c10
-rw-r--r--cesar/cp/sta/action/test/utest/override/cp/inc/context.h1
-rw-r--r--cesar/cp/sta/mgr/src/sta_mgr.c2
-rw-r--r--cesar/cp/sta/mgr/src/sta_own_data.c2
-rw-r--r--cesar/cp/sta/mgr/test/overide/cp/inc/context.h2
23 files changed, 82 insertions, 73 deletions
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index 658d2cdfd2..2a105f5b27 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -517,13 +517,14 @@ cp_beacon_countdowns (cp_t *ctx)
(ctx->beacon.eks.kbc == BSU_BEACON_EKS_KBC_NEK))
{
/* The countdown elapsed and we check the current nek index */
- if (ctx->mac_config->nek[bsu_nek_index_current ()].eks ==
- MAC_EKS_CLEAR)
+ if (ctx->mac_config->nek[
+ bsu_nek_index_current (INVALID_PTR)].eks == MAC_EKS_CLEAR)
/* Countdown elapsed and no NEK is available */
cp_fsm_trigger_new_event (ctx, bare, to_leave);
ctx->beacon.eks.kbc = BSU_BEACON_EKS_KBC_NB;
- ctx->mac_config->nek[bsu_nek_index_next ()].eks = MAC_EKS_CLEAR;
+ ctx->mac_config->nek[bsu_nek_index_next (INVALID_PTR)].eks =
+ MAC_EKS_CLEAR;
}
}
}
@@ -593,7 +594,7 @@ cp_beacon_sta_update_beacon_data (cp_t *ctx)
dbg_assert (ctx);
bsu_beacon_bmi_discover_info_t discover;
cp_beacon_fill_discover_info (ctx, &discover);
- bsu_update_discover_info (&discover);
+ bsu_update_discover_info (ctx->bsu, &discover);
}
void
@@ -602,7 +603,7 @@ cp_beacon_cco_update_beacon_data (cp_t *ctx)
bsu_beacon_t beacon;
dbg_assert (ctx);
cp_beacon_update_beacon_data (ctx, &beacon, true);
- bsu_update (&beacon, BSU_UPDATE_STA_TYPE_CCO);
+ bsu_update (ctx->bsu, &beacon, BSU_UPDATE_STA_TYPE_CCO);
}
void
@@ -614,7 +615,7 @@ cp_beacon_poweron_init (cp_t *ctx)
ctx->beacon.last_countdown_date = phy_date ();
/* Generate the beacon and send. */
cp_beacon_fill (ctx, &beacon);
- bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
+ bsu_update (ctx->bsu, &beacon, BSU_UPDATE_STA_TYPE_STA);
GPIO_TOGGLE (LED_BEACON_TX_RX);
}
@@ -684,7 +685,7 @@ cp_beacon_process_beacon_central (
if (beacon->bmis.eks.present)
{
if ((beacon->bmis.eks.kbc == BSU_BEACON_EKS_KBC_NEK) &&
- (ctx->mac_config->nek[bsu_nek_index_next ()].eks !=
+ (ctx->mac_config->nek[bsu_nek_index_next (INVALID_PTR)].eks !=
beacon->bmis.eks.new_eks))
{
/* POST the FSM event. */
@@ -700,7 +701,7 @@ cp_beacon_process_beacon_central (
cp_beacon_sta_compute_schedules (ctx, beacon);
bsu_beacon_bmi_discover_info_t discover;
cp_beacon_fill_discover_info (ctx, &discover);
- bsu_update_discover_info (&discover);
+ bsu_update_discover_info (ctx->bsu, &discover);
/** Program the timer. */
cp_beacon_reconfigure_timer (ctx, false);
}
@@ -881,9 +882,9 @@ cp_beacon_process_tracked_avln (cp_t *ctx, bsu_beacon_t *beacon,
cp_beacon_sta_compute_schedules (ctx, beacon);
bsu_beacon_bmi_discover_info_t discover;
cp_beacon_fill_discover_info (ctx, &discover);
- bsu_update_discover_info (&discover);
- bsu_track_avln (beacon->vf.nid, beacon->params.rx_parameters.snid,
- beacon->vf.stei,
+ bsu_update_discover_info (ctx->bsu, &discover);
+ bsu_track_avln (ctx->bsu, beacon->vf.nid,
+ beacon->params.rx_parameters.snid, beacon->vf.stei,
beacon->bmis.mac_address.present ?
beacon->bmis.mac_address.mac_address : MAC_ZERO);
// Program the timer.
@@ -901,7 +902,7 @@ cp_beacon_process_untracked_avln (cp_t *ctx)
ctx->beacon.spoc_updated = false;
cp_beacon_clk_sync_call_spoc (ctx, 0);
/* Inform BSU. */
- bsu_untrack_avln ();
+ bsu_untrack_avln (ctx->bsu);
}
/**
@@ -921,7 +922,7 @@ cp_beacon_beacon_not_received (cp_t *ctx)
/* Update the discover info for the BSU. */
bsu_beacon_bmi_discover_info_t discover;
cp_beacon_fill_discover_info (ctx, &discover);
- bsu_update_discover_info (&discover);
+ bsu_update_discover_info (ctx->bsu, &discover);
// Program the timer.
cp_beacon_reconfigure_timer (ctx, false);
}
@@ -942,10 +943,10 @@ cp_beacon_change_nek (cp_t *ctx, uint eks, cp_key_t nek, bool now)
dbg_assert (ctx->mac_config);
if (now)
- index = bsu_nek_index_current ();
+ index = bsu_nek_index_current (ctx->bsu);
else
{
- index = bsu_nek_index_next ();
+ index = bsu_nek_index_next (ctx->bsu);
ctx->beacon.eks.kccd = CP_BEACON_COUNTDOWN_EKS;
ctx->beacon.eks.kbc = BSU_BEACON_EKS_KBC_NEK;
ctx->beacon.eks.new_eks = eks;
diff --git a/cesar/cp/beacon/test/override-scenario/cp/inc/context.h b/cesar/cp/beacon/test/override-scenario/cp/inc/context.h
index 1a3636145e..3fd3d33850 100644
--- a/cesar/cp/beacon/test/override-scenario/cp/inc/context.h
+++ b/cesar/cp/beacon/test/override-scenario/cp/inc/context.h
@@ -48,6 +48,7 @@ struct cp_t
mac_config_t *mac_config;
bsu_aclf_t *bsu_aclf;
pbproc_t *pbproc;
+ void *bsu;
};
#endif /* overide_cp_inc_context_h */
diff --git a/cesar/cp/beacon/test/override/cp/inc/context.h b/cesar/cp/beacon/test/override/cp/inc/context.h
index ae53f6ed72..c6055bf6f7 100644
--- a/cesar/cp/beacon/test/override/cp/inc/context.h
+++ b/cesar/cp/beacon/test/override/cp/inc/context.h
@@ -37,6 +37,7 @@
#include "mac/common/config.h"
#include "mac/sar/sar.h"
#include "bsu/beacon/beacon.h"
+#include "bsu/bsu.h"
struct cp_t
{
@@ -55,6 +56,7 @@ struct cp_t
mac_config_t *mac_config;
sar_t *sar;
lib_rnd_t rnd;
+ bsu_t *bsu;
bsu_aclf_t *bsu_aclf;
pbproc_t *pbproc;
};
diff --git a/cesar/cp/beacon/test/src/beacon.c b/cesar/cp/beacon/test/src/beacon.c
index 8816c4cb2f..d2b620fbc7 100644
--- a/cesar/cp/beacon/test/src/beacon.c
+++ b/cesar/cp/beacon/test/src/beacon.c
@@ -1150,8 +1150,9 @@ test_case_beacon_eks_change_sta (test_t test)
beacon->bmis.eks.new_eks = MAC_EKS_MIN + 1;
mac_eks_t ref_eks_current = MAC_EKS_MIN + 2;
mac_eks_t ref_eks_next = MAC_EKS_MIN + 3;
- mac_config.nek[bsu_nek_index_current ()].eks = ref_eks_current;
- mac_config.nek[bsu_nek_index_next ()].eks = ref_eks_next;
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks =
+ ref_eks_current;
+ mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks = ref_eks_next;
/** Check default values. */
test_fail_unless (cp.beacon.eks.kccd == 0);
test_fail_unless (cp.beacon.eks.kbc == BSU_BEACON_EKS_KBC_NEK);
@@ -1162,9 +1163,10 @@ test_case_beacon_eks_change_sta (test_t test)
test_fail_unless (cp.beacon.eks.kccd == 2);
test_fail_unless (cp.beacon.eks.kbc == BSU_BEACON_EKS_KBC_NEK);
test_fail_unless (cp.beacon.eks.new_eks == MAC_EKS_MIN + 1);
- test_fail_unless (mac_config.nek[bsu_nek_index_current ()].eks ==
- ref_eks_current);
- test_fail_unless (mac_config.nek[bsu_nek_index_next ()].eks ==
+ test_fail_unless (
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks ==
+ ref_eks_current);
+ test_fail_unless (mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks ==
ref_eks_next);
/* Create the beacon. */
beacon = test_new_beacon ();
@@ -1177,9 +1179,10 @@ test_case_beacon_eks_change_sta (test_t test)
test_fail_unless (cp.beacon.eks.kccd == 1);
test_fail_unless (cp.beacon.eks.kbc == BSU_BEACON_EKS_KBC_NEK);
test_fail_unless (cp.beacon.eks.new_eks == MAC_EKS_MIN + 1);
- test_fail_unless (mac_config.nek[bsu_nek_index_current ()].eks ==
+ test_fail_unless (
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks ==
ref_eks_current);
- test_fail_unless (mac_config.nek[bsu_nek_index_next ()].eks ==
+ test_fail_unless (mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks ==
ref_eks_next);
/* Create the beacon. */
beacon = test_new_beacon ();
@@ -1193,9 +1196,10 @@ test_case_beacon_eks_change_sta (test_t test)
test_fail_unless (cp.beacon.eks.kccd == 0);
test_fail_unless (cp.beacon.eks.kbc == BSU_BEACON_EKS_KBC_NB);
test_fail_unless (cp.beacon.eks.new_eks == MAC_EKS_MIN + 1);
- test_fail_unless (mac_config.nek[bsu_nek_index_current ()].eks ==
+ test_fail_unless (
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks ==
ref_eks_current);
- test_fail_unless (mac_config.nek[bsu_nek_index_next ()].eks ==
+ test_fail_unless (mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks ==
MAC_EKS_CLEAR);
cp_beacon_uninit (&cp);
cp_sta_mgr_uninit (&cp);
diff --git a/cesar/cp/beacon/test/src/beacon_scenario.c b/cesar/cp/beacon/test/src/beacon_scenario.c
index 586acdc191..ae5c223fc3 100644
--- a/cesar/cp/beacon/test/src/beacon_scenario.c
+++ b/cesar/cp/beacon/test/src/beacon_scenario.c
@@ -41,8 +41,8 @@ beacon_test_case (test_t test)
mac_eks_t ref_eks_current = MAC_EKS_MIN + 2;
mac_eks_t ref_eks_next = MAC_EKS_MIN + 3;
- mac_config.nek[bsu_nek_index_current ()].eks = ref_eks_current;
- mac_config.nek[bsu_nek_index_next ()].eks = ref_eks_next;
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks = ref_eks_current;
+ mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks = ref_eks_next;
test_case_begin (test, "get_and_process_beacon");
@@ -136,9 +136,8 @@ beacon_test_case (test_t test)
beacon->bmis.mac_address.present = false;
beacon->params.direction = BSU_BEACON_DIRECTION_FROM_PLC;
cp_beacon_receive (&cp, beacon);
- mac_config.nek[bsu_nek_index_next ()].eks = MAC_EKS_CLEAR;
+ mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks = MAC_EKS_CLEAR;
cp.beacon.countdown_limit_date = 0;
-
test_begin (test, "next eks is invalid")
{
scenario_entry_t entries[] =
@@ -160,9 +159,9 @@ beacon_test_case (test_t test)
beacon->params.rx_parameters.snid = 1;
beacon->bmis.mac_address.present = false;
cp.beacon.countdown_limit_date = 0;
- mac_config.nek[bsu_nek_index_next ()].eks =
- mac_config.nek[bsu_nek_index_current ()].eks;
- mac_config.nek[bsu_nek_index_current ()].eks = MAC_EKS_CLEAR;
+ mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks =
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks;
+ mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks = MAC_EKS_CLEAR;
beacon->params.direction = BSU_BEACON_DIRECTION_FROM_PLC;
cp_beacon_receive (&cp, beacon);
@@ -180,7 +179,7 @@ beacon_test_case (test_t test)
test_end;
/* Test the countdown elapsed and a nek was received */
- mac_config.nek[bsu_nek_index_next ()].eks = MAC_EKS_MIN;
+ mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks = MAC_EKS_MIN;
cp.beacon.eks.kccd = 1;
cp.beacon.countdown_limit_date = 0;
beacon = (bsu_beacon_t *) blk_alloc ();
diff --git a/cesar/cp/beacon/test/src/bsu_stub.c b/cesar/cp/beacon/test/src/bsu_stub.c
index 32ae9ee6e7..8d2753a8e9 100644
--- a/cesar/cp/beacon/test/src/bsu_stub.c
+++ b/cesar/cp/beacon/test/src/bsu_stub.c
@@ -11,11 +11,7 @@
#include "common/std.h"
#include "bsu/beacon/beacon.h"
#include "bsu/aclf/aclf.h"
-
-void
-bsu_update (bsu_beacon_t *beacon, bool sta)
-{
-}
+#include "bsu/bsu.h"
void
bsu_aclf_beacon_period_start_date (bsu_aclf_t *ctx, u32 *bpsd, uint nb)
@@ -48,17 +44,16 @@ bsu_aclf_beacon_period_atu (bsu_aclf_t *ctx)
void
-bsu_track_avln (u64 nid, u16 snid, u8 tei, mac_coexistence_mode_t hm)
+bsu_update (bsu_t *ctx, bsu_beacon_t *beacon, bsu_update_sta_type_t sta)
{
}
void
-bsu_update_discover_info (bsu_beacon_bmi_discover_info_t *discover)
+bsu_update_discover_info (bsu_t *ctx, bsu_beacon_bmi_discover_info_t *discover)
{
}
void
-bsu_update_nid (u64 nid)
+bsu_update_nid (bsu_t *ctx, u64 nid)
{
}
-
diff --git a/cesar/cp/beacon/test/src/bsu_stub_scenario.c b/cesar/cp/beacon/test/src/bsu_stub_scenario.c
index 081dbd6fbe..ff8db73bc6 100644
--- a/cesar/cp/beacon/test/src/bsu_stub_scenario.c
+++ b/cesar/cp/beacon/test/src/bsu_stub_scenario.c
@@ -11,11 +11,7 @@
#include "common/std.h"
#include "bsu/beacon/beacon.h"
#include "bsu/aclf/aclf.h"
-
-void
-bsu_update (bsu_beacon_t *beacon, bool sta)
-{
-}
+#include "bsu/bsu.h"
void
bsu_aclf_beacon_period_start_date (bsu_aclf_t *ctx, u32 *bpsd, uint nb)
@@ -46,19 +42,14 @@ bsu_aclf_beacon_period_atu (bsu_aclf_t *ctx)
return MAC_TCK_TO_ATU (BSU_ACLF_BP_60HZ_TCK);
}
-
-void
-bsu_track_avln (u64 nid, u16 snid, u8 tei, mac_coexistence_mode_t hm)
-{
-}
-
void
-bsu_update_discover_info (bsu_beacon_bmi_discover_info_t *discover)
+bsu_update_discover_info (
+ bsu_t *ctx, bsu_beacon_bmi_discover_info_t *discover)
{
}
void
-bsu_update_nid (u64 nid)
+bsu_update_nid (bsu_t *ctx, u64 nid)
{
}
diff --git a/cesar/cp/cco/action/src/cco_action.c b/cesar/cp/cco/action/src/cco_action.c
index 02e0c5f198..f1452f95f1 100644
--- a/cesar/cp/cco/action/src/cco_action.c
+++ b/cesar/cp/cco/action/src/cco_action.c
@@ -893,7 +893,7 @@ cp_cco_action_cco__cm_get_key_req_pid0 (cp_t *ctx, cp_mme_rx_t * get_key_req)
if (req.key_type == CP_MSG_KEY_NEK)
{
uint i;
- uint index = bsu_nek_index_current ();
+ uint index = bsu_nek_index_current (ctx->bsu);
cnf.eks = ctx->mac_config->nek[index].eks;
for (i = 0; i < COUNT (ctx->mac_config->nek[0].nek_enc); i++)
cnf.key.key[i] =
@@ -947,7 +947,7 @@ cp_cco_action_cco__cm_get_key_req_pid1 (cp_t *ctx, cp_mme_rx_t * get_key_req)
cnf.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
uint i;
- uint index = bsu_nek_index_next ();
+ uint index = bsu_nek_index_next (ctx->bsu);
cnf.eks = ctx->mac_config->nek[index].eks;
for (i = 0; i < COUNT (ctx->mac_config->nek[0].nek_enc); i++)
cnf.key.key[i] =
diff --git a/cesar/cp/cco/action/test/overide/cp/inc/context.h b/cesar/cp/cco/action/test/overide/cp/inc/context.h
index 4ce3ff5d07..573048df09 100644
--- a/cesar/cp/cco/action/test/overide/cp/inc/context.h
+++ b/cesar/cp/cco/action/test/overide/cp/inc/context.h
@@ -72,6 +72,7 @@ struct cp_t
pbproc_t *pbproc;
struct cp_cco_region_t region;
struct cp_cco_bw_t bw;
+ bsu_t *bsu;
/** Handover context. */
struct cp_handover_t handover;
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 4692e8ffca..fb89c6bdd3 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
@@ -71,6 +71,7 @@ struct cp_t
struct cp_handover_t handover;
struct cp_cco_region_t region;
struct cp_cco_bw_t bw;
+ bsu_t *bsu;
#if CONFIG_TRACE
trace_buffer_t trace;
diff --git a/cesar/cp/cco/action/test/utest/src/assoc.c b/cesar/cp/cco/action/test/utest/src/assoc.c
index 28f1e5e77d..08dff2dbbb 100644
--- a/cesar/cp/cco/action/test/utest/src/assoc.c
+++ b/cesar/cp/cco/action/test/utest/src/assoc.c
@@ -107,7 +107,7 @@ assoc_test_case_cco (test_t t)
slab_release (sta);
/* Receive an Get key request from the associated STA. */
mac_eks_t eks = MAC_EKS_MIN + 1;
- ctx.mac_config.nek[bsu_nek_index_current ()].eks = eks;
+ ctx.mac_config.nek[bsu_nek_index_current (INVALID_PTR)].eks = eks;
scenario_entry_t auth [] = {
/* Refuse access - wrong TEI. */
SCENARIO_ACTION (cco__cm_get_key_req_pid0,
@@ -276,7 +276,7 @@ assoc_test_case_nek_request (test_t t)
cp_mme_peer_t peer = CP_MME_PEER (sta_mac, sta_tei);
mac_eks_t eks = MAC_EKS_MIN + 1;
- ctx.mac_config.nek[bsu_nek_index_next ()].eks = eks;
+ ctx.mac_config.nek[bsu_nek_index_next (INVALID_PTR)].eks = eks;
test_case_begin (t, "CCO receive a nek request");
test_begin (t, "request ok")
diff --git a/cesar/cp/cl_interf/test/override/cp/inc/context.h b/cesar/cp/cl_interf/test/override/cp/inc/context.h
index 48c705bd94..ba949c05d3 100644
--- a/cesar/cp/cl_interf/test/override/cp/inc/context.h
+++ b/cesar/cp/cl_interf/test/override/cp/inc/context.h
@@ -43,6 +43,7 @@ struct cp_t
mac_config_t *mac_config;
sar_t *sar;
lib_rnd_t rnd;
+ void *bsu;
};
#endif /* overide_cp_inc_context_h */
diff --git a/cesar/cp/cp.h b/cesar/cp/cp.h
index 6065515789..d20fb5504d 100644
--- a/cesar/cp/cp.h
+++ b/cesar/cp/cp.h
@@ -24,11 +24,14 @@
#include "ce/rx/rx.h"
#include "bsu/beacon/beacon.h"
#include "bsu/aclf/aclf.h"
+#include "bsu/bsu.h"
BEGIN_DECLS
/**
* Initialise the Control plane.
+ * \param bsu the bsu context.
+ * \param aclf the bsu aclf context.
* \param mac_config Mac configuration context.
* \param interface Interface context.
* \param hal_timer the HAL timer context.
@@ -41,8 +44,8 @@ BEGIN_DECLS
*
*/
cp_t *
-cp_init (bsu_aclf_t* aclf, mac_config_t * mac_config, interface_t * interface,
- hal_timer_t *hal_timer, pbproc_t *pbproc,
+cp_init (bsu_t *bsu, bsu_aclf_t* aclf, mac_config_t * mac_config,
+ interface_t * interface, hal_timer_t *hal_timer, pbproc_t *pbproc,
mac_store_t *mac_store, sar_t *sar, cl_t *cl, ce_rx_t *ce_rx,
u32 seed);
diff --git a/cesar/cp/inc/context.h b/cesar/cp/inc/context.h
index 087f02da22..828bee4b9e 100644
--- a/cesar/cp/inc/context.h
+++ b/cesar/cp/inc/context.h
@@ -162,6 +162,9 @@ struct cp_t
/** Context of the CE in RX. */
ce_rx_t *ce_rx;
+ /** Context of the bsu. */
+ bsu_t *bsu;
+
/** Context of the aclf. */
bsu_aclf_t *bsu_aclf;
};
diff --git a/cesar/cp/msg/test/overide/cp/inc/context.h b/cesar/cp/msg/test/overide/cp/inc/context.h
index 9fd6e43a2a..480019b7f4 100644
--- a/cesar/cp/msg/test/overide/cp/inc/context.h
+++ b/cesar/cp/msg/test/overide/cp/inc/context.h
@@ -42,6 +42,9 @@ struct cp_t
/** Convergence layer context. */
cl_t *cl;
+ /** BSU. */
+ bsu_t *bsu;
+
/** BSU aclf. */
bsu_aclf_t *bsu_aclf;
diff --git a/cesar/cp/msg/test/src/misc_stub.c b/cesar/cp/msg/test/src/misc_stub.c
index 0b65f653d9..839d78cb24 100644
--- a/cesar/cp/msg/test/src/misc_stub.c
+++ b/cesar/cp/msg/test/src/misc_stub.c
@@ -39,6 +39,6 @@ bsu_aclf_beacon_period_tck (bsu_aclf_t *ctx)
}
void
-bsu_update_nid (u64 nid)
+bsu_update_nid (bsu_t *ctx, u64 nid)
{
}
diff --git a/cesar/cp/src/cp.c b/cesar/cp/src/cp.c
index 43a1a7e81c..372bbdeac3 100644
--- a/cesar/cp/src/cp.c
+++ b/cesar/cp/src/cp.c
@@ -35,10 +35,10 @@ static cp_t cp_global;
*
*/
cp_t *
-cp_init (bsu_aclf_t* aclf, mac_config_t * mac_config, interface_t * interface,
- hal_timer_t *hal_timer, pbproc_t *pbproc,
- mac_store_t *mac_store, sar_t *sar, cl_t *cl,
- ce_rx_t *ce_rx, u32 seed)
+cp_init (bsu_t *bsu, bsu_aclf_t* aclf, mac_config_t * mac_config,
+ interface_t * interface, hal_timer_t *hal_timer, pbproc_t *pbproc,
+ mac_store_t *mac_store, sar_t *sar, cl_t *cl, ce_rx_t *ce_rx,
+ u32 seed)
{
dbg_assert (mac_config);
dbg_assert (interface);
@@ -58,6 +58,7 @@ cp_init (bsu_aclf_t* aclf, mac_config_t * mac_config, interface_t * interface,
cp_global.sar = sar;
cp_global.cl = cl;
cp_global.ce_rx = ce_rx;
+ cp_global.bsu = bsu;
cp_global.bsu_aclf = aclf;
/* Initialise traces. */
diff --git a/cesar/cp/sta/action/src/assoc.c b/cesar/cp/sta/action/src/assoc.c
index 6639a15d8c..ea00bb4feb 100644
--- a/cesar/cp/sta/action/src/assoc.c
+++ b/cesar/cp/sta/action/src/assoc.c
@@ -795,5 +795,5 @@ cp_sta_action_unassoc__unassoc__enter (cp_t *ctx)
bsu_beacon_t beacon;
/* Update the BSU. */
cp_beacon_fill (ctx, &beacon);
- bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
+ bsu_update (ctx->bsu, &beacon, BSU_UPDATE_STA_TYPE_STA);
}
diff --git a/cesar/cp/sta/action/src/poweron.c b/cesar/cp/sta/action/src/poweron.c
index 0b973b7ea7..7c2982a98b 100644
--- a/cesar/cp/sta/action/src/poweron.c
+++ b/cesar/cp/sta/action/src/poweron.c
@@ -95,7 +95,7 @@ cp_sta_action_poweron__many__to_idle (cp_t *ctx)
pbproc_activate (ctx->pbproc, false);
sar_activate (ctx->sar, false);
sar_cleanup (ctx->sar);
- bsu_activate (false);
+ bsu_activate (ctx->bsu, false);
cp_beacon_deactivate (ctx);
/* Signal station is stopped. */
cp_fsm_trigger_new_event (ctx, bare, stopped);
@@ -105,10 +105,10 @@ void
cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
{
cp_beacon_poweron_init (ctx);
- bsu_power_on (cp_sta_own_data_get_snid (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
* still not initialised.*/
- bsu_activate (true);
+ bsu_activate (ctx->bsu, true);
cp_beacon_reconfigure_timer (ctx, false);
sar_activate (ctx->sar, true);
pbproc_activate (ctx->pbproc, true);
@@ -152,7 +152,7 @@ cp_sta_action_poweron__poweron__enter (cp_t *ctx)
cp_beacon_fill (ctx, &beacon);
/* Act as STA, for BSU corresponds to only hear the central beacon from
* the CCo. */
- bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
+ bsu_update (ctx->bsu, &beacon, BSU_UPDATE_STA_TYPE_STA);
}
void
@@ -254,7 +254,7 @@ cp_sta_action_poweron__usta_usta_joining__enter (cp_t *ctx)
if (MAC_TEI_IS_STA (cp_sta_own_data_get_tei (ctx)))
cp_cco_action_cco__unassoc_stop (ctx);
cp_beacon_fill (ctx, &beacon);
- bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
+ bsu_update (ctx->bsu, &beacon, BSU_UPDATE_STA_TYPE_STA);
}
void
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 0931e1ea60..e3bdca4be8 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
@@ -67,6 +67,7 @@ struct cp_t
struct cp_handover_t handover;
ce_tx_t ce_tx;
ce_rx_t *ce_rx;
+ void *bsu;
#if CONFIG_TRACE
trace_buffer_t trace;
diff --git a/cesar/cp/sta/mgr/src/sta_mgr.c b/cesar/cp/sta/mgr/src/sta_mgr.c
index db87928fda..0ac14e08b0 100644
--- a/cesar/cp/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/src/sta_mgr.c
@@ -343,7 +343,7 @@ cp_sta_mgr_remove_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
if (net == ctx->sta_mgr.our_avln)
cp_sta_mgr_set_our_avln (ctx, NULL);
/* Inform BSU. */
- bsu_avln_remove (nid, snid, cco_mac);
+ bsu_avln_remove (ctx->bsu, nid, snid, cco_mac);
cp_net_uninit (ctx, net);
}
}
diff --git a/cesar/cp/sta/mgr/src/sta_own_data.c b/cesar/cp/sta/mgr/src/sta_own_data.c
index 26d3fb12da..bca8688a1f 100644
--- a/cesar/cp/sta/mgr/src/sta_own_data.c
+++ b/cesar/cp/sta/mgr/src/sta_own_data.c
@@ -524,7 +524,7 @@ cp_sta_own_data_set_nid (cp_t *ctx, cp_nid_t nid)
/* Change the Security Level. */
cp_sta_own_data_set_security_level (ctx, nid >> (HPAV_NID_SIZE_BITS - 2));
- bsu_update_nid (nid);
+ bsu_update_nid (ctx->bsu, nid);
}
/**
diff --git a/cesar/cp/sta/mgr/test/overide/cp/inc/context.h b/cesar/cp/sta/mgr/test/overide/cp/inc/context.h
index 5fc77af264..f5bfbc4840 100644
--- a/cesar/cp/sta/mgr/test/overide/cp/inc/context.h
+++ b/cesar/cp/sta/mgr/test/overide/cp/inc/context.h
@@ -50,6 +50,8 @@ struct cp_t
/** Random context. */
lib_rnd_t rnd;
+
+ void *bsu;
};
#endif /* cp_inc_cp_h */