gnrc_netreg: introduce helper macro/function for entry init
This commit is contained in:
parent
436ff13c1c
commit
262d0d7573
@ -38,6 +38,17 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define GNRC_NETREG_DEMUX_CTX_ALL (0xffff0000)
|
#define GNRC_NETREG_DEMUX_CTX_ALL (0xffff0000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes a netreg entry statically with PID
|
||||||
|
*
|
||||||
|
* @param[in] demux_ctx The @ref gnrc_netreg_entry_t::demux_ctx "demux context"
|
||||||
|
* for the netreg entry
|
||||||
|
* @param[in] pid The PID of the registering thread
|
||||||
|
*
|
||||||
|
* @return An initialized netreg entry
|
||||||
|
*/
|
||||||
|
#define GNRC_NETREG_ENTRY_INIT_PID(demux_ctx, pid) { NULL, demux_ctx, pid }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Entry to the @ref net_gnrc_netreg
|
* @brief Entry to the @ref net_gnrc_netreg
|
||||||
*/
|
*/
|
||||||
@ -65,6 +76,24 @@ typedef struct gnrc_netreg_entry {
|
|||||||
*/
|
*/
|
||||||
void gnrc_netreg_init(void);
|
void gnrc_netreg_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes a netreg entry statically with PID
|
||||||
|
*
|
||||||
|
* @param[out] entry A netreg entry
|
||||||
|
* @param[in] demux_ctx The @ref gnrc_netreg_entry_t::demux_ctx "demux context"
|
||||||
|
* for the netreg entry
|
||||||
|
* @param[in] pid The PID of the registering thread
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static inline void gnrc_netreg_entry_init_pid(gnrc_netreg_entry_t *entry,
|
||||||
|
uint32_t demux_ctx,
|
||||||
|
kernel_pid_t pid)
|
||||||
|
{
|
||||||
|
entry->next = NULL;
|
||||||
|
entry->demux_ctx = demux_ctx;
|
||||||
|
entry->pid = pid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Registers a thread to the registry.
|
* @brief Registers a thread to the registry.
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user