summaryrefslogtreecommitdiff
path: root/hal/phy/defs.h
blob: a7959a4fe64a390f8cf93e7b5d3a627c1efa72fa (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
#ifndef hal_phy_defs_h
#define hal_phy_defs_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/defs.h
 * \brief   HAL Phy types and defines.
 * \ingroup hal_phy
 */

/** Number of OFDM carrier, defined by the hardware. */
#define PHY_CARRIER_NB 1155

/** Number of first OFDM carrier, defined by the hardware. */
#define PHY_CARRIER_OFFSET 74

/** Number of bytes needed to define a tonemask. */
#define PHY_TONEMASK_SIZE ((PHY_CARRIER_NB + 8 - 1) / 8)

/** Number of bytes needed to define a tonemap. */
#define PHY_TONEMAP_SIZE ((PHY_CARRIER_NB + 2 - 1) / 2)

/** Delay to detect a preamble, defined by the hardware, not precise.
 * \todo Get a real value from hardware team. */
#define PHY_PREAMBLE_DETECTION_DELAY_TCK (20 * 25)

/** Delay for FC 1.0 preparation. */
#define PHY_FC_10_PREPARATION_DELAY_TCK (30 * 25)

/** Noise energy type.*/
typedef unsigned short int phy_noise_energy_t;

/** Spectrum type.*/
typedef unsigned int phy_spectrum_t;

/** Number of noise storable in a block */
#define PHY_NOISE_NB_PER_BLK (BLK_SIZE/(sizeof(phy_noise_energy_t)))

/** Number of spectrum storable in a block */
#define PHY_SPECTRUM_NB_PER_BLK (BLK_SIZE/(sizeof(phy_spectrum_t)))

/** Modulation mode. */
enum phy_mod_t
{
    PHY_MOD_ROBO,       /*< ROBO mode. */
    PHY_MOD_HS_ROBO,    /*< HIGH-SPEED ROBO mode. */
    PHY_MOD_MINI_ROBO,  /*< MINI ROBO mode. */
    PHY_MOD_TM,         /*< Tone map modulation. */
    PHY_MOD_NONE,       /*< Invalid mode. */
    PHY_MOD_ROBO_NB = PHY_MOD_TM, /*< Number of ROBO modes. */
};
typedef enum phy_mod_t phy_mod_t;

/** Forward Error Correction puncturing rate. */
enum phy_fecrate_t
{
    PHY_FEC_RATE_1_2,   /*< FEC rate 1/2. */
    PHY_FEC_RATE_16_21, /*< FEC rate 16/21. */
    PHY_FEC_RATE_NONE   /*< Invalid FEC rate. */
};
typedef enum phy_fecrate_t phy_fecrate_t;

/** PB size. */
enum phy_pb_size_t
{
    PHY_PB_SIZE_136,    /*< PB size 136 bytes, only one PB. */
    PHY_PB_SIZE_520,    /*< PB size 520 bytes. */
    PHY_PB_SIZE_NONE    /*< Invalid PB size. */
};
typedef enum phy_pb_size_t phy_pb_size_t;

/** FC mode. */
enum phy_fc_mode_t
{
    PHY_FC_MODE_HYBRID_1,       /*< Hybrid FC, 1 symbol. */
    PHY_FC_MODE_HYBRID_2,       /*< Hybrid FC, 2 symbol. */
    PHY_FC_MODE_AV_1,           /*< AV FC, 1 symbol. */
    PHY_FC_MODE_AV_2,           /*< AV FC, 2 symbol. */
    PHY_FC_MODE_NB,             /*< Number of defined FC mode. */
    PHY_FC_MODE_NONE = PHY_FC_MODE_NB   /*< Invalid FC mode. */
};
typedef enum phy_fc_mode_t phy_fc_mode_t;

/** Is it a hybrid mode. */
#define PHY_FC_MODE_IS_HYBRID(m) (!((m) & 0x2))

/** Make FC mode. */
#define PHY_FC_MODE(hybrid, fc_symb_nb) (((hybrid) ? 0 : 2) \
                                         | ((fc_symb_nb == 1) ? 0 : 1))

/** Guard interval length. */
enum phy_gil_t
{
    PHY_GIL_417,        /*< Guard interval 417 samples. */
    PHY_GIL_567,        /*< Guard interval 567 samples. */
    PHY_GIL_3534,       /*< Guard interval 3534 samples. */
    PHY_GIL_NB,         /*< Number of defined guard intervals. */
    PHY_GIL_NONE = PHY_GIL_NB   /*< Invalid guard interval. */
};
typedef enum phy_gil_t phy_gil_t;


#endif /* hal_phy_defs_h */