summaryrefslogtreecommitdiff
path: root/cesar/cp/beacon/src/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/beacon/src/beacon.c')
-rw-r--r--cesar/cp/beacon/src/beacon.c79
1 files changed, 36 insertions, 43 deletions
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index 62799d3ac8..cb62d49b69 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -36,8 +36,8 @@
#include "cp/beacon/inc/ca_sched.h"
#include "cp/beacon/inc/bentry_size.h"
#include "cp/beacon/inc/beacon_discover.h"
-#include "cp/beacon/inc/trace.h"
#include "cp/inc/context.h"
+#include "cp/inc/trace.h"
/**
* Compare the discover info bentry with the previous one.
@@ -80,8 +80,6 @@ cp_beacon_timer_expires (cp_t *ctx)
// Post an event in the FSM beacon timer expires.
cp_fsm_post_new_event (ctx, bare, BEACON_TIMER_EXPIRES);
-
- CP_BEACON_TRACE (TIMER, mac_ntb());
}
/**
@@ -112,8 +110,6 @@ cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon)
// Raise the flag.
cp_sta_core_signal_recv_beacon_event (ctx);
-
- CP_BEACON_TRACE (BEACON_RECV, mac_ntb());
}
/**
@@ -443,7 +439,7 @@ cp_beacon_compute_ca_schedules (cp_t *ctx,
ctx->beacon.ca_schedule_index = 0;
}
- CP_BEACON_TRACE (SCHEDULES, mac_ntb(), beacon_period[0].start_date,
+ CP_TRACE (BEACON_SCHEDULES, mac_ntb(), beacon_period[0].start_date,
beacon_period[1].start_date,
beacon_period[2].start_date,
ctx->mac_config->ntb_offset_tck);
@@ -697,7 +693,7 @@ cp_beacon_sta_send_discover_beacon (cp_t *ctx, cp_beacon_unpack_t *unpack)
cp_beacon_send_beacon (ctx, beacon, CP_BEACON_DISCOVER_BEACON,
cp_sta_own_data_get_mac_address (ctx));
- CP_BEACON_TRACE (BEACON_SEND, mac_ntb(), CP_BEACON_DISCOVER_BEACON);
+ CP_TRACE (BEACON_BEACON_SEND, mac_ntb(), CP_BEACON_DISCOVER_BEACON);
}
/**
@@ -794,8 +790,6 @@ cp_beacon_init (cp_t *ctx)
interface_callback_beacon_init (ctx->interface,
(interface_beacon_add_cb_t)cp_beacon_receive,
ctx);
-
- cp_beacon_trace_init (ctx);
}
/**
@@ -826,8 +820,6 @@ cp_beacon_uninit (cp_t *ctx)
cp_beacon_common_uninit (&ctx->beacon.common[i], ctx);
cp_beacon_discover_uninit (&ctx->beacon.discover);
-
- cp_beacon_trace_uninit (ctx);
}
void
@@ -857,8 +849,8 @@ cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, true));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
- cp_pwl_get_next_timer_date (ctx, true));
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
+ cp_pwl_get_next_timer_date (ctx, true));
common->nb_beacon_sent ++;
beacon_real = cp_beacon_unpack__pack (&beacon);
@@ -916,7 +908,7 @@ cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type)
cp_beacon_ca_schedule_uninit (&schedules);
cp_beacon_unpack_uninit (&beacon);
- CP_BEACON_TRACE (BEACON_SEND, mac_ntb(), beacon_type);
+ CP_TRACE (BEACON_BEACON_SEND, mac_ntb(), beacon_type);
}
/**
@@ -984,10 +976,10 @@ cp_beacon_create_default_schedules (cp_t *ctx)
beacon_period[0].schedule_index = CA_SCHEDULE_NB - 1;
}
- CP_BEACON_TRACE (SCHEDULES_DEF, mac_ntb(), beacon_period[0].start_date,
- beacon_period[1].start_date,
- beacon_period[2].start_date,
- ctx->mac_config->ntb_offset_tck);
+ CP_TRACE (BEACON_SCHEDULES_DEF, mac_ntb(), beacon_period[0].start_date,
+ beacon_period[1].start_date,
+ beacon_period[2].start_date,
+ ctx->mac_config->ntb_offset_tck);
// Provide the beacon period to the CA.
ca_alloc_update_beacon_periods (ctx->ca, beacon_period,
@@ -997,8 +989,8 @@ cp_beacon_create_default_schedules (cp_t *ctx)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date(ctx, true));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
- cp_pwl_get_next_timer_date(ctx, true));
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
+ cp_pwl_get_next_timer_date(ctx, true));
if (ctx->beacon.ca_sched_first_shoot)
ctx->beacon.ca_sched_first_shoot = false;
@@ -1039,7 +1031,7 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
if (((pb_t *) beacon)->phy_pb.pb_rx.pb_measurement.crc_error)
{
blk_release_desc ((blk_t *) beacon);
- CP_BEACON_TRACE (CRC_ERROR, beacon);
+ CP_TRACE (BEACON_CRC_ERROR, mac_ntb(), beacon);
return;
}
@@ -1047,13 +1039,14 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
if (!cp_beacon_unpack__unpack (&unpack, beacon))
{
/* The beacon contains some strange values. */
- CP_BEACON_TRACE (UNPACK_ERROR,
- unpack.variant_fields.nid_msb,
- unpack.variant_fields.nid_lsb,
- beacon->payload->fc.snid,
- unpack.variant_fields.stei,
- unpack.variant_fields.bt,
- beacon->payload->fc.bts);
+ CP_TRACE (BEACON_UNPACK_ERROR,
+ mac_ntb(),
+ unpack.variant_fields.nid_msb,
+ unpack.variant_fields.nid_lsb,
+ beacon->payload->fc.snid,
+ unpack.variant_fields.stei,
+ unpack.variant_fields.bt,
+ beacon->payload->fc.bts);
cp_beacon_unpack_uninit (&unpack);
blk_release_desc ((blk_t *) beacon);
@@ -1063,13 +1056,14 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
nid = ((u64) unpack.variant_fields.nid_msb << 32)
| unpack.variant_fields.nid_lsb;
- CP_BEACON_TRACE (BEACON_PROCESS,
- unpack.variant_fields.nid_msb,
- unpack.variant_fields.nid_lsb,
- beacon->payload->fc.snid,
- unpack.variant_fields.stei,
- unpack.variant_fields.bt,
- beacon->payload->fc.bts);
+ CP_TRACE (BEACON_BEACON_PROCESS,
+ mac_ntb(),
+ unpack.variant_fields.nid_msb,
+ unpack.variant_fields.nid_lsb,
+ beacon->payload->fc.snid,
+ unpack.variant_fields.stei,
+ unpack.variant_fields.bt,
+ beacon->payload->fc.bts);
// Add the AVLN to the net list.
net = cp_sta_mgr_add_avln (ctx, beacon->payload->fc.snid, nid);
@@ -1124,8 +1118,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, false));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
- cp_pwl_get_next_timer_date(ctx, false));
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
+ cp_pwl_get_next_timer_date(ctx, false));
}
/* Our station is not associated. */
else if (!cp_sta_own_data_get_tei (ctx)
@@ -1142,8 +1136,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, false));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
- cp_pwl_get_next_timer_date(ctx, false));
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
+ cp_pwl_get_next_timer_date(ctx, false));
}
// Raise the event in the FSM for station action.
@@ -1214,7 +1208,7 @@ cp_beacon_process_tracked_avln (cp_t *ctx, cp_beacon_desc_t *beacon,
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, false));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
cp_pwl_get_next_timer_date(ctx, false));
}
@@ -1233,7 +1227,6 @@ cp_beacon_beacon_not_received (cp_t *ctx)
cp_beacon_ca_schedules_t ca_sched;
dbg_assert (ctx);
- CP_BEACON_TRACE (BEACON_NOT_RECV, mac_ntb());
cp_beacon_countdowns (ctx);
cp_fsm_post_new_event (ctx, bare, BEACON_NOT_RECEIVED);
@@ -1267,7 +1260,7 @@ cp_beacon_beacon_not_received (cp_t *ctx)
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, false));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
mac_ntb() + cp_pwl_get_beacon_period_ntb (ctx));
}
@@ -1395,7 +1388,7 @@ cp_beacon_reconfigure_timer (cp_t *ctx)
hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
cp_pwl_get_next_timer_date (ctx, cco));
- CP_BEACON_TRACE (TIMER_PRGM, mac_ntb(),
+ CP_TRACE (BEACON_TIMER_PRGM, mac_ntb(),
cp_pwl_get_next_timer_date (ctx, cco));
}