trickle.h
Go to the documentation of this file.
1 /*
2  * Trickle constants and prototypes
3  *
4  * Copyright (C) 2013, 2014 INRIA.
5  * 2017 HAW Hamburg
6  *
7  * This file is subject to the terms and conditions of the GNU Lesser
8  * General Public License v2.1. See the file LICENSE in the top level
9  * directory for more details.
10  */
11 
28 #ifndef TRICKLE_H
29 #define TRICKLE_H
30 
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
34 
35 #include "xtimer.h"
36 #include "thread.h"
37 
41 typedef struct {
42  void (*func)(void *);
43  void *args;
45 
49 typedef struct {
50  uint8_t k;
51  uint8_t Imax;
53  uint16_t c;
54  uint32_t Imin;
55  uint32_t I;
56  uint32_t t;
64 } trickle_t;
65 
74 void trickle_reset_timer(trickle_t *trickle);
75 
89 void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type,
90  uint32_t Imin, uint8_t Imax, uint8_t k);
91 
97 void trickle_stop(trickle_t *trickle);
98 
104 void trickle_increment_counter(trickle_t *trickle);
105 
113 void trickle_interval(trickle_t *trickle);
114 
120 void trickle_callback(trickle_t *trickle);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* TRICKLE_H */
127 
kernel_pid_t
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:125
xtimer
xtimer timer structure
Definition: xtimer.h:81
trickle_t::Imin
uint32_t Imin
minimum interval size in ms
Definition: trickle.h:54
trickle_interval
void trickle_interval(trickle_t *trickle)
is called after the interval is over and calculates the next interval
trickle_callback_t::args
void * args
callback function arguments
Definition: trickle.h:43
trickle_t::msg_timer
xtimer_t msg_timer
xtimer to send a msg_t to the target thread for a new interval
Definition: trickle.h:62
trickle_increment_counter
void trickle_increment_counter(trickle_t *trickle)
increments the counter by one
trickle_callback_t
Trickle callback function with arguments.
Definition: trickle.h:41
trickle_t::callback
trickle_callback_t callback
callback function and parameter that trickle calls after each interval
Definition: trickle.h:59
trickle_stop
void trickle_stop(trickle_t *trickle)
stops the trickle timer
trickle_callback
void trickle_callback(trickle_t *trickle)
is called after the interval is over and executes callback function
trickle_start
void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type, uint32_t Imin, uint8_t Imax, uint8_t k)
start the trickle timer
trickle_t
all state variables of a trickle timer
Definition: trickle.h:49
trickle_t::k
uint8_t k
redundancy constant
Definition: trickle.h:50
trickle_reset_timer
void trickle_reset_timer(trickle_t *trickle)
resets the trickle timer
trickle_t::Imax
uint8_t Imax
maximum interval size, described as of Imin doublings in ms
Definition: trickle.h:51
trickle_t::t
uint32_t t
time within the current interval in ms
Definition: trickle.h:56
msg_t
Describes a message object which can be sent between threads.
Definition: msg.h:185
trickle_t::c
uint16_t c
counter
Definition: trickle.h:53
trickle_t::pid
kernel_pid_t pid
pid of trickles target thread
Definition: trickle.h:58
trickle_t::I
uint32_t I
current interval size in ms
Definition: trickle.h:55
xtimer.h
xtimer interface definitions
trickle_t::msg
msg_t msg
the msg_t to use for intervals
Definition: trickle.h:61