summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/src/trace.c
blob: d3274641ffe567339c9e97a281a3c7f506b6b82b (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
76
77
78
79
80
81
82
83
84
85
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/src/trace.c
 * \brief   Define PHY trace events.
 * \ingroup hal_phy
 */
#include "common/std.h"

#include "inc/context.h"

#define PHY_TRACE_EVENT(id, format, args...) \
    TRACE_EVENT (PHY_TRACE_ ## id, format, ## args)

void
phy_trace_init (phy_t *ctx)
{
    static trace_namespace_t namespace;
    static const trace_event_id_t event_ids[] =
    {
        PHY_TRACE_EVENT (INIT, "init"),
        PHY_TRACE_EVENT (SET_TONEMASK, "set tonemask carrier_nb=%u"),
        PHY_TRACE_EVENT (UNINIT, "uninit"),
        PHY_TRACE_EVENT (RESET, "reset"),
        PHY_TRACE_EVENT (CLOCK_SET_NUMERATOR,
                         "clock set numerator %u"),
        PHY_TRACE_EVENT (SET_TONEMAP, "set tonemap %u, %x"),
        PHY_TRACE_EVENT (TX_FC10, "tx fc10 %x"),
        PHY_TRACE_EVENT (TX_PARAM,
                         "tx param mode=%u short=%b mod=%u "
                         "fecrate=%u pb_size=%u gil=%u tm=%u"),
        PHY_TRACE_EVENT (TX_FRAME,
                         "tx frame date=%x want_conf=%b "
                         "stop_on_prp_lost=%b fc=%x"),
        PHY_TRACE_EVENT (RX_PARAM, "rx param mode=%u"),
        PHY_TRACE_EVENT (RX_ACTIVATE,
                         "rx activate date=%x flag=%b"),
        PHY_TRACE_EVENT (RX_ACTIVATE_NOW,
                         "rx activate now flag=%b"),
        PHY_TRACE_EVENT (RX_PREPARE,
                         "rx prepare short=%b mod=%u fecrate=%u "
                         "pb_size=%u gil=%u tm=%u symb_nb=%u"),
        PHY_TRACE_EVENT (EXTRA_TIMER_PROGRAM,
                         "extra timer program %x"),
        PHY_TRACE_EVENT (EXTRA_TIMER_CANCEL, "extra timer cancel"),
        PHY_TRACE_EVENT (ACCESS_CONF_CB, "access conf cb", TIMESTAMP),
        PHY_TRACE_EVENT (RX_FC_CB, "rx fc cb rx_date=%x", TIMESTAMP),
        PHY_TRACE_EVENT (TX_FALSE_ALARM_CB, "tx false alarm cb", TIMESTAMP),
        PHY_TRACE_EVENT (DEFERRED_CB, "deferred cb", TIMESTAMP),
        PHY_TRACE_EVENT (EXTRA_TIMER_CB, "extra timer cb", TIMESTAMP),

        PHY_TRACE_EVENT (ACCESS_BACKOFF_START,
                         "access backoff start date=%x cap=%u"),
        PHY_TRACE_EVENT (ACCESS_BACKOFF_UPDATE,
                         "access backoff update cap=%u"),
        PHY_TRACE_EVENT (ACCESS_TIMER_PROGRAM,
                         "access timer program date=%x"),
        PHY_TRACE_EVENT (ACCESS_TIMER_CANCEL, "access timer cancel"),
        PHY_TRACE_EVENT (ACCESS_CB, "access cb", TIMESTAMP),

        PHY_TRACE_EVENT (PBDMA_START, "pbdma start bypass_aes=%b "
                         "nb_total=%u nb_ready=%u nb_pb_it=%u"),
        PHY_TRACE_EVENT (PBDMA_UPDATE, "pbdma update nb_ready=%u "
                         "nb_pb_it=%u"),
        PHY_TRACE_EVENT (PBDMA_START_CHANDATA,
                         "pbdma start chandata"),
        PHY_TRACE_EVENT (PBDMA_CB, "pbdma cb %x", TIMESTAMP),
    };
    dbg_assert (ctx);
    trace_namespace_init (&namespace, event_ids, COUNT (event_ids));
    trace_buffer_add (&ctx->trace, "phy", 8, 16, true, &namespace);
}

void
phy_trace_uninit (phy_t *ctx)
{
    dbg_assert (ctx);
    trace_buffer_remove (&ctx->trace);
}