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 
96 #ifndef GNRC_LWMAC_TIMEOUT_COUNT
97 #define GNRC_LWMAC_TIMEOUT_COUNT (3U)
98 #endif
99 
103 typedef enum {
115 
119 typedef enum {
131 
135 #define GNRC_LWMAC_TX_STATE_INITIAL GNRC_LWMAC_TX_STATE_STOPPED
136 
140 typedef enum {
150 
154 #define GNRC_LWMAC_RX_STATE_INITIAL GNRC_LWMAC_RX_STATE_STOPPED
155 
159 #define GNRC_LWMAC_PHASE_UNINITIALIZED (0)
160 
164 #define GNRC_LWMAC_PHASE_MAX (-1)
165 
169 typedef enum {
179 
183 typedef struct {
186  bool expired;
187  gnrc_lwmac_timeout_type_t type;
189 
193 typedef struct lwmac {
194  gnrc_lwmac_state_t state;
195  uint32_t last_wakeup;
196  uint8_t lwmac_info;
199 #if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
200  /* Parameters for recording duty-cycle */
201  uint32_t last_radio_on_time_ticks;
202  uint32_t radio_off_time_ticks;
203  uint32_t system_start_time_ticks;
204  uint32_t awake_duration_sum_ticks;
205  uint32_t pkt_start_sending_time_ticks;
207 #endif
208 } gnrc_lwmac_t;
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* NET_GNRC_LWMAC_TYPES_H */
215 
gnrc_lwmac_timeout_type_t
LWMAC timeout types.
Definition: types.h:169
Header definition LWMAC.
Timeout is disabled.
Definition: types.h:170
msg_t msg
msg entity
Definition: types.h:185
Timeout awaiting the end of the whole broadcast period.
Definition: types.h:177
xtimer_t timer
xtimer entity
Definition: types.h:184
Turn off radio to conserve power.
Definition: types.h:112
gnrc_lwmac_tx_state_t
TX states of LWMAC.
Definition: types.h:119
Timeout for waiting receiver's wake-up phase.
Definition: types.h:174
TX is handled in own state machine.
Definition: types.h:111
bool expired
If type != DISABLED, this indicates if timeout has expired.
Definition: types.h:186
Timeout awaiting data packet from receiver.
Definition: types.h:173
Transmission has finished successfully.
Definition: types.h:128
Reception over, but nothing received.
Definition: types.h:148
Stop LWMAC's main state machine.
Definition: types.h:107
LWMAC timeout structure.
Definition: types.h:183
RX is handled in own state machine.
Definition: types.h:110
#define GNRC_LWMAC_TIMEOUT_COUNT
The default largest number of parallel timeouts in LWMAC.
Definition: types.h:97
gnrc_lwmac_timeout_t timeouts[GNRC_LWMAC_TIMEOUT_COUNT]
Store timeouts used for protocol.
Definition: types.h:197
Wait until WA sent to set timeout.
Definition: types.h:145
Send the actual payload data.
Definition: types.h:126
Start LWMAC's main state machine.
Definition: types.h:106
Rx schedule stopped.
Definition: types.h:141
Wait for a wakeup request.
Definition: types.h:143
Payload data couldn't be delivered to dest.
Definition: types.h:129
Reset LWMAC's main state machine.
Definition: types.h:108
WR timeout, waiting WA.
Definition: types.h:171
Wait for actual payload data.
Definition: types.h:146
Maximum WR duration timeout awaiting WA.
Definition: types.h:172
Send wakeup ackknowledge to requesting node.
Definition: types.h:144
gnrc_lwmac_state_t state
Internal state of MAC layer.
Definition: types.h:194
Wake up period timeout for going to sleep.
Definition: types.h:175
Messaging API for inter process communication.
LWMAC's main state machine has been stopped.
Definition: types.h:105
Timeout for waiting to send the next broadcast packet.
Definition: types.h:176
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:103
Undefined state of LWMAC.
Definition: types.h:104
Tx schedule stopped, stop sending packet.
Definition: types.h:120
gnrc_lwmac_timeout_type_t type
timeout type
Definition: types.h:187
uint32_t last_wakeup
Used to calculate wakeup times.
Definition: types.h:195
gnrc_lwmac_rx_state_t
RX states of LWMAC.
Definition: types.h:140
Count of LWMAC's states.
Definition: types.h:113
Wait if packet was ACKed.
Definition: types.h:127
Listen the channel for receiving packets.
Definition: types.h:109
LWMAC specific structure for storing internal states.
Definition: types.h:193
Wait until WR sent to set timeout.
Definition: types.h:124
xtimer timer structure
Definition: xtimer.h:74
uint8_t lwmac_info
LWMAC's internal information (flags)
Definition: types.h:196
Send a wakeup request.
Definition: types.h:123
Initiate transmission.
Definition: types.h:121
Wait for dest node's wakeup ackknowledge.
Definition: types.h:125
struct lwmac gnrc_lwmac_t
LWMAC specific structure for storing internal states.
Initiate reception.
Definition: types.h:142
Recption has finished successfully.
Definition: types.h:147
directly goes to SUCCESSFUL or FAILED when finished
Definition: types.h:122