summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/inc/intervals.h
blob: 37bfbbf06684fd747106f1dac7b7d1cf1167ada1 (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
#ifndef ce_rx_bitloading_inc_intervals_h
#define ce_rx_bitloading_inc_intervals_h
/* Cesar project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ce/rx/bitloading/inc/intervals.h
 * \brief   CE RX intervals private part.
 * \ingroup ce_rx_bl
 *
 * This module is responsible to manage tonemap intervals. Functions used here
 * may only be used by CE/RX.
 */

#include "mac/pbproc/pbproc.h"
#include "bsu/aclf/aclf.h"
#include "ce/rx/rx.h"
#include "ce/rx/inc/rx.h"

BEGIN_DECLS

/**
 * Get the list of tone map index used as default one or on any interval.
 * \param  sta  station context.
 * \param  check_default  true if you want to include tonemap index used as
 * default one in result, false otherwise.
 * \return  a bit field list with a one when the tonemap index is used and
 * zero when it is not.
 */
u32
ce_rx_bl_intervals_get_tmi_used_list (sta_t *sta, bool check_default);

/**
 * Estimate the start and the end date of a PPDU.
 * It transforms dates from rx_param in ATU.
 * \param  rx_param  parameters of PPDU.
 * \param  start_date_atu  start date (in ATU) corresponds to PPDU
 * payload beginning. It must already be allocated, start date will be written
 * at this address.
 * \param  end_date_atu  end date (in ATU) corresponds to PPDU payload end.
 * It must already be allocated, end date will be written at this address.
 */
void
ce_rx_bl_intervals_measure_to_date (pbproc_rx_params_t *rx_param,
                                    s16 *start_date_atu,
                                    s16 *end_date_atu);

/**
 * Inform if a measure is on an interval or not and give this interval.
 * \param  tms  tonemaps.
 * \param  start  start date of the measure (in ATU).
 * \param  end  end date of the measure (in ATU).
 * \return  the interval number or -1 if the measure is global.
 */
int
ce_rx_bl_intervals_measure_to_interval (tonemaps_t *tms,
                                        s16 mea_start,
                                        s16 mea_end);

/*
 * Reconstruct RX intervals based on fsm TMI.
 * \param  sta  station.
 * \param  bp_tck  theoretical beacon period in ticks.
 */
void
ce_rx_bl_intervals_update_tmi (sta_t *sta, const bsu_aclf_bp_t bp_tck);

/**
 * Reset intervals which have a specific fsm id.
 * \param  ce_rx  CE RX context.
 * \param  sta  station.
 * \param  fsm_id  fsm id, should be a valid id.
 *
 * This function will free TMI if it is not the default one and send a refresh
 * MME asking for sound on those intervals.
 */
void
ce_rx_bl_intervals_reset (ce_rx_t *ce_rx, sta_t *sta, int fsm_id);

/**
 * Start intervals by allocating them, construct intervals and send a refresh
 * MME.
 * \param  ce_rx CE RX context.
 * \param  sta  station.
 */

void
ce_rx_bl_intervals_start (ce_rx_t *ce_rx, sta_t *sta);

END_DECLS

#endif /* ce_rx_bitloading_inc_intervals_h */