Timeout APIs used by GNRC_MAC.
More...
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include "evtimer_msg.h"
Go to the source code of this file.
|
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.
|
|
◆ 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.
◆ 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.
◆ gnrc_mac_clear_timeout()
Clear a MAC timeout of type
.
- Parameters
-
[in,out] | mac_timeout | gnrc_mac timeout management unit |
[in] | type | the MAC timeout type |
◆ gnrc_mac_find_timeout()
Find a MAC timeout of type
.
- Parameters
-
[in] | mac_timeout | gnrc_mac timeout management unit |
[in] | type | the MAC timeout type |
- Returns
- Return index >= 0 if found timeout, -ENONENT if not found
◆ gnrc_mac_init_timeouts()
Initialize the MAC timeout module of gnrc_mac before using, it also sets the timeout callback function.
- Parameters
-
[in,out] | mac_timeout | gnrc_mac timeout management unit |
[in] | timeouts | gnrc_mac timeouts |
[in] | num | timeout number |
◆ gnrc_mac_reset_timeouts()
Reset all the MAC timeouts.
- Parameters
-
[in,out] | mac_timeout | gnrc_mac timeout management unit |
◆ gnrc_mac_set_timeout()
Set a MAC timeout of type
.
- Parameters
-
[in,out] | mac_timeout | gnrc_mac timeout management unit |
[in] | type | the MAC timeout type |
[in] | offset | the timeout offset |
[in] | pid | the targeted thread pid |
◆ gnrc_mac_timeout_is_expired()
Check whether a MAC timeout of type
has expired or not.
- Parameters
-
[in,out] | mac_timeout | gnrc_mac timeout management unit |
[in] | type | the 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()
Check whether a MAC timeout of type
is running or not.
- Parameters
-
[in] | mac_timeout | gnrc_mac timeout management unit |
[in] | type | the 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.