gomach_internal.h

GoMacH’s internal functions.

GNRC_GOMACH_INFO_TX_FINISHED

Flag to track if the transmission has finished.

1
(0x0008U)
GNRC_GOMACH_INFO_PKT_RECEIVED

Flag to track if a packet has been successfully received.

1
(0x0010U)
GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE

Flag to track if need to update GoMacH.

1
(0x0001U)
GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE

Flag to track if need to quit the current cycle in GoMacH.

1
(0x0002U)
GNRC_GOMACH_INTERNAL_INFO_CP_END

Flag to track if CP period has ended in GoMacH.

1
(0x0004U)
GNRC_GOMACH_INTERNAL_INFO_VTDMA_END

Flag to track if vTDMA has ended in GoMacH.

1
(0x0008U)
GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE

Flag to track if the node has received unintended preamble.

1
(0x0010U)
GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE

Flag to track if need to quit the current cycle in GoMacH.

1
(0x0020U)
GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START

Flag to track if node’s duty-cycle has started in GoMacH.

1
(0x0040U)
GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF

Flag to track if node need to backoff its phase in GoMacH.

1
(0x0080U)
GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL

Flag to track if beacon transmission fail in GoMacH.

1
(0x0200U)
GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL

Flag to track if node’s packet buffer is full in GoMacH.

1
(0x0400U)
GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE

Flag to track if node has entered a new cycle in GoMacH.

1
(0x0800U)
GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK

Flag to track if node has got preamble-ACK in GoMacH.

1
(0x1000U)
GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1

Flag to track if node’s radio is on public-channel-1.

1
(0x2000U)
GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV

Flag to track if node has reached maximum preamble interval.

1
(0x4000U)
GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON

Flag to track if node has turned on its radio.

1
(0x8000U)
void gnrc_gomach_set_tx_finish(gnrc_netif_t * netif, bool tx_finish)

Set the gomach_internal.h::GNRC_GOMACH_INFO_TX_FINISHED flag of the device.

Parameters

netif:the network interface.
tx_finish:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INFO_TX_FINISHED flag.

bool gnrc_gomach_get_tx_finish(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INFO_TX_FINISHED flag of the device.

Parameters

netif:the network interface.

Return values

  • true if TX has finished.
  • false if TX hasn’t finished yet.
void gnrc_gomach_set_pkt_received(gnrc_netif_t * netif, bool received)

Set the gomach_internal.h::GNRC_GOMACH_INFO_PKT_RECEIVED flag of the device.

Parameters

netif:the network interface.
received:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INFO_PKT_RECEIVED flag.

bool gnrc_gomach_get_pkt_received(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INFO_PKT_RECEIVED flag of the device.

Parameters

netif:the network interface.

Return values

  • true if radio has successfully received a packet.
  • false if radio hasn’t received a packet yet.
void gnrc_gomach_set_quit_cycle(gnrc_netif_t * netif, bool quit)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE flag of the device.

Parameters

netif:the network interface.
quit:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE flag.

bool gnrc_gomach_get_quit_cycle(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE flag of the device.

Parameters

netif:the network interface.

Return values

  • true if need to quit cycle.
  • false if no need to quit cycle.
void gnrc_gomach_set_got_preamble(gnrc_netif_t * netif, bool got_preamble)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE flag of the device.

Parameters

netif:the network interface.
got_preamble:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE flag.

bool gnrc_gomach_get_got_preamble(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE flag of the device.

Parameters

netif:the network interface.

Return values

  • true if get preamble packet.
  • false if not get preamble packet yet.
void gnrc_gomach_set_cp_end(gnrc_netif_t * netif, bool cp_end)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_CP_END flag of the device.

Parameters

netif:the network interface.
cp_end:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_CP_END flag.

bool gnrc_gomach_get_cp_end(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_CP_END flag of the device.

Parameters

netif:the network interface.

Return values

  • true if cp has ended.
  • false if cp hasn’t ended yet.
void gnrc_gomach_set_vTDMA_end(gnrc_netif_t * netif, bool vtdma_end)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_VTDMA_END flag of the device.

Parameters

netif:the network interface.
vtdma_end:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_VTDMA_END flag.

bool gnrc_gomach_get_vTDMA_end(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_VTDMA_END flag of the device.

Parameters

netif:the network interface.

Return values

  • true if vTDMA has ended.
  • false if vTDMA hasn’t ended yet.
void gnrc_gomach_set_unintd_preamble(gnrc_netif_t * netif, bool uintd_preamble)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE flag of the device.

Parameters

netif:the network interface.
uintd_preamble:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE flag.

bool gnrc_gomach_get_unintd_preamble(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE flag of the device.

Parameters

netif:the network interface.

Return values

  • true if has received unintended-preamble.
  • false if hasn’t received unintended-preamble yet.
void gnrc_gomach_set_update(gnrc_netif_t * netif, bool update)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE flag of the device.

Parameters

netif:the network interface.
update:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE flag.

bool gnrc_gomach_get_update(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE flag of the device.

Parameters

netif:the network interface.

Return values

  • true if need update GoMacH.
  • false if no need to update GoMacH.
void gnrc_gomach_set_duty_cycle_start(gnrc_netif_t * netif, bool start)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START flag of the device.

Parameters

netif:the network interface.
start:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START flag.

bool gnrc_gomach_get_duty_cycle_start(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START flag of the device.

Parameters

netif:the network interface.

Return values

  • true if duty-cycle has started.
  • false if duty-cycle hasn’t started yet.
void gnrc_gomach_set_phase_backoff(gnrc_netif_t * netif, bool backoff)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF flag of the device.

Parameters

netif:the network interface.
backoff:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF flag.

bool gnrc_gomach_get_phase_backoff(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF flag of the device.

Parameters

netif:the network interface.

Return values

  • true if need to run phase backoff.
  • false if no need to run phase backoff.
void gnrc_gomach_set_beacon_fail(gnrc_netif_t * netif, bool fail)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL flag of the device.

Parameters

netif:the network interface.
fail:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL flag.

bool gnrc_gomach_get_beacon_fail(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL flag of the device.

Parameters

netif:the network interface.

Return values

  • true if send beacon fail.
  • false upon beacon transmission success.
void gnrc_gomach_set_buffer_full(gnrc_netif_t * netif, bool full)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL flag of the device.

Parameters

netif:the network interface.
full:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL flag.

bool gnrc_gomach_get_buffer_full(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL flag of the device.

Parameters

netif:the network interface.

Return values

  • true if node’s packet buffer is full.
  • false if node’s packet buffer is not full.
void gnrc_gomach_set_enter_new_cycle(gnrc_netif_t * netif, bool enter)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE flag of the device.

Parameters

netif:the network interface.
enter:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE flag.

bool gnrc_gomach_get_enter_new_cycle(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE flag of the device.

Parameters

netif:the network interface.

Return values

  • true if node has entered a new cycle.
  • false if node hasn’t entered a new cycle yet.
void gnrc_gomach_set_got_preamble_ack(gnrc_netif_t * netif, bool got)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK flag of the device.

Parameters

netif:the network interface.
got:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK flag.

bool gnrc_gomach_get_got_preamble_ack(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK flag of the device.

Parameters

netif:the network interface.

Return values

  • true if node has got preamble-ACK.
  • false if node hasn’t got preamble-ACK yet.
void gnrc_gomach_set_on_pubchan_1(gnrc_netif_t * netif, bool on_pubchan_1)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 flag of the device.

Parameters

netif:the network interface.
on_pubchan_1:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 flag.

bool gnrc_gomach_get_on_pubchan_1(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 flag of the device.

Parameters

netif:the network interface.

Return values

  • true if node is on public channel 1.
  • false if node is not on public channel 1.
void gnrc_gomach_set_max_pream_interv(gnrc_netif_t * netif, bool max)

Set the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV flag of the device.

Parameters

netif:the network interface.
max:value for GoMacH’s gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV flag.

bool gnrc_gomach_get_max_pream_interv(gnrc_netif_t * netif)

Get the gomach_internal.h::GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV flag of the device.

Parameters

netif:the network interface.

Return values

  • true if node has reached maximum preamble interval.
  • false if node hasn’t reached maximum preamble interval yet.
uint64_t gnrc_gomach_phase_now(gnrc_netif_t * netif)

Get device’s current phase.

Parameters

netif:the network interface.

Return values

  • device’s current phase.
void gnrc_gomach_set_netdev_state(gnrc_netif_t * netif, netopt.h::netopt_state_t devstate)

Shortcut to set the state of netdev.

Parameters

netif:ptr to the network interface
devstate:new state for netdev

void gnrc_gomach_set_autoack(gnrc_netif_t * netif, netopt.h::netopt_enable_t autoack)

Set the auto-ACK parameter of the device.

Parameters

netif:the network interface.
autoack:value for the auto-ACK parameter.

void gnrc_gomach_set_ack_req(gnrc_netif_t * netif, netopt.h::netopt_enable_t ack_req)

Set the ACK-require parameter of the device.

Parameters

netif:the network interface.
ack_req:value for the ACK-require parameter.

netopt.h::netopt_state_t gnrc_gomach_get_netdev_state(gnrc_netif_t * netif)

Shortcut to get the state of netdev.

Parameters

netif:the network interface.

Return values

  • state of netdev upon success.
  • -ENOSYS, upon failure.
void gnrc_gomach_turn_channel(gnrc_netif_t * netif, uint16_t channel_num)

Turn the radio to a specific channel.

Parameters

netif:the network interface.
channel_num:targeted channel number to turn to.

int _gnrc_gomach_transmit(gnrc_netif_t * netif, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

send a packet over the network interface in GoMacH

bool gnrc_gomach_check_duplicate(gnrc_netif_t * netif, gnrc_gomach_packet_info_t * pa_info)

Check if the received packet is a duplicate packet.

Parameters

netif:the network interface.
pa_info:ptr to received packet’s parsed information.

Return values

  • true if the received packet is a duplicate packet.
  • false if the received packet is not a duplicate packet.
int gnrc_gomach_send(gnrc_netif_t * netif, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt, netopt.h::netopt_enable_t csma_enable)

Send a pktsnip in GoMacH.

Parameters

netif:the network interface.
pkt:ptr to the packet for sending.
csma_enable:value of csma-enable parameter.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
int gnrc_gomach_send_preamble_ack(gnrc_netif_t * netif, gnrc_gomach_packet_info_t * info)

Reply a preamble-ACK packet in GoMacH.

Parameters

netif:the network interface.
info:ptr to the info of the preamble packet.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
int gnrc_gomach_send_beacon(gnrc_netif_t * netif)

Broadcast a beacon packet in GoMacH.

Parameters

netif:the network interface.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
int gnrc_gomach_dispatch_defer(include/net/gnrc/pkt.h::gnrc_pktsnip_t * buffer, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

Store the received packet to the dispatch buffer.

Parameters

buffer:RX dispatch packet buffer
pkt:received packet

Return values

  • 0 if correctly stored
  • <0 on error
void gnrc_gomach_indicator_update(gnrc_netif_t * netif, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt, gnrc_gomach_packet_info_t * pa_info)

Update the queue-length indicator of the packet sender.

Parameters

netif:the network interface.
pkt:received packet
pa_info:ptr to the info of the received packet.

void gnrc_gomach_cp_packet_process(gnrc_netif_t * netif)

Process packets received during the CP (wake-up) period of GoMacH.

Parameters

netif:the network interface.

void gnrc_gomach_init_choose_subchannel(gnrc_netif_t * netif)

Choose a sub-channel for a device running GoMacH.

Parameters

netif:the network interface.

int gnrc_gomach_bcast_subchann_seq(gnrc_netif_t * netif, netopt.h::netopt_enable_t use_csma)

Broadcast the chosen sub-channel sequence to the device’s neighbors.

Parameters

netif:the network interface.
use_csma:value of csma-enable parameter.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
int gnrc_gomach_send_preamble(gnrc_netif_t * netif, netopt.h::netopt_enable_t csma_enable)

Send a preamble packet to the targeted neighbor.

Parameters

netif:the network interface.
csma_enable:value of csma-enable parameter.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
void gnrc_gomach_process_preamble_ack(gnrc_netif_t * netif, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

Process the received preamble-ACK packet to get phase-locked with the sender.

Parameters

netif:the network interface.
pkt:ptr to the received preamble-ACK.

void gnrc_gomach_process_pkt_in_wait_preamble_ack(gnrc_netif_t * netif)

Process the received packets to when waiting for the preamble-ACK packet.

Parameters

netif:the network interface.

int gnrc_gomach_send_data(gnrc_netif_t * netif, netopt.h::netopt_enable_t csma_enable)

Send a data packet to the targeted neighbor.

Parameters

netif:the network interface.
csma_enable:value of csma-enable parameter.

Return values

  • >0 upon sending success.
  • 0< upon sending failure.
bool gnrc_gomach_find_next_tx_neighbor(gnrc_netif_t * netif)

Find a neighbor that is next to send packet to.

Parameters

netif:the network interface.

Return values

  • true, if found next TX neighbor.
  • false, if not found next TX neighbor.
void gnrc_gomach_beacon_process(gnrc_netif_t * netif, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

Process the received beacon packet.

Parameters

netif:the network interface.
pkt:ptr to the received beacon.

void gnrc_gomach_packet_process_in_wait_beacon(gnrc_netif_t * netif)

Process the received packets when waiting for the beacon during t2k procedure in GoMacH.

Parameters

netif:the network interface.

void gnrc_gomach_packet_process_in_vtdma(gnrc_netif_t * netif)

Process the received packets in the vTDMA period in GoMacH.

Parameters

netif:the network interface.

void gnrc_gomach_update_neighbor_phase(gnrc_netif_t * netif)

Update the TX neighbors’ phases in GoMacH.

Parameters

netif:the network interface.

void gnrc_gomach_update_neighbor_pubchan(gnrc_netif_t * netif)

Update the TX neighbors’ public channel phase in GoMacH.

Parameters

netif:the network interface.