summaryrefslogtreecommitdiff
path: root/cesar/ce/debug/gpio/gpio.h
blob: 9de23312647de6cc60e0dbc680024272293cbe2e (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef ce_debug_gpio_gpio_h
#define ce_debug_gpio_gpio_h
/* Cesar project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ce/debug/gpio/gpio.h
 * \brief   Debug the CE using GPIO
 * \ingroup ce
 *
 * This module is to help debugging the CE using the GPIOs. It will provide
 * some kind of traces using the GPIOs. This will probably require the
 * logical analyser.
 */
#include "common/module.h"

#if MODULE_INCLUDED (ce_debug_gpio)
# include "config/ce/debug/gpio.h"
# define CE_DEBUG_GPIO_ENABLED CONFIG_CE_DEBUG_GPIO
#else
# define CE_DEBUG_GPIO_ENABLED 0
#endif

/**
 * The list of events to "trace".
 */
typedef enum ce_debug_gpio_event_t
{
    /**
     * SAR call back called for something.
     * Call this event if you do not add the measure into the mailbox for the
     * CE.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_SAR_CB,
    /**
     * Empty event for measure.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_NONE,
    /**
     * Measure is based on sounds (without sound complete flag).
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_SOUND,
    /**
     * Measure is based on sounds (with sound complete flag).
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_SOUND_COMPLETE,
    /**
     * Measure is not based on sounds, PB error rate is low, BER sliding means
     * are not too low.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_DATA_NORMAL,
    /**
     * Measure is not based on sounds and PB error rate is high.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_DATA_HIGH_PB_ERROR_RATE,
    /**
     * Measure is not based on sounds and both BER sliding means are low.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_MEASURE_DATA_BER_LOW,
    /**
     * Bit loading FSM is in state IDLE.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_FSM_IDLE,
    /**
     * Bit loading FSM is in state INITIAL.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_FSM_INITIAL,
    /**
     * Bit loading FSM is in state TRACKING.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_FSM_TRACKING,
    /**
     * Bit loading is working (tone map computation is ongoing).
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_WORKING,
    /**
     * ROBO is better than computed tone map.
     */
    CE_DEBUG_GPIO_EVENT_CE_RX_BL_ROBO_BETTER,
    /**
     * Default TMI on TX has changed.
     */
    CE_DEBUG_GPIO_EVENT_CE_TX_MME_DEFAULT_TMI_CHANGE,
} ce_debug_gpio_event_t;

BEGIN_DECLS

#if CE_DEBUG_GPIO_ENABLED

/**
 * Init CE debug GPIO module.
 */
void
ce_debug_gpio_init (void);

/**
 * An event is ongoing.
 * \param  event  the event which is occurring
 * \param  enabled  true if the event should be enabled, false otherwise
 */
void
ce_debug_gpio_event (ce_debug_gpio_event_t event, bool enabled);

#else

# define ce_debug_gpio_init() ((void) 0)
# define ce_debug_gpio_event(event, enabled) ((void) 0)

#endif

END_DECLS

#endif /* ce_debug_gpio_gpio_h */