summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorlaranjeiro2009-06-03 11:03:32 +0000
committerlaranjeiro2009-06-03 11:03:32 +0000
commit160f008ecd1ee18bc5b1cac90bf22ca192727726 (patch)
treeb9ce0f7247985900d733a3fe5b47ea874510af90 /cesar/cp
parent21b56ff7eb81b2ec3a90c7037c770496a320a4e8 (diff)
*cp: (See #388)
* Merge beacon trace to the CP traces. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4735 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/beacon/Module3
-rw-r--r--cesar/cp/beacon/inc/beacon.h9
-rw-r--r--cesar/cp/beacon/inc/trace.h64
-rw-r--r--cesar/cp/beacon/src/beacon.c79
-rw-r--r--cesar/cp/beacon/src/trace.c60
-rw-r--r--cesar/cp/inc/trace.h7
-rw-r--r--cesar/cp/src/trace.c18
7 files changed, 61 insertions, 179 deletions
diff --git a/cesar/cp/beacon/Module b/cesar/cp/beacon/Module
index d3396f2360..f73a20479e 100644
--- a/cesar/cp/beacon/Module
+++ b/cesar/cp/beacon/Module
@@ -1,4 +1 @@
SOURCES:= beacon.c common.c beacon_discover.c unpack.c ca_sched.c
-ifeq ($(CONFIG_TRACE),y)
-SOURCES += trace.c
-endif
diff --git a/cesar/cp/beacon/inc/beacon.h b/cesar/cp/beacon/inc/beacon.h
index 7f60df41f2..ed1b673b0e 100644
--- a/cesar/cp/beacon/inc/beacon.h
+++ b/cesar/cp/beacon/inc/beacon.h
@@ -13,8 +13,6 @@
* \ingroup cp_beacon
*
*/
-
-#include "lib/trace.h"
#include "lib/circular_buffer.h"
// Public ones.
@@ -106,13 +104,6 @@ struct cp_beacon_t
/** Handover in progress structure. */
struct cp_beacon_hoip_t hoip;
-
-#if CONFIG_TRACE
- /**
- * Trace context.
- */
- trace_buffer_t trace;
-#endif
};
typedef struct cp_beacon_t cp_beacon_t;
diff --git a/cesar/cp/beacon/inc/trace.h b/cesar/cp/beacon/inc/trace.h
deleted file mode 100644
index 147fdddaac..0000000000
--- a/cesar/cp/beacon/inc/trace.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef cp_beacon_inc_trace_h
-#define cp_beacon_inc_trace_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/inc/trace.h
- * \brief Beacon module traces.
- * \ingroup cp_beacon
- *
- */
-#include "lib/trace.h"
-#include "cp/cp.h"
-
-/** Shortcut for tracing inside the HLE. */
-#define CP_BEACON_TRACE(id, args...)\
- TRACE_FAST_SHORT(CP_BEACON_TRACE_, &ctx->beacon.trace, id, ## args)
-
-#if CONFIG_TRACE
-
-enum
-{
- CP_BEACON_TRACE_BEACON_NOT_RECV,
- CP_BEACON_TRACE_BEACON_RECV,
- CP_BEACON_TRACE_BEACON_SEND,
- CP_BEACON_TRACE_SCHEDULES,
- CP_BEACON_TRACE_SCHEDULES_DEF,
- CP_BEACON_TRACE_TIMER,
- CP_BEACON_TRACE_TIMER_PRGM,
- CP_BEACON_TRACE_CRC_ERROR,
- CP_BEACON_TRACE_UNPACK_ERROR,
- CP_BEACON_TRACE_BEACON_PROCESS
-};
-
-BEGIN_DECLS
-
-/**
- * Initialize the trace buffer
- * \param ctx the cp_cl_interf context.
- */
-void
-cp_beacon_trace_init (cp_t *ctx);
-
-/**
- * Uninit the trace buffer
- * \param ctx the cp_beacon context
- */
-void
-cp_beacon_trace_uninit (cp_t *ctx);
-
-END_DECLS
-
-#else /* !CONFIG_TRACE */
-
-#define cp_beacon_trace_init(ctx) ((void) 0)
-#define cp_beacon_trace_uninit(ctx) ((void) 0)
-
-#endif /* !CONFIG_TRACE */
-
-#endif /* cp_beacon_inc_trace_h */
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));
}
diff --git a/cesar/cp/beacon/src/trace.c b/cesar/cp/beacon/src/trace.c
deleted file mode 100644
index 0ad1b85a9d..0000000000
--- a/cesar/cp/beacon/src/trace.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/beacon/src/trace.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include "common/std.h"
-#include "cp/beacon/inc/trace.h"
-#include "cp/inc/context.h"
-
-/**
- * Initialize the trace buffer
- * \param ctx the cp context.
- */
-void
-cp_beacon_trace_init (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- static trace_namespace_t namespace;
- static const trace_event_id_t event_ids[] =
- {
- TRACE_EVENT (CP_BEACON_TRACE_BEACON_NOT_RECV, "Not received", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_BEACON_RECV, "Received", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_BEACON_SEND, "SEND Beacon type : %x",
- TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_SCHEDULES, "Schedules : %x %x %x, tick offset : %x", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_SCHEDULES_DEF, "Default Schedules : %x %x %x, tick offset : %x", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_TIMER, "Timer", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_TIMER_PRGM, "Timer prgm : %x", TIMESTAMP),
- TRACE_EVENT (CP_BEACON_TRACE_CRC_ERROR, "CRC Error : %x"),
- TRACE_EVENT (CP_BEACON_TRACE_UNPACK_ERROR, "Error, nid msb : %x, nid lsb : %x, snid : %x, stei : %x, bt : %x, bts : %x"),
- TRACE_EVENT (CP_BEACON_TRACE_BEACON_PROCESS, "Processing, nid msb : %x, nid lsb : %x, snid : %x, stei : %x, bt : %x, bts : %x")
- };
-
- trace_namespace_init (&namespace, event_ids, COUNT (event_ids));
- trace_buffer_add (&ctx->beacon.trace, "cp_beacon", 8, 4, true, &namespace);
-
-}
-
-/**
- * Uninit the trace buffer
- * \param ctx the cp_beacon context
- */
-void
-cp_beacon_trace_uninit (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- trace_buffer_remove (&ctx->beacon.trace);
-}
-
diff --git a/cesar/cp/inc/trace.h b/cesar/cp/inc/trace.h
index 437fd979db..f574993c20 100644
--- a/cesar/cp/inc/trace.h
+++ b/cesar/cp/inc/trace.h
@@ -29,6 +29,13 @@ enum
CP_TRACE_FSM_HANDLE_EVENT,
CP_TRACE_FSM_CHANGE_STATE,
CP_TRACE_MME_ERROR_IND,
+ CP_TRACE_BEACON_BEACON_SEND,
+ CP_TRACE_BEACON_SCHEDULES,
+ CP_TRACE_BEACON_SCHEDULES_DEF,
+ CP_TRACE_BEACON_TIMER_PRGM,
+ CP_TRACE_BEACON_CRC_ERROR,
+ CP_TRACE_BEACON_UNPACK_ERROR,
+ CP_TRACE_BEACON_BEACON_PROCESS
};
BEGIN_DECLS
diff --git a/cesar/cp/src/trace.c b/cesar/cp/src/trace.c
index 6499522659..5e23112914 100644
--- a/cesar/cp/src/trace.c
+++ b/cesar/cp/src/trace.c
@@ -75,6 +75,24 @@ cp_trace_init (cp_t *ctx)
TRACE_EVENT (CP_TRACE_FSM_CHANGE_STATE, "fsm %S => %S"),
TRACE_EVENT (CP_TRACE_MME_ERROR_IND,
"mme error ind tei %d reason %d mmv %d mmtype %d offset %d"),
+ TRACE_EVENT (CP_TRACE_BEACON_BEACON_SEND,
+ "Beacon send, Beacon type : %x", TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_SCHEDULES,
+ "Beacon schedules : %x %x %x, tick offset : %x",
+ TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_SCHEDULES_DEF,
+ "Beacon default schedules : %x %x %x, tick offset : %x",
+ TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_TIMER_PRGM, "Beacon timer prgm : %x",
+ TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_CRC_ERROR, "Beacon CRC Error : %x",
+ TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_UNPACK_ERROR,
+ "Beacon Error, nid msb : %x, nid lsb : %x, snid : %x, stei : %x, bt : %x, bts : %x",
+ TIMESTAMP),
+ TRACE_EVENT (CP_TRACE_BEACON_BEACON_PROCESS,
+ "Beacon processing, nid msb : %x, nid lsb : %x, snid : %x, stei : %x, bt : %x, bts : %x",
+ TIMESTAMP)
};
dbg_assert (ctx);
trace_namespace_init (&namespace, event_ids, COUNT (event_ids));