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
9#pragma once
10
20
21#include <stdint.h>
22#include <stdbool.h>
23
24#include "xtimer.h"
25#include "net/gnrc/gomach/hdr.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
34#define GNRC_GOMACH_EVENT_RTT_TYPE (0x4300)
35
39#define GNRC_GOMACH_EVENT_RTT_NEW_CYCLE (0x4301)
40
44#define GNRC_GOMACH_EVENT_TIMEOUT_TYPE (0x4400)
45
49#define GNRC_GOMACH_PHASE_UNINITIALIZED (0)
50
54#define GNRC_GOMACH_PHASE_MAX (-1)
55
59#define GNRC_GOMACH_DUPCHK_BUFFER_SIZE (8U)
60
64#define GNRC_GOMACH_TIMEOUT_COUNT (6U)
65
70#define GNRC_GOMACH_SLOSCH_UNIT_COUNT (11U)
71
76#define GNRC_GOMACH_TYPE_UNKNOWN (0U)
77
82#define GNRC_GOMACH_TYPE_KNOWN (1U)
83
94
110
125
134
144
161
170
190
197
208
216
225
236
246
250typedef struct {
253 uint8_t slots_num;
255
265
269#define GNRC_GOMACH_TIMEOUT_INIT { {}, {}, false, GNRC_GOMACH_TIMEOUT_DISABLED }
270
274typedef struct gomach {
281 uint16_t pub_channel_1;
282 uint16_t pub_channel_2;
285 uint32_t last_wakeup;
287 uint16_t gomach_info;
290 int16_t rx_pkt_rssi;
292 uint8_t rx_pkt_lqi;
294
295#if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
296 /* Parameters for recording duty-cycle */
297 uint64_t last_radio_on_time_ms;
299 uint64_t radio_off_time_ms;
301 uint64_t system_start_time_ms;
303 uint64_t awake_duration_sum_ms;
305#endif
307
308#ifdef __cplusplus
309}
310#endif
311
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition ieee802154.h:45
struct xtimer xtimer_t
xtimer timer structure
Header definition of GoMacH.
GoMacH's data structure for recording TX information for avoiding receiving duplicate packets.
Definition types.h:230
uint8_t queue_head
Check queue's head.
Definition types.h:233
gnrc_gomach_dupchk_unit_t last_nodes[GNRC_GOMACH_DUPCHK_BUFFER_SIZE]
Duplicate check unit.
Definition types.h:231
GoMacH's data structure for recording sender's past TX information.
Definition types.h:220
uint8_t seq
Node's MAC packet sequence.
Definition types.h:222
uint8_t life_cycle
Lifetime of this record unit.
Definition types.h:223
gnrc_gomach_l2_addr_t node_addr
Node's address.
Definition types.h:221
GoMacH frame header.
Definition hdr.h:79
GoMacH internal L2 address structure.
Definition hdr.h:33
GoMacH internal L2 address structure.
Definition types.h:194
uint8_t addr[IEEE802154_LONG_ADDRESS_LEN]
Node's address.
Definition types.h:195
Type to pass information about packet parsing.
Definition types.h:240
gnrc_gomach_l2_addr_t src_addr
Copied source address of packet.
Definition types.h:242
gnrc_gomach_hdr_t * header
GoMacH header of packet.
Definition types.h:241
uint8_t seq
MAC sequence of the received packet.
Definition types.h:244
gnrc_gomach_l2_addr_t dst_addr
Copied destination address of packet.
Definition types.h:243
GoMacH's slot-schedule-unit.
Definition types.h:204
gnrc_gomach_l2_addr_t node_addr
Node's address.
Definition types.h:205
uint8_t queue_indicator
Node's queue-length indicator.
Definition types.h:206
GoMacH's timeout structure.
Definition types.h:259
msg_t msg
msg entity.
Definition types.h:261
xtimer_t timer
xtimer entity.
Definition types.h:260
gnrc_gomach_timeout_type_t type
GoMacH timeout type.
Definition types.h:263
bool expired
Timeout expiration indicator.
Definition types.h:262
GoMacH's vTDMA (dynamic slots allocation) management unit.
Definition types.h:212
uint8_t sub_channel_seq
Receiver's sub-channel sequence.
Definition types.h:214
uint8_t total_slots_num
Number of total allocated transmission slots.
Definition types.h:213
Sender's vTDMA (dynamic slots allocation) management unit.
Definition types.h:250
uint8_t slots_position
Node's own slots position.
Definition types.h:252
uint8_t slots_num
Node's allocated slots number.
Definition types.h:253
uint16_t sub_channel_seq
Receiver's sub-channel sequence.
Definition types.h:251
GoMacH's specific structure for storing internal states.
Definition types.h:274
uint32_t backoff_phase_us
Phase backoff time.
Definition types.h:286
uint16_t sub_channel_seq
Sub-channel sequence.
Definition types.h:280
int16_t rx_pkt_rssi
RSSI of latest received packet in dBm.
Definition types.h:290
uint32_t last_wakeup
Last wake-up timing.
Definition types.h:285
uint8_t rx_pkt_lqi
LQI of latest received packet.
Definition types.h:292
gnrc_gomach_timeout_t timeouts[GNRC_GOMACH_TIMEOUT_COUNT]
GoMacH's timeouts.
Definition types.h:277
gnrc_gomach_init_state_t init_state
Initialization state.
Definition types.h:276
uint16_t subchannel_occu_flags
Sub-channel usage indicator.
Definition types.h:278
uint16_t pub_channel_2
Public channel 2.
Definition types.h:282
gnrc_gomach_basic_state_t basic_state
Basic state.
Definition types.h:275
uint64_t last_wakeup_phase_us
Last cycle wakeup phase.
Definition types.h:289
uint16_t pub_channel_1
Public channel 1.
Definition types.h:281
uint16_t cur_pub_channel
Current public channel.
Definition types.h:283
uint16_t gomach_info
GoMacH's internal information.
Definition types.h:287
uint8_t cp_extend_count
CP extend count.
Definition types.h:284
Describes a message object which can be sent between threads.
Definition msg.h:195
#define GNRC_GOMACH_DUPCHK_BUFFER_SIZE
GoMacH check duplicate packet buffer size.
Definition types.h:59
#define GNRC_GOMACH_TIMEOUT_COUNT
The default largest number of parallel timeouts in GoMacH.
Definition types.h:64
gnrc_gomach_t2k_state_t
State-machine states of Transmission-to-phase-known (t2k) procedure of GoMacH.
Definition types.h:99
@ GNRC_GOMACH_T2K_WAIT_CPTX_FEEDBACK
Wait for CP transmission finish.
Definition types.h:103
@ GNRC_GOMACH_T2K_WAIT_BEACON
Wait receiver's beacon.
Definition types.h:104
@ GNRC_GOMACH_T2K_WAIT_SLOTS
Wait for the node's allocated slots period.
Definition types.h:105
@ GNRC_GOMACH_T2K_VTDMA_TRANS
Transmit data in allocate slots.
Definition types.h:106
@ GNRC_GOMACH_T2K_WAIT_CP
Wait for receiver's CP (wake-up) period.
Definition types.h:101
@ GNRC_GOMACH_T2K_TRANS_IN_CP
Transmit data in receiver's CP period.
Definition types.h:102
@ GNRC_GOMACH_T2K_END
End of t2k procedure.
Definition types.h:108
@ GNRC_GOMACH_T2K_WAIT_VTDMA_FEEDBACK
Wait for TX finish in TX-slot.
Definition types.h:107
@ GNRC_GOMACH_T2K_INIT
Initiate t2k procedure.
Definition types.h:100
gnrc_gomach_timeout_type_t
GoMacH timeout types.
Definition types.h:174
@ GNRC_GOMACH_TIMEOUT_PREAMBLE
Timeout of next preamble transmission.
Definition types.h:178
@ GNRC_GOMACH_TIMEOUT_WAIT_CP
Timeout of waiting receiver's CP period.
Definition types.h:181
@ GNRC_GOMACH_TIMEOUT_WAIT_BEACON
Timeout of waiting beacon.
Definition types.h:182
@ GNRC_GOMACH_TIMEOUT_BCAST_INTERVAL
Timeout of next broadcast transmission.
Definition types.h:177
@ GNRC_GOMACH_TIMEOUT_MAX_PREAM_INTERVAL
Timeout of maximum preamble interval.
Definition types.h:179
@ GNRC_GOMACH_TIMEOUT_NO_TX_ISR
Timeout of maximum transmission duration.
Definition types.h:188
@ GNRC_GOMACH_TIMEOUT_PREAM_DURATION
Timeout of maximum preamble duration.
Definition types.h:180
@ GNRC_GOMACH_TIMEOUT_WAIT_RX_END
Timeout of waiting reception complete.
Definition types.h:186
@ GNRC_GOMACH_TIMEOUT_DISABLED
Timeout is disabled.
Definition types.h:175
@ GNRC_GOMACH_TIMEOUT_CP_END
Timeout of CP (wake-up) period ending.
Definition types.h:184
@ GNRC_GOMACH_TIMEOUT_WAIT_SLOTS
Timeout of waiting own slots.
Definition types.h:183
@ GNRC_GOMACH_TIMEOUT_VTDMA
Timeout of vTDMA period end.
Definition types.h:187
@ GNRC_GOMACH_TIMEOUT_BCAST_FINISH
Timeout of broadcast procedure end.
Definition types.h:176
@ GNRC_GOMACH_TIMEOUT_CP_MAX
Timeout of maximum CP duration.
Definition types.h:185
gnrc_gomach_bcast_state_t
State-machine states of Broadcast procedure of GoMacH.
Definition types.h:87
@ GNRC_GOMACH_BCAST_INIT
Initiate broadcast.
Definition types.h:88
@ GNRC_GOMACH_BCAST_WAIT_TX_FINISH
Wait for broadcast TX finish.
Definition types.h:90
@ GNRC_GOMACH_BCAST_WAIT_NEXT_TX
Wait for next broadcast TX timing.
Definition types.h:91
@ GNRC_GOMACH_BCAST_END
End of broadcast procedure.
Definition types.h:92
@ GNRC_GOMACH_BCAST_SEND
Send broadcast packet.
Definition types.h:89
gnrc_gomach_listen_state_t
State-machine states of duty-cycled listening procedure of GoMacH.
Definition types.h:148
@ GNRC_GOMACH_LISTEN_SLEEP_END
End of the sleep period.
Definition types.h:159
@ GNRC_GOMACH_LISTEN_SLEEP
Turn radio off to sleep.
Definition types.h:158
@ GNRC_GOMACH_LISTEN_CP_END
End of packet listen period.
Definition types.h:151
@ GNRC_GOMACH_LISTEN_SEND_BEACON
Send beacon packet when needed.
Definition types.h:152
@ GNRC_GOMACH_LISTEN_VTDMA_END
End of the vTDMA period.
Definition types.h:156
@ GNRC_GOMACH_LISTEN_VTDMA
Listen for incoming packets in vTDMA.
Definition types.h:155
@ GNRC_GOMACH_LISTEN_CP_LISTEN
Listen for incoming packets.
Definition types.h:150
@ GNRC_GOMACH_LISTEN_VTDMA_INIT
Initiate the vTDMA period.
Definition types.h:154
@ GNRC_GOMACH_LISTEN_WAIT_BEACON_TX
Wait for send beacon TX finish.
Definition types.h:153
@ GNRC_GOMACH_LISTEN_CP_INIT
Initiate the listen period.
Definition types.h:149
@ GNRC_GOMACH_LISTEN_SLEEP_INIT
Initiate the sleep period.
Definition types.h:157
gnrc_gomach_basic_state_t
State-machine states of basic management procedure of GoMacH.
Definition types.h:129
@ GNRC_GOMACH_INIT
Initiate GoMacH.
Definition types.h:130
@ GNRC_GOMACH_TRANSMIT
GoMacH's transmission procedure.
Definition types.h:132
@ GNRC_GOMACH_LISTEN
GoMacH's duty-cycled listen procedure.
Definition types.h:131
gnrc_gomach_init_state_t
State-machine states of initialization procedure of GoMacH.
Definition types.h:138
@ GNRC_GOMACH_INIT_ANNC_SUBCHAN
Announce the sub-channel sequence of the node.
Definition types.h:140
@ GNRC_GOMACH_INIT_WAIT_FEEDBACK
Wait for announce TX finish.
Definition types.h:141
@ GNRC_GOMACH_INIT_PREPARE
Prepare the initialization procedure of GoMacH.
Definition types.h:139
@ GNRC_GOMACH_INIT_END
End of the initialization procedure of GoMacH.
Definition types.h:142
gnrc_gomach_transmit_state_t
State-machine states of basic transmission management procedure of GoMacH.
Definition types.h:165
@ GNRC_GOMACH_BROADCAST
Broadcast packet in GoMacH.
Definition types.h:168
@ GNRC_GOMACH_TRANS_TO_KNOWN
Transmit to phase-known node in GoMacH.
Definition types.h:167
@ GNRC_GOMACH_TRANS_TO_UNKNOWN
Transmit to phase-unknown node in GoMacH.
Definition types.h:166
gnrc_gomach_t2u_state_t
State-machine states of Transmission-to-phase-unknown (t2u) procedure of GoMacH.
Definition types.h:115
@ GNRC_GOMACH_T2U_END
End of t2u procedure.
Definition types.h:123
@ GNRC_GOMACH_T2U_SEND_PREAMBLE
Send preamble in t2u.
Definition types.h:118
@ GNRC_GOMACH_T2U_PREAMBLE_PREPARE
Prepare settings before sending preamble.
Definition types.h:117
@ GNRC_GOMACH_T2U_WAIT_PREAMBLE_TX
Wait for Send preamble TX finish.
Definition types.h:119
@ GNRC_GOMACH_T2U_WAIT_DATA_TX
Wait for Send data TX finish.
Definition types.h:122
@ GNRC_GOMACH_T2U_SEND_DATA
Send data packet to the receiver.
Definition types.h:121
@ GNRC_GOMACH_T2U_WAIT_PREAMBLE_ACK
Wait for preamble-ACK from receiver.
Definition types.h:120
@ GNRC_GOMACH_T2U_INIT
Initiate t2u procedure.
Definition types.h:116
struct gomach gnrc_gomach_t
GoMacH's specific structure for storing internal states.
xtimer interface definitions