summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/inc/common.h
blob: 48e6ce34797575fb974fa42c9771acb1083dd209 (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
#ifndef ce_rx_bitloading_inc_common_h
#define ce_rx_bitloading_inc_common_h
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ce/rx/bitloading/inc/common.h
 * \brief   Common transition functions
 * \ingroup ce_rx
 *
 * Transitions can look the same. This module contains some global transition
 * functions to prevent code duplication.
 */

#include "mac/common/sta.h"
#include "mac/common/tonemask.h"
#include "mac/common/tonemap.h"
#include "ce/rx/inc/rx.h"

/**
 * Minimum time between two restarts of the CE, in milliseconds.
 * First one is for PBErrorRate criteria, second one is for BER criteria.
 */
extern uint ce_rx_bl_min_time_between_ce_restart_ms[CE_RX_BL_DATE_CRITERIA_NB];

BEGIN_DECLS

/**
 * Start initial bit loading when we receive a sound complete flag.
 * \param  ce_rx  the ce_rx context.
 * \param  sta  the peer station.
 * \param  ts  the tone mask.
 *
 * This function compute the tone map, set it and send the required MME to the
 * peer.
 */
void
ce_rx_bl_start_bl (ce_rx_t *ce_rx, sta_t *sta, tonemask_info_t *ts);

/**
 * Compare tone map to ROBO.
 * \param  tm  a tone map
 * \param  ti  a tone mask info
 * \return  true if the tone map is better than ROBO one, false otherwise
 *
 * This function can be used to know if the tone map generated by the bit
 * loading algorithm is better than the ROBO ones.
 */
bool
ce_rx_bl_tonemap_better_than_robo (tonemap_t *tm, tonemask_info_t *ti);

END_DECLS

#endif /* ce_rx_bitloading_inc_common_h */