types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Daniel Krebs
3  * 2016 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 
22 #ifndef NET_GNRC_LWMAC_TYPES_H
23 #define NET_GNRC_LWMAC_TYPES_H
24 
25 #include "msg.h"
26 #include "xtimer.h"
27 #include "net/gnrc/lwmac/hdr.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define GNRC_LWMAC_EVENT_RTT_TYPE (0x4300)
37 
41 #define GNRC_LWMAC_EVENT_RTT_START (0x4301)
42 
46 #define GNRC_LWMAC_EVENT_RTT_STOP (0x4302)
47 
51 #define GNRC_LWMAC_EVENT_RTT_PAUSE (0x4303)
52 
56 #define GNRC_LWMAC_EVENT_RTT_RESUME (0x4304)
57 
61 #define GNRC_LWMAC_EVENT_RTT_WAKEUP_PENDING (0x4305)
62 
66 #define GNRC_LWMAC_EVENT_RTT_SLEEP_PENDING (0x4306)
67 
71 #define GNRC_LWMAC_EVENT_TIMEOUT_TYPE (0x4400)
72 
78 #define GNRC_LWMAC_DUTYCYCLE_ACTIVE (0x01)
79 
86 #define GNRC_LWMAC_NEEDS_RESCHEDULE (0x02)
87 
91 #define GNRC_LWMAC_RADIO_IS_ON (0x04)
92 
100 #ifndef CONFIG_GNRC_LWMAC_TIMEOUT_COUNT
101 #define CONFIG_GNRC_LWMAC_TIMEOUT_COUNT (3U)
102 #endif
103 
108 typedef enum {
120 
124 typedef enum {
136 
140 #define GNRC_LWMAC_TX_STATE_INITIAL GNRC_LWMAC_TX_STATE_STOPPED
141 
145 typedef enum {
155 
159 #define GNRC_LWMAC_RX_STATE_INITIAL GNRC_LWMAC_RX_STATE_STOPPED
160 
164 #define GNRC_LWMAC_PHASE_UNINITIALIZED (0)
165 
169 #define GNRC_LWMAC_PHASE_MAX (-1)
170 
174 typedef enum {
184 
188 typedef struct {
191  bool expired;
192  gnrc_lwmac_timeout_type_t type;
194 
198 typedef struct lwmac {
199  gnrc_lwmac_state_t state;
200  uint32_t last_wakeup;
201  uint8_t lwmac_info;
204 #if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
205  /* Parameters for recording duty-cycle */
206  uint32_t last_radio_on_time_ticks;
207  uint32_t radio_off_time_ticks;
208  uint32_t system_start_time_ticks;
209  uint32_t awake_duration_sum_ticks;
210  uint32_t pkt_start_sending_time_ticks;
212 #endif
213 } gnrc_lwmac_t;
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #endif /* NET_GNRC_LWMAC_TYPES_H */
220 
gnrc_lwmac_timeout_type_t
LWMAC timeout types.
Definition: types.h:174
Header definition LWMAC.
Timeout is disabled.
Definition: types.h:175
msg_t msg
msg entity
Definition: types.h:190
Timeout awaiting the end of the whole broadcast period.
Definition: types.h:182
xtimer_t timer
xtimer entity
Definition: types.h:189
Turn off radio to conserve power.
Definition: types.h:117
gnrc_lwmac_tx_state_t
TX states of LWMAC.
Definition: types.h:124
Timeout for waiting receiver's wake-up phase.
Definition: types.h:179
TX is handled in own state machine.
Definition: types.h:116
bool expired
If type != DISABLED, this indicates if timeout has expired.
Definition: types.h:191
Timeout awaiting data packet from receiver.
Definition: types.h:178
Transmission has finished successfully.
Definition: types.h:133
Reception over, but nothing received.
Definition: types.h:153
Stop LWMAC's main state machine.
Definition: types.h:112
LWMAC timeout structure.
Definition: types.h:188
RX is handled in own state machine.
Definition: types.h:115
Wait until WA sent to set timeout.
Definition: types.h:150
Send the actual payload data.
Definition: types.h:131
Start LWMAC's main state machine.
Definition: types.h:111
Rx schedule stopped.
Definition: types.h:146
Wait for a wakeup request.
Definition: types.h:148
Payload data couldn't be delivered to dest.
Definition: types.h:134
Reset LWMAC's main state machine.
Definition: types.h:113
WR timeout, waiting WA.
Definition: types.h:176
Wait for actual payload data.
Definition: types.h:151
Maximum WR duration timeout awaiting WA.
Definition: types.h:177
Send wakeup ackknowledge to requesting node.
Definition: types.h:149
gnrc_lwmac_state_t state
Internal state of MAC layer.
Definition: types.h:199
Wake up period timeout for going to sleep.
Definition: types.h:180
Messaging API for inter process communication.
LWMAC's main state machine has been stopped.
Definition: types.h:110
Timeout for waiting to send the next broadcast packet.
Definition: types.h:181
xtimer interface definitions
Describes a message object which can be sent between threads.
Definition: msg.h:184
gnrc_lwmac_state_t
Internal states of LWMAC.
Definition: types.h:108
Undefined state of LWMAC.
Definition: types.h:109
Tx schedule stopped, stop sending packet.
Definition: types.h:125
gnrc_lwmac_timeout_type_t type
timeout type
Definition: types.h:192
#define CONFIG_GNRC_LWMAC_TIMEOUT_COUNT
The default largest number of parallel timeouts in LWMAC.
Definition: types.h:101
uint32_t last_wakeup
Used to calculate wakeup times.
Definition: types.h:200
gnrc_lwmac_rx_state_t
RX states of LWMAC.
Definition: types.h:145
Count of LWMAC's states.
Definition: types.h:118
Wait if packet was ACKed.
Definition: types.h:132
Listen the channel for receiving packets.
Definition: types.h:114
LWMAC specific structure for storing internal states.
Definition: types.h:198
Wait until WR sent to set timeout.
Definition: types.h:129
xtimer timer structure
Definition: xtimer.h:81
uint8_t lwmac_info
LWMAC's internal information (flags)
Definition: types.h:201
Send a wakeup request.
Definition: types.h:128
Initiate transmission.
Definition: types.h:126
gnrc_lwmac_timeout_t timeouts[CONFIG_GNRC_LWMAC_TIMEOUT_COUNT]
Store timeouts used for protocol.
Definition: types.h:202
Wait for dest node's wakeup ackknowledge.
Definition: types.h:130
struct lwmac gnrc_lwmac_t
LWMAC specific structure for storing internal states.
Initiate reception.
Definition: types.h:147
Recption has finished successfully.
Definition: types.h:152
directly goes to SUCCESSFUL or FAILED when finished
Definition: types.h:127