Loading...
Searching...
No Matches
Helpers for synchronizing with transmission.

This allows upper layers to wait for a transmission to complete (or fail) and for passing up data about the transmission. More...

Detailed Description

This allows upper layers to wait for a transmission to complete (or fail) and for passing up data about the transmission.

Files

file  tx_sync.h
 Definitions for TX sync.
 

Data Structures

struct  gnrc_tx_sync_t
 TX synchronization data. More...
 

Functions

static gnrc_tx_sync_t gnrc_tx_sync_init (void)
 Helper to initialize a gnrc_tx_sync_t structure.
 
static gnrc_pktsnip_tgnrc_tx_sync_build (gnrc_tx_sync_t *tx_sync)
 Build a TX sync snip.
 
static int gnrc_tx_sync_append (gnrc_pktsnip_t *pkt, gnrc_tx_sync_t *tx_sync)
 Appends a newly allocated tx sync pktsnip to the end of the packet.
 
gnrc_pktsnip_tgnrc_tx_sync_split (gnrc_pktsnip_t *pkt)
 Split off the TX sync snip and return it.
 
static void gnrc_tx_complete (gnrc_pktsnip_t *pkt)
 Signal TX completion via the given tx sync packet snip.
 
static void gnrc_tx_sync (gnrc_tx_sync_t *sync)
 Block until transmission of the corresponding packet has completed or failed.
 

Function Documentation

◆ gnrc_tx_complete()

static void gnrc_tx_complete ( gnrc_pktsnip_t pkt)
inlinestatic

Signal TX completion via the given tx sync packet snip.

Parameters
[in]pktThe tx sync packet snip of the packet that was transmitted
Precondition
Module gnrc_netttype_tx_sync is sued
pkt->type == GNRC_NETTYPE_TX_SYNC

Definition at line 108 of file tx_sync.h.

◆ gnrc_tx_sync()

static void gnrc_tx_sync ( gnrc_tx_sync_t sync)
inlinestatic

Block until transmission of the corresponding packet has completed or failed.

Parameters
[in,out]syncTX sync structure used for synchronization
Precondition
sync has been added to the packet to synchronize with, e.g. via gnrc_tx_sync_append
The packet linked to sync has been passed to the network stack for transmission. Otherwise this will block forever.
Note
If the transmission has already completed, this function will not block and return immediately instead.

Definition at line 129 of file tx_sync.h.

◆ gnrc_tx_sync_append()

static int gnrc_tx_sync_append ( gnrc_pktsnip_t pkt,
gnrc_tx_sync_t tx_sync 
)
inlinestatic

Appends a newly allocated tx sync pktsnip to the end of the packet.

Parameters
[in]pktPacket to append TX sync pktsnip to
[in,out]tx_syncTX sync structure to initialize and append
Return values
0Success
-ENOMEMAllocation failed
Note
No need to initialize tx_sync, this function will do it for you.

Definition at line 81 of file tx_sync.h.

◆ gnrc_tx_sync_build()

static gnrc_pktsnip_t * gnrc_tx_sync_build ( gnrc_tx_sync_t tx_sync)
inlinestatic

Build a TX sync snip.

Parameters
[in,out]tx_syncTX sync structure the snip should hold
Returns
The TX sync snip holing tx_sync
Return values
NULLAllocation Failed
Note
No need to initialize tx_sync, this function will do it for you.

Definition at line 59 of file tx_sync.h.

◆ gnrc_tx_sync_init()

static gnrc_tx_sync_t gnrc_tx_sync_init ( void  )
inlinestatic

Helper to initialize a gnrc_tx_sync_t structure.

Definition at line 43 of file tx_sync.h.

◆ gnrc_tx_sync_split()

gnrc_pktsnip_t * gnrc_tx_sync_split ( gnrc_pktsnip_t pkt)

Split off the TX sync snip and return it.

Parameters
[in,out]pktPacket to split off the TX sync snip
Returns
The TX sync snip that no longer is part of pkt
Return values
NULLpkt contains no TX sync snip