timeout.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Daniel Krebs
3  * 2017 INRIA
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef NET_GNRC_MAC_TIMEOUT_H
22 #define NET_GNRC_MAC_TIMEOUT_H
23 
24 #include <assert.h>
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 #include "evtimer_msg.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 #define GNRC_MAC_EVENT_TIMEOUT_TYPE (0x4400)
38 
46 typedef enum {
49 
53 typedef struct {
57 
61 typedef struct {
66  uint8_t timeout_num;
68 
78  gnrc_mac_timeout_event_t timeouts[],
79  uint8_t num);
80 
90  uint32_t offset, kernel_pid_t pid);
91 
101 
109 
119 static inline bool gnrc_mac_timeout_is_running(gnrc_mac_timeout_t *mac_timeout,
121 {
122  assert(mac_timeout);
123  return (gnrc_mac_find_timeout(mac_timeout, type) >= 0);
124 }
125 
136 
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* NET_GNRC_MAC_TIMEOUT_H */
kernel_pid_t
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:125
evtimer_t
Event timer.
Definition: evtimer.h:79
gnrc_mac_timeout_t::timeout_num
uint8_t timeout_num
Timeout number.
Definition: timeout.h:66
assert
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:104
gnrc_mac_timeout_t
Structure holding the GNRC_MAC timeouts.
Definition: timeout.h:61
gnrc_mac_timeout_event_t::type
gnrc_mac_timeout_type_t type
GNRC_MAC timeout type.
Definition: timeout.h:55
assert.h
POSIX.1-2008 compliant version of the assert macro.
gnrc_mac_timeout_t::timeouts
gnrc_mac_timeout_event_t * timeouts
The gnrc_mac timeout unites.
Definition: timeout.h:64
gnrc_mac_reset_timeouts
void gnrc_mac_reset_timeouts(gnrc_mac_timeout_t *mac_timeout)
Reset all the MAC timeouts.
gnrc_mac_clear_timeout
void gnrc_mac_clear_timeout(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
Clear a MAC timeout of type.
gnrc_mac_timeout_event_t::msg_event
evtimer_msg_event_t msg_event
The timeout message event.
Definition: timeout.h:54
gnrc_mac_timeout_t::evtimer
evtimer_t evtimer
evtimer entity which stores the timeout list.
Definition: timeout.h:62
gnrc_mac_set_timeout
void gnrc_mac_set_timeout(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type, uint32_t offset, kernel_pid_t pid)
Set a MAC timeout of type.
evtimer_msg.h
IPC-based evtimer definitions.
gnrc_mac_init_timeouts
void gnrc_mac_init_timeouts(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_event_t timeouts[], uint8_t num)
Initialize the MAC timeout module of gnrc_mac before using, it also sets the timeout callback functio...
gnrc_mac_find_timeout
int gnrc_mac_find_timeout(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
Find a MAC timeout of type.
gnrc_mac_timeout_is_expired
bool gnrc_mac_timeout_is_expired(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
Check whether a MAC timeout of type has expired or not.
gnrc_mac_timeout_type_t
gnrc_mac_timeout_type_t
Definitions of GNRC_MAC timeout types.
Definition: timeout.h:46
gnrc_mac_timeout_is_running
static bool gnrc_mac_timeout_is_running(gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
Check whether a MAC timeout of type is running or not.
Definition: timeout.h:119
GNRC_MAC_TIMEOUT_DISABLED
@ GNRC_MAC_TIMEOUT_DISABLED
Timeout is disabled, not in used.
Definition: timeout.h:47
evtimer_msg_event_t
IPC-message event.
Definition: evtimer_msg.h:40
gnrc_mac_timeout_event_t
Structure of the GNRC_MAC timeout event.
Definition: timeout.h:53