types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Shuguo Zhuo
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef NET_GNRC_GOMACH_TYPES_H
20 #define NET_GNRC_GOMACH_TYPES_H
21 
22 #include <stdint.h>
23 #include <stdbool.h>
24 
25 #include "xtimer.h"
26 #include "net/gnrc/gomach/hdr.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #define GNRC_GOMACH_EVENT_RTT_TYPE (0x4300)
36 
40 #define GNRC_GOMACH_EVENT_RTT_NEW_CYCLE (0x4301)
41 
45 #define GNRC_GOMACH_EVENT_TIMEOUT_TYPE (0x4400)
46 
50 #define GNRC_GOMACH_PHASE_UNINITIALIZED (0)
51 
55 #define GNRC_GOMACH_PHASE_MAX (-1)
56 
60 #define GNRC_GOMACH_DUPCHK_BUFFER_SIZE (8U)
61 
65 #define GNRC_GOMACH_TIMEOUT_COUNT (6U)
66 
71 #define GNRC_GOMACH_SLOSCH_UNIT_COUNT (11U)
72 
77 #define GNRC_GOMACH_TYPE_UNKNOWN (0U)
78 
83 #define GNRC_GOMACH_TYPE_KNOWN (1U)
84 
88 typedef enum {
95 
100 typedef enum {
111 
116 typedef enum {
126 
130 typedef enum {
135 
139 typedef enum {
145 
149 typedef enum {
162 
166 typedef enum {
171 
175 typedef enum {
191 
195 typedef struct {
198 
205 typedef struct {
207  uint8_t queue_indicator;
209 
213 typedef struct {
214  uint8_t total_slots_num;
215  uint8_t sub_channel_seq;
217 
221 typedef struct {
223  uint8_t seq;
224  uint8_t life_cycle;
226 
231 typedef struct {
234  uint8_t queue_head;
237 
241 typedef struct {
245  uint8_t seq;
247 
251 typedef struct {
252  uint16_t sub_channel_seq;
253  uint8_t slots_position;
254  uint8_t slots_num;
256 
260 typedef struct {
263  bool expired;
264  gnrc_gomach_timeout_type_t type;
266 
270 #define GNRC_GOMACH_TIMEOUT_INIT { {}, {}, false, GNRC_GOMACH_TIMEOUT_DISABLED }
271 
275 typedef struct gomach {
276  gnrc_gomach_basic_state_t basic_state;
277  gnrc_gomach_init_state_t init_state;
281  uint16_t sub_channel_seq;
282  uint16_t pub_channel_1;
283  uint16_t pub_channel_2;
284  uint16_t cur_pub_channel;
285  uint8_t cp_extend_count;
286  uint32_t last_wakeup;
287  uint32_t backoff_phase_us;
288  uint16_t gomach_info;
291  int16_t rx_pkt_rssi;
293  uint8_t rx_pkt_lqi;
296 #if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
297  /* Parameters for recording duty-cycle */
298  uint64_t last_radio_on_time_ticks;
300  uint64_t radio_off_time_ticks;
302  uint64_t system_start_time_ticks;
304  uint64_t awake_duration_sum_ticks;
306 #endif
307 } gnrc_gomach_t;
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 
313 #endif /* NET_GNRC_GOMACH_TYPES_H */
314 
gnrc_gomach_l2_addr_t node_addr
Node&#39;s address.
Definition: types.h:206
uint16_t pub_channel_2
Public channel 2.
Definition: types.h:283
uint16_t subchannel_occu_flags
Sub-channel usage indicator.
Definition: types.h:279
Transmit to phase-unknown node in GoMacH.
Definition: types.h:167
Send data packet to the receiver.
Definition: types.h:122
Turn radio off to sleep.
Definition: types.h:159
Wait for send beacon TX finish.
Definition: types.h:154
GoMacH&#39;s slot-schedule-unit.
Definition: types.h:205
uint64_t last_wakeup_phase_us
Last cycle wakeup phase.
Definition: types.h:290
GoMacH&#39;s duty-cycled listen procedure.
Definition: types.h:132
Wait for CP transmission finish.
Definition: types.h:104
Timeout of waiting own slots.
Definition: types.h:184
gnrc_gomach_listen_state_t
State-machine states of duty-cycled listening procedure of GoMacH.
Definition: types.h:149
End of the sleep period.
Definition: types.h:160
gnrc_gomach_timeout_type_t type
GoMacH timeout type.
Definition: types.h:264
Wait for the node&#39;s allocated slots period.
Definition: types.h:106
GoMacH internal L2 address structure.
Definition: types.h:195
struct gomach gnrc_gomach_t
GoMacH&#39;s specific structure for storing internal states.
bool expired
Timeout expiration indicator.
Definition: types.h:263
Announce the sub-channel sequence of the node.
Definition: types.h:141
uint8_t slots_num
Node&#39;s allocated slots number.
Definition: types.h:254
gnrc_gomach_bcast_state_t
State-machine states of Broadcast procedure of GoMacH.
Definition: types.h:88
Listen for incoming packets in vTDMA.
Definition: types.h:156
gnrc_gomach_t2k_state_t
State-machine states of Transmission-to-phase-known (t2k) procedure of GoMacH.
Definition: types.h:100
Wait for Send preamble TX finish.
Definition: types.h:120
int16_t rx_pkt_rssi
RSSI of latest received packet in dBm.
Definition: types.h:291
gnrc_gomach_l2_addr_t node_addr
Node&#39;s address.
Definition: types.h:222
Broadcast packet in GoMacH.
Definition: types.h:169
Send beacon packet when needed.
Definition: types.h:153
xtimer_t timer
xtimer entity.
Definition: types.h:261
Wait receiver&#39;s beacon.
Definition: types.h:105
Timeout of waiting beacon.
Definition: types.h:183
Transmit to phase-known node in GoMacH.
Definition: types.h:168
Initiate the listen period.
Definition: types.h:150
uint16_t gomach_info
GoMacH&#39;s internal information.
Definition: types.h:288
Timeout of next broadcast transmission.
Definition: types.h:178
#define GNRC_GOMACH_DUPCHK_BUFFER_SIZE
GoMacH check duplicate packet buffer size.
Definition: types.h:60
uint32_t last_wakeup
Last wake-up timing.
Definition: types.h:286
Timeout of next preamble transmission.
Definition: types.h:179
GoMacH&#39;s vTDMA (dynamic slots allocation) management unit.
Definition: types.h:213
uint8_t rx_pkt_lqi
LQI of latest received packet.
Definition: types.h:293
Timeout of maximum transmission duration.
Definition: types.h:189
gnrc_gomach_timeout_t timeouts[GNRC_GOMACH_TIMEOUT_COUNT]
GoMacH&#39;s timeouts.
Definition: types.h:278
uint8_t total_slots_num
Number of total allocated transmission slots.
Definition: types.h:214
uint32_t backoff_phase_us
Phase backoff time.
Definition: types.h:287
Initiate t2u procedure.
Definition: types.h:117
gnrc_gomach_hdr_t * header
GoMacH header of packet.
Definition: types.h:242
Send broadcast packet.
Definition: types.h:90
uint8_t life_cycle
Lifetime of this record unit.
Definition: types.h:224
#define GNRC_GOMACH_TIMEOUT_COUNT
The default largest number of parallel timeouts in GoMacH.
Definition: types.h:65
End of t2u procedure.
Definition: types.h:124
Transmit data in receiver&#39;s CP period.
Definition: types.h:103
Wait for TX finish in TX-slot.
Definition: types.h:108
GoMacH&#39;s transmission procedure.
Definition: types.h:133
Wait for Send data TX finish.
Definition: types.h:123
Prepare the initialization procedure of GoMacH.
Definition: types.h:140
uint8_t queue_head
Check queue&#39;s head.
Definition: types.h:234
uint8_t queue_indicator
Node&#39;s queue-length indicator.
Definition: types.h:207
Initiate broadcast.
Definition: types.h:89
Timeout of maximum preamble interval.
Definition: types.h:180
msg_t msg
msg entity.
Definition: types.h:262
Timeout of maximum CP duration.
Definition: types.h:186
Initiate the sleep period.
Definition: types.h:158
Wait for announce TX finish.
Definition: types.h:142
Sender&#39;s vTDMA (dynamic slots allocation) management unit.
Definition: types.h:251
uint16_t sub_channel_seq
Sub-channel sequence.
Definition: types.h:281
GoMacH frame header.
Definition: hdr.h:80
Initiate the vTDMA period.
Definition: types.h:155
gnrc_gomach_t2u_state_t
State-machine states of Transmission-to-phase-unknown (t2u) procedure of GoMacH.
Definition: types.h:116
Timeout is disabled.
Definition: types.h:176
xtimer interface definitions
Describes a message object which can be sent between threads.
Definition: msg.h:185
Initiate GoMacH.
Definition: types.h:131
Header definition of GoMacH.
GoMacH&#39;s specific structure for storing internal states.
Definition: types.h:275
gnrc_gomach_l2_addr_t src_addr
Copied source address of packet.
Definition: types.h:243
Wait for receiver&#39;s CP (wake-up) period.
Definition: types.h:102
End of packet listen period.
Definition: types.h:152
Transmit data in allocate slots.
Definition: types.h:107
gnrc_gomach_timeout_type_t
GoMacH timeout types.
Definition: types.h:175
Timeout of waiting reception complete.
Definition: types.h:187
Timeout of maximum preamble duration.
Definition: types.h:181
uint8_t seq
Node&#39;s MAC packet sequence.
Definition: types.h:223
GoMacH&#39;s data structure for recording sender&#39;s past TX information.
Definition: types.h:221
End of the vTDMA period.
Definition: types.h:157
gnrc_gomach_basic_state_t basic_state
Basic state.
Definition: types.h:276
End of the initialization procedure of GoMacH.
Definition: types.h:143
uint16_t sub_channel_seq
Receiver&#39;s sub-channel sequence.
Definition: types.h:252
GoMacH&#39;s data structure for recording TX information for avoiding receiving duplicate packets...
Definition: types.h:231
gnrc_gomach_init_state_t
State-machine states of initialization procedure of GoMacH.
Definition: types.h:139
Listen for incoming packets.
Definition: types.h:151
Timeout of CP (wake-up) period ending.
Definition: types.h:185
Send preamble in t2u.
Definition: types.h:119
gnrc_gomach_l2_addr_t dst_addr
Copied destination address of packet.
Definition: types.h:244
Wait for next broadcast TX timing.
Definition: types.h:92
Type to pass information about packet parsing.
Definition: types.h:241
Wait for broadcast TX finish.
Definition: types.h:91
xtimer timer structure
Definition: xtimer.h:81
uint16_t cur_pub_channel
Current public channel.
Definition: types.h:284
Initiate t2k procedure.
Definition: types.h:101
uint8_t slots_position
Node&#39;s own slots position.
Definition: types.h:253
Timeout of waiting receiver&#39;s CP period.
Definition: types.h:182
gnrc_gomach_basic_state_t
State-machine states of basic management procedure of GoMacH.
Definition: types.h:130
GoMacH&#39;s timeout structure.
Definition: types.h:260
Timeout of vTDMA period end.
Definition: types.h:188
uint16_t pub_channel_1
Public channel 1.
Definition: types.h:282
gnrc_gomach_init_state_t init_state
Initialization state.
Definition: types.h:277
uint8_t seq
MAC sequence of the received packet.
Definition: types.h:245
gnrc_gomach_transmit_state_t
State-machine states of basic transmission management procedure of GoMacH.
Definition: types.h:166
End of t2k procedure.
Definition: types.h:109
Prepare settings before sending preamble.
Definition: types.h:118
Wait for preamble-ACK from receiver.
Definition: types.h:121
uint8_t cp_extend_count
CP extend count.
Definition: types.h:285
End of broadcast procedure.
Definition: types.h:93
Timeout of broadcast procedure end.
Definition: types.h:177
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition: ieee802154.h:45
GoMacH internal L2 address structure.
Definition: hdr.h:34
uint8_t sub_channel_seq
Receiver&#39;s sub-channel sequence.
Definition: types.h:215