1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_netreg: enhance doc on entry initialization

This commit is contained in:
Martine Lenders 2017-08-02 10:46:21 +02:00
parent 170277967c
commit d24e072af2

View File

@ -79,6 +79,11 @@ typedef enum {
*/ */
#define GNRC_NETREG_DEMUX_CTX_ALL (0xffff0000) #define GNRC_NETREG_DEMUX_CTX_ALL (0xffff0000)
/**
* @name Static entry initialization macros
* @anchor net_gnrc_netreg_init_static
* @{
*/
/** /**
* @brief Initializes a netreg entry statically with PID * @brief Initializes a netreg entry statically with PID
* *
@ -128,6 +133,7 @@ typedef enum {
#define GNRC_NETREG_ENTRY_INIT_CB(demux_ctx, cbd) { NULL, demux_ctx, \ #define GNRC_NETREG_ENTRY_INIT_CB(demux_ctx, cbd) { NULL, demux_ctx, \
GNRC_NETREG_TYPE_CB, \ GNRC_NETREG_TYPE_CB, \
{ .cbd = cbd } } { .cbd = cbd } }
/** @} */
/** /**
* @brief Packet handler callback for netreg entries with callback. * @brief Packet handler callback for netreg entries with callback.
@ -211,6 +217,11 @@ typedef struct gnrc_netreg_entry {
*/ */
void gnrc_netreg_init(void); void gnrc_netreg_init(void);
/**
* @name Dynamic entry initialization functions
* @anchor net_gnrc_netreg_init_dyn
* @{
*/
/** /**
* @brief Initializes a netreg entry dynamically with PID * @brief Initializes a netreg entry dynamically with PID
* *
@ -275,6 +286,7 @@ static inline void gnrc_netreg_entry_init_cb(gnrc_netreg_entry_t *entry,
entry->target.cbd = cbd; entry->target.cbd = cbd;
} }
#endif #endif
/** @} */
/** /**
* @brief Registers a thread to the registry. * @brief Registers a thread to the registry.
@ -284,8 +296,11 @@ static inline void gnrc_netreg_entry_init_cb(gnrc_netreg_entry_t *entry,
* *
* @param[in] type Type of the protocol. Must not be < GNRC_NETTYPE_UNDEF or * @param[in] type Type of the protocol. Must not be < GNRC_NETTYPE_UNDEF or
* >= GNRC_NETTYPE_NUMOF. * >= GNRC_NETTYPE_NUMOF.
* @param[in] entry An entry you want to add to the registry with * @param[in] entry An entry you want to add to the registry. This needs to
* gnrc_netreg_entry_t::pid and gnrc_netreg_entry_t::demux_ctx set. * be initialized before hand using the @ref
* net_gnrc_netreg_init_static "static" or @ref
* net_gnrc_netreg_init_dyn "dynamic" initialization
* helpers.
* *
* @warning Call gnrc_netreg_unregister() *before* you leave the context you * @warning Call gnrc_netreg_unregister() *before* you leave the context you
* allocated @p entry in. Otherwise it might get overwritten. * allocated @p entry in. Otherwise it might get overwritten.