Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
tsch-cs.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016-2018, University of Bristol - http://www.bristol.ac.uk
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* 3. Neither the name of the copyright holder nor the names of its
13
* contributors may be used to endorse or promote products derived
14
* from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
20
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
* SUCH DAMAGE.
27
*
28
*/
29
30
/**
31
* \file
32
* Header file for TSCH adaptive channel selection
33
* \author
34
* Atis Elsts <atis.elsts@bristol.ac.uk>
35
*/
36
37
#ifndef TSCH_CS_H_
38
#define TSCH_CS_H_
39
40
#include "contiki.h"
41
#include <stdbool.h>
42
43
/* If `channel_free_ewma` value is less than this, the channel is considered busy */
44
#ifdef TSCH_CS_CONF_FREE_THRESHOLD
45
#define TSCH_CS_FREE_THRESHOLD TSCH_CS_CONF_FREE_THRESHOLD
46
#else
47
/* < 85% free */
48
#define TSCH_CS_FREE_THRESHOLD ((tsch_stat_t)(85ul * TSCH_STATS_BINARY_SCALING_FACTOR / 100))
49
#endif
50
51
#define TSCH_CS_LEARNING_PERIOD_SEC 30
52
53
/**
54
* \brief Initializes the TSCH hopping sequence selection module.
55
*/
56
void
tsch_cs_adaptations_init
(
void
);
57
58
/**
59
* \brief Signal the need to potentially update the TSCH hopping sequence.
60
* \param updated_channel The channel with the updated RSSI measurement
61
* \param old_busyness_metric The EWMA value of the "channel busy" status before the last RSSI measurement
62
*/
63
void
tsch_cs_channel_stats_updated
(uint8_t updated_channel, uint16_t old_busyness_metric);
64
65
/**
66
* \brief Potentially update the TSCH hopping sequence
67
* \return true if the hopping sequence was updated, false otherwise
68
*/
69
bool
tsch_cs_process
(
void
);
70
71
72
/* A bit corresponds to a channel; `uint16_t` value is OK for up to 16 channels. */
73
typedef
uint16_t tsch_cs_bitmap_t;
74
75
76
#endif
/* TSCH_CS_H_ */
tsch_cs_adaptations_init
void tsch_cs_adaptations_init(void)
Initializes the TSCH hopping sequence selection module.
Definition
tsch-cs.c:116
tsch_cs_process
bool tsch_cs_process(void)
Potentially update the TSCH hopping sequence.
Definition
tsch-cs.c:201
tsch_cs_channel_stats_updated
void tsch_cs_channel_stats_updated(uint8_t updated_channel, uint16_t old_busyness_metric)
Signal the need to potentially update the TSCH hopping sequence.
Definition
tsch-cs.c:304
os
services
tsch-cs
tsch-cs.h
Generated on
for Contiki-NG by
1.17.0