summaryrefslogtreecommitdiff
path: root/cp/beacon/inc/trace.h
blob: 14fa3d273ed1c09ad8eb379eba1f3752182780cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#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   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */

#include "lib/trace.h"

/** Shortcut for tracing */
#define CP_BEACON_TRACE(id, args...) \
    TRACE_FAST_SHORT (CP_BEACON_TRACE_, &ctx->trace, id, ## args)

#if CONFIG_TRACE

#define CP_BEACON_ID(id, ord, args) \
    CP_BEACON_TRACE_ ## id = TRACE_ID (ord, args)

enum
{
    CP_BEACON_ID (INIT, 1, 1),
    CP_BEACON_ID (UNINIT, 2, 1),
    CP_BEACON_ID (FREQ, 3, 2),
    CP_BEACON_ID (ESTIMATION, 4, 4),
    CP_BEACON_ID (DEFAULT_SCHED, 5, 1),
    CP_BEACON_ID (PWL_PER, 6, 4),
    CP_BEACON_ID (CENTRAL_BEACON_PROCESS, 7, 1),
    CP_BEACON_ID (CENTRAL_BEACON_GENE, 8, 1),
    CP_BEACON_ID (SEND_BEACON, 9, 2),
};

BEGIN_DECLS

/**
 * Initialize the trace buffer
 * \param  ctx  the cl context
 */
void
cp_beacon_trace_init (cp_beacon_t *ctx);

/**
 * Uninitialize the trace buffer
 * \param  ctx  the cl context.
 */
void
cp_beacon_trace_uninit(cp_beacon_t *ctx);

/**
 * Print the trace
 * \param  ctx  the cl context.
 */
void
cp_beacon_trace_print (cp_beacon_t *ctx);

END_DECLS

#else /* !CONFIG_TRACE */

#define cp_beacon_trace_init(ctx) ((void) 0)
#define cp_beacon_trace_uninit(ctx) ((void) 0)
#define cp_beacon_trace_print(ctx) ((void) 0)

#endif /* CONFIG_TRACE */

#endif /* cp_beacon_inc_trace_h */