summaryrefslogtreecommitdiff
path: root/ce/test/maximus/overide/mac/pbproc/pbproc.h
blob: f8d1b976b47c29df74374c617f57383352eeb542 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef overide_pbproc_h
#define overide_pbproc_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    overide/pbproc.h
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "host/station.h"
#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // 'phy_t'
#include "mac/common/mfs.h"
#include "mac/common/pb.h"
#include "mac/ca/ca.h"


struct pbproc_rx_params_t
{
    /** Preamble start NTB. */
    u32 preamble_ntb;
    /** TEI of the transmitter. */
    u8 tei;
    /** Link ID of this MPDU. */
    u8 lid;
    /** Short network identifier. */
    uint snid:4;
    /** Whether this is a multicast frame. */
    bool bcast:1;
    /** Multi-network broadcast flag. */
    bool multi_net_bcast:1;
    /** Network encryption key select. */
    uint eks:4;
    /** Pending PB. */
    uint pending_seg_nb:8;
    /** Bit loading estimate. */
    uint ble:8;
    /** Tone map index. */
    uint tmi_av:5;
    /** Beacon detect flag. */
    bool bdf:1;
    /** Homeplug 1.0.1 detect flag. */
    bool hp10df:1;
    /** Homeplug 1.1 detect flag. */
    bool hp11df:1;
};
typedef struct pbproc_rx_params_t pbproc_rx_params_t;

typedef void (*pbproc_rx_cb_t) (void *user, mfs_t *mfs, mfs_t *mfs_mme,
                                const pbproc_rx_params_t *rx_params,
                                pb_t *pb_first, pb_t *pb_last,
                                uint pb_nb, pb_t *chandata_first);

struct pbproc_t
{
    pbproc_rx_cb_t rx_cb;
    mac_config_t *config;
};
typedef struct pbproc_t pbproc_t;

struct pbproc_rx_beacon_params_t
{
    /** Preamble start NTB. */
    u32 preamble_ntb;
    /** Beacon Time Stamp. */
    u32 bts;
    /** Beacon Transmission Offset. */
    u16 bto[4];
    /** Short network identifier. */
    u8 snid;
};
typedef struct pbproc_rx_beacon_params_t pbproc_rx_beacon_params_t;

typedef void (*pbproc_rx_beacon_cb_t) (void *user, pb_beacon_t *pb,
                                       pbproc_rx_beacon_params_t *params);


BEGIN_DECLS

bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av);

bool phy_access_cb (void *user);

bool phy_access_conf_cb (void *user);

bool phy_pbdma_cb (void *user, u32 status_word);

void phy_deferred_cb (void *user);

bool phy_extra_timer_cb (void *user);

int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data);

int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data);

pbproc_t *
pbproc_init (mac_config_t *config, mac_store_t *store);

void
pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb, pbproc_rx_beacon_cb_t rx_beacon_cb);

void
pbproc_uninit (pbproc_t *ctx);

void
pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *first, pb_t *last,
                          uint nb);

pb_t *
pbproc_mfs_extract_tail (mfs_tx_t *mfs);

void
pbproc_mfs_insert (mfs_tx_t *mfs, pb_t *first, pb_t *last, uint nb, uint cap);

void
pbproc_mfs_provide (mfs_tx_t *mfs, uint nb);

/** set SCF in pbproc ctx */
void
pbproc_scf (void);

void
pbproc_set_config (mac_config_t *config);


bool
ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs);

void
ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs);

END_DECLS

#endif /* overide_pbproc_h */