summaryrefslogtreecommitdiff
path: root/cesar/mac/common/interval.h
blob: 272384770a77661f93d35b6a63076b493e74794c (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
#ifndef mac_common_interval_h
#define mac_common_interval_h
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    mac/common/interval.h
 * \brief   Functions to handle intervals
 * \ingroup mac_common
 *
 * This header declares function to handle intervals (add a new interval for
 * example).
 */

#include "mac/common/tonemap.h"

BEGIN_DECLS

/**
 * Clear temporary intervals list.
 * \param  tms  the tone maps structure.
 */
void
mac_interval_clear (tonemaps_t *tms);

/**
 * Append an intervals to the temporary intervals list.
 * \param  tms  the tone maps structure.
 * \param  end_offset_atu  the offset of the end of the intervals (in ATU).
 * \param  tmi  the tone map index to use for this interval.
 * \return  the count of intervals, or 0 if the interval can not be added (no
 * more place, or interval lower than the last one.
 *
 * This function does not check end_offset_atu is valid (not too much overt
 * the beacon period) nor TMI is valid (TMI exists).
 */
u8
mac_interval_append (tonemaps_t *tms, u16 end_offset_atu, u8 tmi);

/**
 * Switch intervals list to the temporary intervals list.
 * \param  tms  the tone maps structure.
 * \param  group_intervals_nb  number of intervals per group, or 0 if no
 * group.
 * This function swap the pointers of intervals and intervals_temp.
 */
void
mac_interval_commit_changes (tonemaps_t *tms, u8 group_intervals_nb);

#endif /* mac_common_interval_h */