Loading...
Searching...
No Matches

Timeout APIs used by GNRC_MAC. More...

Detailed Description

Timeout APIs used by GNRC_MAC.

Author
Daniel Krebs githu.nosp@m.b@da.nosp@m.niel-.nosp@m.kreb.nosp@m.s.net
Shuguo Zhuo shugu.nosp@m.o.zh.nosp@m.uo@in.nosp@m.ria..nosp@m.fr

Definition in file timeout.h.

#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include "evtimer_msg.h"
+ Include dependency graph for timeout.h:

Go to the source code of this file.

Data Structures

struct  gnrc_mac_timeout_event_t
 Structure of the GNRC_MAC timeout event. More...
 
struct  gnrc_mac_timeout_t
 Structure holding the GNRC_MAC timeouts. More...
 
#define GNRC_MAC_EVENT_TIMEOUT_TYPE   (0x4400)
 definition for GNRC_MAC timeout event type
 
enum  gnrc_mac_timeout_type_t { GNRC_MAC_TIMEOUT_DISABLED = 0 }
 Definitions of GNRC_MAC timeout types. More...
 
void gnrc_mac_init_timeouts (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_event_t timeouts[], uint8_t num)
 Initialize the MAC timeout module of gnrc_mac before using, it also sets the timeout callback function.
 
void gnrc_mac_set_timeout (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type, uint32_t offset, kernel_pid_t pid)
 Set a MAC timeout of type.
 
int gnrc_mac_find_timeout (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
 Find a MAC timeout of type.
 
void gnrc_mac_clear_timeout (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
 Clear a MAC timeout of type.
 
static bool gnrc_mac_timeout_is_running (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
 Check whether a MAC timeout of type is running or not.
 
bool gnrc_mac_timeout_is_expired (gnrc_mac_timeout_t *mac_timeout, gnrc_mac_timeout_type_t type)
 Check whether a MAC timeout of type has expired or not.
 
void gnrc_mac_reset_timeouts (gnrc_mac_timeout_t *mac_timeout)
 Reset all the MAC timeouts.
 

Macro Definition Documentation

◆ GNRC_MAC_EVENT_TIMEOUT_TYPE

#define GNRC_MAC_EVENT_TIMEOUT_TYPE   (0x4400)

definition for GNRC_MAC timeout event type

Definition at line 37 of file timeout.h.

Enumeration Type Documentation

◆ gnrc_mac_timeout_type_t

Definitions of GNRC_MAC timeout types.

This structure can be extended to contain more needed timeout types of different MAC protocols. Please guard them by appropriate #ifdef directives when applicable.

Enumerator
GNRC_MAC_TIMEOUT_DISABLED 

Timeout is disabled, not in used.

Definition at line 46 of file timeout.h.

Function Documentation

◆ gnrc_mac_clear_timeout()

void gnrc_mac_clear_timeout ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_type_t  type 
)

Clear a MAC timeout of type.

Parameters
[in,out]mac_timeoutgnrc_mac timeout management unit
[in]typethe MAC timeout type

◆ gnrc_mac_find_timeout()

int gnrc_mac_find_timeout ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_type_t  type 
)

Find a MAC timeout of type.

Parameters
[in]mac_timeoutgnrc_mac timeout management unit
[in]typethe MAC timeout type
Returns
Return index >= 0 if found timeout, -ENONENT if not found

◆ gnrc_mac_init_timeouts()

void gnrc_mac_init_timeouts ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_event_t  timeouts[],
uint8_t  num 
)

Initialize the MAC timeout module of gnrc_mac before using, it also sets the timeout callback function.

Parameters
[in,out]mac_timeoutgnrc_mac timeout management unit
[in]timeoutsgnrc_mac timeouts
[in]numtimeout number

◆ gnrc_mac_reset_timeouts()

void gnrc_mac_reset_timeouts ( gnrc_mac_timeout_t mac_timeout)

Reset all the MAC timeouts.

Parameters
[in,out]mac_timeoutgnrc_mac timeout management unit

◆ gnrc_mac_set_timeout()

void gnrc_mac_set_timeout ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_type_t  type,
uint32_t  offset,
kernel_pid_t  pid 
)

Set a MAC timeout of type.

Parameters
[in,out]mac_timeoutgnrc_mac timeout management unit
[in]typethe MAC timeout type
[in]offsetthe timeout offset
[in]pidthe targeted thread pid

◆ gnrc_mac_timeout_is_expired()

bool gnrc_mac_timeout_is_expired ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_type_t  type 
)

Check whether a MAC timeout of type has expired or not.

Parameters
[in,out]mac_timeoutgnrc_mac timeout management unit
[in]typethe MAC timeout type
Returns
true, if the MAC time of type is expired
false, if the MAC time of type is not expired, or not exist

◆ gnrc_mac_timeout_is_running()

static bool gnrc_mac_timeout_is_running ( gnrc_mac_timeout_t mac_timeout,
gnrc_mac_timeout_type_t  type 
)
inlinestatic

Check whether a MAC timeout of type is running or not.

Parameters
[in]mac_timeoutgnrc_mac timeout management unit
[in]typethe MAC timeout type
Returns
true, if the time of type is running
false, if the time of type is not running, or not exist

Definition at line 119 of file timeout.h.