Loading...
Searching...
No Matches
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
30extern "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
120
136
140#define GNRC_LWMAC_TX_STATE_INITIAL GNRC_LWMAC_TX_STATE_STOPPED
141
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
184
194
198typedef struct lwmac {
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
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* NET_GNRC_LWMAC_TYPES_H */
#define CONFIG_GNRC_LWMAC_TIMEOUT_COUNT
The default largest number of parallel timeouts in LWMAC.
Definition types.h:101
Header definition LWMAC.
LWMAC timeout structure.
Definition types.h:188
bool expired
If type != DISABLED, this indicates if timeout has expired.
Definition types.h:191
msg_t msg
msg entity
Definition types.h:190
gnrc_lwmac_timeout_type_t type
timeout type
Definition types.h:192
xtimer_t timer
xtimer entity
Definition types.h:189
LWMAC specific structure for storing internal states.
Definition types.h:198
uint32_t last_wakeup
Used to calculate wakeup times.
Definition types.h:200
gnrc_lwmac_timeout_t timeouts[CONFIG_GNRC_LWMAC_TIMEOUT_COUNT]
Store timeouts used for protocol.
Definition types.h:202
uint8_t lwmac_info
LWMAC's internal information (flags)
Definition types.h:201
gnrc_lwmac_state_t state
Internal state of MAC layer.
Definition types.h:199
Describes a message object which can be sent between threads.
Definition msg.h:196
xtimer timer structure
Definition xtimer.h:97
gnrc_lwmac_state_t
Internal states of LWMAC.
Definition types.h:108
@ GNRC_LWMAC_STATE_COUNT
Count of LWMAC's states.
Definition types.h:118
@ GNRC_LWMAC_UNDEF
Undefined state of LWMAC.
Definition types.h:109
@ GNRC_LWMAC_STOPPED
LWMAC's main state machine has been stopped.
Definition types.h:110
@ GNRC_LWMAC_START
Start LWMAC's main state machine.
Definition types.h:111
@ GNRC_LWMAC_STOP
Stop LWMAC's main state machine.
Definition types.h:112
@ GNRC_LWMAC_TRANSMITTING
TX is handled in own state machine.
Definition types.h:116
@ GNRC_LWMAC_SLEEPING
Turn off radio to conserve power.
Definition types.h:117
@ GNRC_LWMAC_RECEIVING
RX is handled in own state machine.
Definition types.h:115
@ GNRC_LWMAC_LISTENING
Listen the channel for receiving packets.
Definition types.h:114
@ GNRC_LWMAC_RESET
Reset LWMAC's main state machine.
Definition types.h:113
gnrc_lwmac_timeout_type_t
LWMAC timeout types.
Definition types.h:174
@ GNRC_LWMAC_TIMEOUT_WAIT_DEST_WAKEUP
Timeout for waiting receiver's wake-up phase.
Definition types.h:179
@ GNRC_LWMAC_TIMEOUT_WR
WR timeout, waiting WA.
Definition types.h:176
@ GNRC_LWMAC_TIMEOUT_DATA
Timeout awaiting data packet from receiver.
Definition types.h:178
@ GNRC_LWMAC_TIMEOUT_DISABLED
Timeout is disabled.
Definition types.h:175
@ GNRC_LWMAC_TIMEOUT_NEXT_BROADCAST
Timeout for waiting to send the next broadcast packet.
Definition types.h:181
@ GNRC_LWMAC_TIMEOUT_NO_RESPONSE
Maximum WR duration timeout awaiting WA.
Definition types.h:177
@ GNRC_LWMAC_TIMEOUT_WAKEUP_PERIOD
Wake up period timeout for going to sleep.
Definition types.h:180
@ GNRC_LWMAC_TIMEOUT_BROADCAST_END
Timeout awaiting the end of the whole broadcast period.
Definition types.h:182
gnrc_lwmac_tx_state_t
TX states of LWMAC.
Definition types.h:124
@ GNRC_LWMAC_TX_STATE_SEND_DATA
Send the actual payload data.
Definition types.h:131
@ GNRC_LWMAC_TX_STATE_INIT
Initiate transmission.
Definition types.h:126
@ GNRC_LWMAC_TX_STATE_WAIT_WR_SENT
Wait until WR sent to set timeout.
Definition types.h:129
@ GNRC_LWMAC_TX_STATE_SUCCESSFUL
Transmission has finished successfully.
Definition types.h:133
@ GNRC_LWMAC_TX_STATE_FAILED
Payload data couldn't be delivered to dest.
Definition types.h:134
@ GNRC_LWMAC_TX_STATE_STOPPED
Tx schedule stopped, stop sending packet.
Definition types.h:125
@ GNRC_LWMAC_TX_STATE_SEND_WR
Send a wakeup request.
Definition types.h:128
@ GNRC_LWMAC_TX_STATE_WAIT_FOR_WA
Wait for dest node's wakeup ackknowledge.
Definition types.h:130
@ GNRC_LWMAC_TX_STATE_WAIT_FEEDBACK
Wait if packet was ACKed.
Definition types.h:132
@ GNRC_LWMAC_TX_STATE_SEND_BROADCAST
directly goes to SUCCESSFUL or FAILED when finished
Definition types.h:127
gnrc_lwmac_rx_state_t
RX states of LWMAC.
Definition types.h:145
@ GNRC_LWMAC_RX_STATE_INIT
Initiate reception.
Definition types.h:147
@ GNRC_LWMAC_RX_STATE_WAIT_WA_SENT
Wait until WA sent to set timeout.
Definition types.h:150
@ GNRC_LWMAC_RX_STATE_WAIT_FOR_WR
Wait for a wakeup request.
Definition types.h:148
@ GNRC_LWMAC_RX_STATE_SEND_WA
Send wakeup ackknowledge to requesting node.
Definition types.h:149
@ GNRC_LWMAC_RX_STATE_SUCCESSFUL
Recption has finished successfully.
Definition types.h:152
@ GNRC_LWMAC_RX_STATE_STOPPED
Rx schedule stopped.
Definition types.h:146
@ GNRC_LWMAC_RX_STATE_WAIT_FOR_DATA
Wait for actual payload data.
Definition types.h:151
@ GNRC_LWMAC_RX_STATE_FAILED
Reception over, but nothing received.
Definition types.h:153
struct lwmac gnrc_lwmac_t
LWMAC specific structure for storing internal states.
xtimer interface definitions