summaryrefslogtreecommitdiff
path: root/test_general/station/src/int_station.c
diff options
context:
space:
mode:
Diffstat (limited to 'test_general/station/src/int_station.c')
-rw-r--r--test_general/station/src/int_station.c68
1 files changed, 59 insertions, 9 deletions
diff --git a/test_general/station/src/int_station.c b/test_general/station/src/int_station.c
index 4e958b04fe..ad038a1972 100644
--- a/test_general/station/src/int_station.c
+++ b/test_general/station/src/int_station.c
@@ -29,6 +29,7 @@
#include "hle/inc/trace.h"
#include "mac/common/ntb.h"
+#include "mac/pbproc/inc/context.h"
int_station_t int_sta_global;
@@ -65,6 +66,20 @@ int_station_t *int_station_init (void)
int_sta_global.hle = hle_init (int_sta_global.cl);
+ int_sta_global.cp.sta = cp_station_init (int_sta_global.mac_store,
+ int_sta_global.cl,
+ int_sta_global.pbproc,
+ int_sta_global.mac_config);
+
+ int_sta_global.cp.secu = cp_secu_init ();
+ int_sta_global.cp.cco = cp_cco_init ();
+
+ int_sta_global.cp.beacon = cp_beacon_init(pbproc_get_phy(int_sta_global.pbproc),
+ int_sta_global.cp.sta, int_sta_global.cp.secu,
+ pbproc_get_ca (int_sta_global.pbproc),
+ int_sta_global.pbproc, int_sta_global.mac_store,
+ int_sta_global.cp.cco);
+
// Create the Thread for the SAR.
cyg_thread_create (9, &sar_process, (cyg_addrword_t) int_sta_global.sar,
"SAR", sar_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
@@ -86,6 +101,7 @@ int_station_t *int_station_init (void)
void int_station_uninit (int_station_t *ctx)
{
tei_node_t *tei_node;
+ uint now;
dbg_assert (ctx);
dbg_assert (ctx->mac_config);
@@ -95,13 +111,25 @@ void int_station_uninit (int_station_t *ctx)
dbg_assert (ctx->cl);
dbg_assert (ctx->hle);
+ dbg_assert (ctx->cp.secu);
+ dbg_assert (ctx->cp.cco);
+ dbg_assert (ctx->cp.sta);
+ dbg_assert (ctx->cp.beacon);
+
pbproc_activate (ctx->pbproc, false);
+ now = mac_ntb();
+ while (now < mac_ntb() + 10000);
pbproc_uninit (ctx->pbproc);
sar_uninit (ctx->sar);
cl_uninit (ctx->cl);
hle_uninit (ctx->hle);
+ cp_secu_uninit (ctx->cp.secu);
+ cp_station_uninit (ctx->cp.sta);
+ cp_cco_uninit (ctx->cp.cco);
+ cp_beacon_uninit(ctx->cp.beacon);
+
blk_release (ctx->mac_config);
while (!list_empty (&ctx->tei_list))
@@ -280,18 +308,21 @@ void int_station_link_remove (int_station_t *ctx, uint type, uint bcast,
*/
void pbproc_sched (cyg_addrword_t int_sta)
{
- create_schedule_csma_only ((int_station_t *) int_sta, 14);
- ((int_station_t *) int_sta)->sched_index ++;
+ while (true)
+ {
+ create_schedule_csma_only ((int_station_t *) int_sta, 14);
+ ((int_station_t *) int_sta)->sched_index ++;
- //create the second schedule.
- create_schedule_csma_only ((int_station_t *) int_sta, 14);
- ((int_station_t *) int_sta)->sched_index ++;
+ //create the second schedule.
+ create_schedule_csma_only ((int_station_t *) int_sta, 14);
+ ((int_station_t *) int_sta)->sched_index ++;
- //create the third schedule.
- create_schedule_csma_only ((int_station_t *) int_sta, 14);
- ((int_station_t *) int_sta)->sched_index ++;
+ //create the third schedule.
+ create_schedule_csma_only ((int_station_t *) int_sta, 14);
+ ((int_station_t *) int_sta)->sched_index ++;
- cyg_thread_delay (50);
+ cyg_thread_delay (50);
+ }
}
/**
@@ -593,3 +624,22 @@ int fc_hle_print_trace (fcall_ctx_t *fcall, fcall_param_t **param,
return true;
}
+/**
+ * Send a central beacon over the PWL.
+ *
+ * \param fcall the fcall context.
+ * \param param the fcall param
+ * \param msg the message
+ * \param data anything
+ */
+int fc_pbproc_print_trace (fcall_ctx_t *fcall, fcall_param_t **param,
+ sci_msg_t **msg, void *data)
+{
+ fcall_param_reset (*param);
+
+ trace_buffer_dbg_dump (&int_sta_global.pbproc->trace);
+
+ return true;
+
+}
+