summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/maximus/dur/inc/maximus_dur.h
blob: 10b3afdfe8d7cce2a931662d83e80ec0504f1b28 (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
#ifndef hal_phy_maximus_dur_inc_maximus_dur_h
#define hal_phy_maximus_dur_inc_maximus_dur_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/maximus/dur/inc/maximus_dur.h
 * \brief   Compute mac frames duration.
 * \ingroup hal_phy_maximus
 */
#include "hal/phy/defs.h"
#include "lib/blk.h"

BEGIN_DECLS

/**
 * Count the number of used carriers.
 * \param  tonemask  tone mask
 * \return  number of carriers
 *
 * This function takes its parameter in the same format as the HAL PHY
 * functions.
 *
 * Call this when the tone mask is changed and cache its return value.
 */
uint
maximus_dur_carrier_nb (const u8 *tonemask);

/**
 * Compute the number of bits per OFDM symbol.
 * \param  mod  PHY modulation
 * \param  tonemask  tone mask
 * \param  tonemap  first tone map descriptor or NULL for ROBO modes
 * \param  carrier_nb  number of carriers for this tone mask
 * \return  the number of bits per OFDM symbol
 *
 * This function takes its parameters in the same format as the HAL PHY
 * functions.  The tone map uses two blocks.
 *
 * If you only have linear buffers, initialise blk_t structures to point to
 * your buffers.
 *
 * The carrier_nb is used as an optimisation for ROBO modes.
 */
uint
maximus_dur_bits_per_symbol (phy_mod_t mod, const u8 *tonemask,
                             const blk_t *tonemap, uint carrier_nb);

/**
 * Compute the number of symbols for a given number of PB.
 * \param  fecrate  FEC encoding rate
 * \param  pb_size  PB size
 * \param  bits_per_symbol  number of bits per symbol
 * \param  pb_nb  PB number
 * \return  number of used symbols
 */
uint
maximus_dur_symbol_nb (phy_fecrate_t fecrate, phy_pb_size_t pb_size,
                       uint bits_per_symbol, uint pb_nb);

/**
 * Compute the duration of the data part of a frame for a given number of
 * symbols.
 * \param  gil  guard interval for third symbol and following symbols
 * \param  symbol_nb  number of OFDM symbols
 * \return  duration in ticks
 */
uint
maximus_dur_data_tck (phy_gil_t gil, uint symbol_nb);

END_DECLS

#endif /* hal_phy_maximus_dur_inc_maximus_dur_h */