2022-05-11 10:01:48 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2021-03-22 03:44:58 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
2021-06-07 04:13:58 -04:00
|
|
|
#include "esp_netif.h"
|
2021-03-22 03:44:58 -04:00
|
|
|
#include "esp_openthread_types.h"
|
|
|
|
#include "openthread/instance.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-05-11 10:01:48 -04:00
|
|
|
/**
|
|
|
|
* @brief Default configuration reference of OT esp-netif
|
|
|
|
*/
|
|
|
|
#define ESP_NETIF_INHERENT_DEFAULT_OPENTHREAD() \
|
|
|
|
{ \
|
|
|
|
.flags = 0, \
|
|
|
|
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
|
|
|
|
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
|
|
|
|
.get_ip_event = 0, \
|
|
|
|
.lost_ip_event = 0, \
|
|
|
|
.if_key = "OT_DEF", \
|
|
|
|
.if_desc = "openthread", \
|
|
|
|
.route_prio = 15 \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ESP_NETIF_DEFAULT_OPENTHREAD() \
|
|
|
|
{ \
|
|
|
|
.base = &g_esp_netif_inherent_openthread_config, \
|
|
|
|
.driver = NULL, \
|
|
|
|
.stack = &g_esp_netif_netstack_default_openthread, \
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const esp_netif_netstack_config_t g_esp_netif_netstack_default_openthread;
|
|
|
|
extern const esp_netif_inherent_config_t g_esp_netif_inherent_openthread_config;
|
|
|
|
|
2021-03-22 03:44:58 -04:00
|
|
|
/**
|
2021-05-18 23:52:51 -04:00
|
|
|
* @brief This function initializes the OpenThread network interface glue.
|
2021-03-22 03:44:58 -04:00
|
|
|
*
|
2021-06-28 07:20:51 -04:00
|
|
|
* @param[in] config The platform configuration.
|
|
|
|
*
|
2021-03-22 03:44:58 -04:00
|
|
|
* @return
|
2021-05-18 23:52:51 -04:00
|
|
|
* - glue pointer on success
|
|
|
|
* - NULL on failure
|
2021-03-22 03:44:58 -04:00
|
|
|
*
|
|
|
|
*/
|
2021-06-28 07:20:51 -04:00
|
|
|
void *esp_openthread_netif_glue_init(const esp_openthread_platform_config_t *config);
|
2021-03-22 03:44:58 -04:00
|
|
|
|
|
|
|
/**
|
2021-05-18 23:52:51 -04:00
|
|
|
* @brief This function deinitializes the OpenThread network interface glue.
|
2021-03-22 03:44:58 -04:00
|
|
|
*
|
|
|
|
*/
|
2021-05-18 23:52:51 -04:00
|
|
|
void esp_openthread_netif_glue_deinit(void);
|
2021-03-22 03:44:58 -04:00
|
|
|
|
2021-06-07 04:13:58 -04:00
|
|
|
/**
|
|
|
|
* @brief This function acquires the OpenThread netif.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* The OpenThread netif or NULL if not initialzied.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
esp_netif_t *esp_openthread_get_netif(void);
|
|
|
|
|
2021-03-22 03:44:58 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|