Loading...
Searching...
No Matches
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
29extern "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
95
111
126
135
145
162
171
191
195typedef struct {
198
209
217
226
237
247
251typedef struct {
254 uint8_t slots_num;
256
266
270#define GNRC_GOMACH_TIMEOUT_INIT { {}, {}, false, GNRC_GOMACH_TIMEOUT_DISABLED }
271
275typedef struct gomach {
282 uint16_t pub_channel_1;
283 uint16_t pub_channel_2;
286 uint32_t last_wakeup;
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_ms;
300 uint64_t radio_off_time_ms;
302 uint64_t system_start_time_ms;
304 uint64_t awake_duration_sum_ms;
306#endif
308
309#ifdef __cplusplus
310}
311#endif
312
313#endif /* NET_GNRC_GOMACH_TYPES_H */
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition ieee802154.h:45
Header definition of GoMacH.
GoMacH's data structure for recording TX information for avoiding receiving duplicate packets.
Definition types.h:231
uint8_t queue_head
Check queue's head.
Definition types.h:234
GoMacH's data structure for recording sender's past TX information.
Definition types.h:221
uint8_t seq
Node's MAC packet sequence.
Definition types.h:223
uint8_t life_cycle
Lifetime of this record unit.
Definition types.h:224
gnrc_gomach_l2_addr_t node_addr
Node's address.
Definition types.h:222
GoMacH frame header.
Definition hdr.h:80
GoMacH internal L2 address structure.
Definition hdr.h:34
GoMacH internal L2 address structure.
Definition types.h:195
Type to pass information about packet parsing.
Definition types.h:241
gnrc_gomach_l2_addr_t src_addr
Copied source address of packet.
Definition types.h:243
gnrc_gomach_hdr_t * header
GoMacH header of packet.
Definition types.h:242
uint8_t seq
MAC sequence of the received packet.
Definition types.h:245
gnrc_gomach_l2_addr_t dst_addr
Copied destination address of packet.
Definition types.h:244
GoMacH's slot-schedule-unit.
Definition types.h:205
gnrc_gomach_l2_addr_t node_addr
Node's address.
Definition types.h:206
uint8_t queue_indicator
Node's queue-length indicator.
Definition types.h:207
GoMacH's timeout structure.
Definition types.h:260
msg_t msg
msg entity.
Definition types.h:262
xtimer_t timer
xtimer entity.
Definition types.h:261
gnrc_gomach_timeout_type_t type
GoMacH timeout type.
Definition types.h:264
bool expired
Timeout expiration indicator.
Definition types.h:263
GoMacH's vTDMA (dynamic slots allocation) management unit.
Definition types.h:213
uint8_t sub_channel_seq
Receiver's sub-channel sequence.
Definition types.h:215
uint8_t total_slots_num
Number of total allocated transmission slots.
Definition types.h:214
Sender's vTDMA (dynamic slots allocation) management unit.
Definition types.h:251
uint8_t slots_position
Node's own slots position.
Definition types.h:253
uint8_t slots_num
Node's allocated slots number.
Definition types.h:254
uint16_t sub_channel_seq
Receiver's sub-channel sequence.
Definition types.h:252
GoMacH's specific structure for storing internal states.
Definition types.h:275
uint32_t backoff_phase_us
Phase backoff time.
Definition types.h:287
uint16_t sub_channel_seq
Sub-channel sequence.
Definition types.h:281
int16_t rx_pkt_rssi
RSSI of latest received packet in dBm.
Definition types.h:291
uint32_t last_wakeup
Last wake-up timing.
Definition types.h:286
uint8_t rx_pkt_lqi
LQI of latest received packet.
Definition types.h:293
gnrc_gomach_timeout_t timeouts[GNRC_GOMACH_TIMEOUT_COUNT]
GoMacH's timeouts.
Definition types.h:278
gnrc_gomach_init_state_t init_state
Initialization state.
Definition types.h:277
uint16_t subchannel_occu_flags
Sub-channel usage indicator.
Definition types.h:279
uint16_t pub_channel_2
Public channel 2.
Definition types.h:283
gnrc_gomach_basic_state_t basic_state
Basic state.
Definition types.h:276
uint64_t last_wakeup_phase_us
Last cycle wakeup phase.
Definition types.h:290
uint16_t pub_channel_1
Public channel 1.
Definition types.h:282
uint16_t cur_pub_channel
Current public channel.
Definition types.h:284
uint16_t gomach_info
GoMacH's internal information.
Definition types.h:288
uint8_t cp_extend_count
CP extend count.
Definition types.h:285
Describes a message object which can be sent between threads.
Definition msg.h:196
xtimer timer structure
Definition xtimer.h:97
#define GNRC_GOMACH_DUPCHK_BUFFER_SIZE
GoMacH check duplicate packet buffer size.
Definition types.h:60
#define GNRC_GOMACH_TIMEOUT_COUNT
The default largest number of parallel timeouts in GoMacH.
Definition types.h:65
gnrc_gomach_t2k_state_t
State-machine states of Transmission-to-phase-known (t2k) procedure of GoMacH.
Definition types.h:100
@ GNRC_GOMACH_T2K_WAIT_CPTX_FEEDBACK
Wait for CP transmission finish.
Definition types.h:104
@ GNRC_GOMACH_T2K_WAIT_BEACON
Wait receiver's beacon.
Definition types.h:105
@ GNRC_GOMACH_T2K_WAIT_SLOTS
Wait for the node's allocated slots period.
Definition types.h:106
@ GNRC_GOMACH_T2K_VTDMA_TRANS
Transmit data in allocate slots.
Definition types.h:107
@ GNRC_GOMACH_T2K_WAIT_CP
Wait for receiver's CP (wake-up) period.
Definition types.h:102
@ GNRC_GOMACH_T2K_TRANS_IN_CP
Transmit data in receiver's CP period.
Definition types.h:103
@ GNRC_GOMACH_T2K_END
End of t2k procedure.
Definition types.h:109
@ GNRC_GOMACH_T2K_WAIT_VTDMA_FEEDBACK
Wait for TX finish in TX-slot.
Definition types.h:108
@ GNRC_GOMACH_T2K_INIT
Initiate t2k procedure.
Definition types.h:101
gnrc_gomach_timeout_type_t
GoMacH timeout types.
Definition types.h:175
@ GNRC_GOMACH_TIMEOUT_PREAMBLE
Timeout of next preamble transmission.
Definition types.h:179
@ GNRC_GOMACH_TIMEOUT_WAIT_CP
Timeout of waiting receiver's CP period.
Definition types.h:182
@ GNRC_GOMACH_TIMEOUT_WAIT_BEACON
Timeout of waiting beacon.
Definition types.h:183
@ GNRC_GOMACH_TIMEOUT_BCAST_INTERVAL
Timeout of next broadcast transmission.
Definition types.h:178
@ GNRC_GOMACH_TIMEOUT_MAX_PREAM_INTERVAL
Timeout of maximum preamble interval.
Definition types.h:180
@ GNRC_GOMACH_TIMEOUT_NO_TX_ISR
Timeout of maximum transmission duration.
Definition types.h:189
@ GNRC_GOMACH_TIMEOUT_PREAM_DURATION
Timeout of maximum preamble duration.
Definition types.h:181
@ GNRC_GOMACH_TIMEOUT_WAIT_RX_END
Timeout of waiting reception complete.
Definition types.h:187
@ GNRC_GOMACH_TIMEOUT_DISABLED
Timeout is disabled.
Definition types.h:176
@ GNRC_GOMACH_TIMEOUT_CP_END
Timeout of CP (wake-up) period ending.
Definition types.h:185
@ GNRC_GOMACH_TIMEOUT_WAIT_SLOTS
Timeout of waiting own slots.
Definition types.h:184
@ GNRC_GOMACH_TIMEOUT_VTDMA
Timeout of vTDMA period end.
Definition types.h:188
@ GNRC_GOMACH_TIMEOUT_BCAST_FINISH
Timeout of broadcast procedure end.
Definition types.h:177
@ GNRC_GOMACH_TIMEOUT_CP_MAX
Timeout of maximum CP duration.
Definition types.h:186
gnrc_gomach_bcast_state_t
State-machine states of Broadcast procedure of GoMacH.
Definition types.h:88
@ GNRC_GOMACH_BCAST_INIT
Initiate broadcast.
Definition types.h:89
@ GNRC_GOMACH_BCAST_WAIT_TX_FINISH
Wait for broadcast TX finish.
Definition types.h:91
@ GNRC_GOMACH_BCAST_WAIT_NEXT_TX
Wait for next broadcast TX timing.
Definition types.h:92
@ GNRC_GOMACH_BCAST_END
End of broadcast procedure.
Definition types.h:93
@ GNRC_GOMACH_BCAST_SEND
Send broadcast packet.
Definition types.h:90
gnrc_gomach_listen_state_t
State-machine states of duty-cycled listening procedure of GoMacH.
Definition types.h:149
@ GNRC_GOMACH_LISTEN_SLEEP_END
End of the sleep period.
Definition types.h:160
@ GNRC_GOMACH_LISTEN_SLEEP
Turn radio off to sleep.
Definition types.h:159
@ GNRC_GOMACH_LISTEN_CP_END
End of packet listen period.
Definition types.h:152
@ GNRC_GOMACH_LISTEN_SEND_BEACON
Send beacon packet when needed.
Definition types.h:153
@ GNRC_GOMACH_LISTEN_VTDMA_END
End of the vTDMA period.
Definition types.h:157
@ GNRC_GOMACH_LISTEN_VTDMA
Listen for incoming packets in vTDMA.
Definition types.h:156
@ GNRC_GOMACH_LISTEN_CP_LISTEN
Listen for incoming packets.
Definition types.h:151
@ GNRC_GOMACH_LISTEN_VTDMA_INIT
Initiate the vTDMA period.
Definition types.h:155
@ GNRC_GOMACH_LISTEN_WAIT_BEACON_TX
Wait for send beacon TX finish.
Definition types.h:154
@ GNRC_GOMACH_LISTEN_CP_INIT
Initiate the listen period.
Definition types.h:150
@ GNRC_GOMACH_LISTEN_SLEEP_INIT
Initiate the sleep period.
Definition types.h:158
gnrc_gomach_basic_state_t
State-machine states of basic management procedure of GoMacH.
Definition types.h:130
@ GNRC_GOMACH_INIT
Initiate GoMacH.
Definition types.h:131
@ GNRC_GOMACH_TRANSMIT
GoMacH's transmission procedure.
Definition types.h:133
@ GNRC_GOMACH_LISTEN
GoMacH's duty-cycled listen procedure.
Definition types.h:132
gnrc_gomach_init_state_t
State-machine states of initialization procedure of GoMacH.
Definition types.h:139
@ GNRC_GOMACH_INIT_ANNC_SUBCHAN
Announce the sub-channel sequence of the node.
Definition types.h:141
@ GNRC_GOMACH_INIT_WAIT_FEEDBACK
Wait for announce TX finish.
Definition types.h:142
@ GNRC_GOMACH_INIT_PREPARE
Prepare the initialization procedure of GoMacH.
Definition types.h:140
@ GNRC_GOMACH_INIT_END
End of the initialization procedure of GoMacH.
Definition types.h:143
gnrc_gomach_transmit_state_t
State-machine states of basic transmission management procedure of GoMacH.
Definition types.h:166
@ GNRC_GOMACH_BROADCAST
Broadcast packet in GoMacH.
Definition types.h:169
@ GNRC_GOMACH_TRANS_TO_KNOWN
Transmit to phase-known node in GoMacH.
Definition types.h:168
@ GNRC_GOMACH_TRANS_TO_UNKNOWN
Transmit to phase-unknown node in GoMacH.
Definition types.h:167
gnrc_gomach_t2u_state_t
State-machine states of Transmission-to-phase-unknown (t2u) procedure of GoMacH.
Definition types.h:116
@ GNRC_GOMACH_T2U_END
End of t2u procedure.
Definition types.h:124
@ GNRC_GOMACH_T2U_SEND_PREAMBLE
Send preamble in t2u.
Definition types.h:119
@ GNRC_GOMACH_T2U_PREAMBLE_PREPARE
Prepare settings before sending preamble.
Definition types.h:118
@ GNRC_GOMACH_T2U_WAIT_PREAMBLE_TX
Wait for Send preamble TX finish.
Definition types.h:120
@ GNRC_GOMACH_T2U_WAIT_DATA_TX
Wait for Send data TX finish.
Definition types.h:123
@ GNRC_GOMACH_T2U_SEND_DATA
Send data packet to the receiver.
Definition types.h:122
@ GNRC_GOMACH_T2U_WAIT_PREAMBLE_ACK
Wait for preamble-ACK from receiver.
Definition types.h:121
@ GNRC_GOMACH_T2U_INIT
Initiate t2u procedure.
Definition types.h:117
struct gomach gnrc_gomach_t
GoMacH's specific structure for storing internal states.
xtimer interface definitions