net: openthread: Add OpenThread l2 api description

Add missing api description.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
This commit is contained in:
Lukasz Maciejonczyk 2020-06-17 14:43:23 +02:00 committed by Jukka Rissanen
commit c32286bd30

View file

@ -4,9 +4,20 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
/** @file
* @brief OpenThread l2 stack public header
*/
#ifndef ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ #ifndef ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
#define ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ #define ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
/**
* @brief OpenThread l2 stack api
* @defgroup OpenThread l2 layer
* @ingroup networking
* @{
*/
#include <kernel.h> #include <kernel.h>
#include <net/net_if.h> #include <net/net_if.h>
@ -17,27 +28,80 @@
extern "C" { extern "C" {
#endif #endif
/**
* @cond INTERNAL_HIDDEN
*/
/**
* @brief Type of pkt_list
*/
struct pkt_list_elem { struct pkt_list_elem {
struct net_pkt *pkt; struct net_pkt *pkt;
}; };
/**
* @brief OpenThread l2 private data.
*/
struct openthread_context { struct openthread_context {
/** Pointer to OpenThread stack instance */
otInstance *instance; otInstance *instance;
/** Pointer to OpenThread network interface */
struct net_if *iface; struct net_if *iface;
/** Index indicates the head of pkt_list ring buffer */
uint16_t pkt_list_in_idx; uint16_t pkt_list_in_idx;
/** Index indicates the tail of pkt_list ring buffer */
uint16_t pkt_list_out_idx; uint16_t pkt_list_out_idx;
/** Flag indicates that pkt_list is full */
uint8_t pkt_list_full; uint8_t pkt_list_full;
/** Array for storing net_pkt for OpenThread internal usage */
struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE]; struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE];
}; };
/**
* INTERNAL_HIDDEN @endcond
*/
/**
* @brief Sets function which will be called when certain configuration or state
* changes within OpenThread.
*
* @param cb function to call in callback procedure.
*/
void openthread_set_state_changed_cb(otStateChangedCallback cb); void openthread_set_state_changed_cb(otStateChangedCallback cb);
/**
* @brief Get OpenThread thread identification.
*/
k_tid_t openthread_thread_id_get(void); k_tid_t openthread_thread_id_get(void);
/**
* @brief Get pointer to default OpenThread context.
*
* @retval !NULL On success.
* @retval NULL On failure.
*/
struct openthread_context *openthread_get_default_context(void); struct openthread_context *openthread_get_default_context(void);
/**
* @brief Get pointer to default OpenThread instance.
*
* @retval !NULL On success.
* @retval NULL On failure.
*/
struct otInstance *openthread_get_default_instance(void); struct otInstance *openthread_get_default_instance(void);
/**
* @brief Starts the OpenThread network.
*
* @details Depends on active settings: it uses stored network configuration,
* start joining procedure or uses default network configuration. Additionally
* when the device is MTD, it sets the SED mode to properly attach the network.
*
* @param ot_context
*/
void openthread_start(struct openthread_context *ot_context); void openthread_start(struct openthread_context *ot_context);
#define OPENTHREAD_L2_CTX_TYPE struct openthread_context #define OPENTHREAD_L2_CTX_TYPE struct openthread_context
@ -46,4 +110,8 @@ void openthread_start(struct openthread_context *ot_context);
} }
#endif #endif
/**
* @}
*/
#endif /* ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ */ #endif /* ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ */