summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/inc/context.h
blob: df64f4a6ea6ac2fb61ddd9c166ddb9b9c4df76e5 (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
#ifndef hal_phy_inc_context_h
#define hal_phy_inc_context_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/inc/context.h
 * \brief   HAL Phy context.
 * \ingroup hal_phy
 */
#include "hal/phy/phy.h"
#include "hal/phy/inc/trace.h"

#include <cyg/hal/drv_api.h>

/** Phy stats. */
struct phy_stats_t
{
    /** Watchdog expired due to hardware bug. */
    uint watchdog_expired;
    /** RESYS restarted due to hardware bug. */
    uint resys_restarted;
};
typedef struct phy_stats_t phy_stats_t;

/** Phy context. */
struct phy_t
{
#if CONFIG_TRACE
    /** Phy trace. */
    trace_buffer_t trace;
#endif /* !CONFIG_TRACE */
    /** User data passed to any callback. */
    void *user_data;
    /** RX FC event callback. */
    phy_rx_fc_cb_t rx_fc_cb;
    /** ACCESS event callback. */
    phy_access_cb_t access_cb;
    /** ACCESS CONFIRM event callback. */
    phy_access_conf_cb_t access_conf_cb;
    /** PB DMA callback. */
    phy_pbdma_cb_t pbdma_cb;
    /** TX FALSE ALARM callback. */
    phy_tx_false_alarm_cb_t tx_false_alarm_cb;
    /** DSR callback. */
    phy_deferred_cb_t deferred_cb;
    /** User data passed to extra timer callback. */
    void *extra_timer_user_data;
    /** Extra timer callback. */
    phy_extra_timer_cb_t extra_timer_cb;
    /** Interrupt handle. */
    cyg_handle_t interrupt_handle;
    /** Interrupt context. */
    cyg_interrupt interrupt_context;
    /** FC mode for RX. */
    phy_fc_mode_t rx_fc_mode;
    /** FC mode for TX. */
    phy_fc_mode_t tx_fc_mode;
    /** GIL for next TX. */
    phy_gil_t tx_gil;
    /** Guard interval duration table. */
    uint gil_durations_table[PHY_GIL_NB];
    /** Number of symbols for the frame controls. */
    uint fc_symbol_nb[PHY_FC_MODE_NONE];
    /** RESYS guard interval table. */
    uint resys_gil_table[PHY_GIL_NB];
    /** Start PBDMA on RESYS interrupt. */
    bool pbdma_start_on_resys_it;
    /** CAP activation mask. */
    u8 cap_mask;
    /** Whether frequency error is synchronised. */
    bool freq_error_sync;
    /** Phy stats. */
    phy_stats_t stats;
};
/* Forward declaration in hal/phy/forward.h. */

#endif /* hal_phy_inc_context_h */