mirror of
https://github.com/espressif/openthread.git
synced 2026-11-02 12:33:22 +00:00
Refactor OpenThread Global Variables into a Single Context Structure (#357)
* Refactor OpenThread to contain all global/static variables in a single context structure.
This commit is contained in:
@@ -44,6 +44,26 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WINDOWS_KERNEL
|
||||
#include <ntdef.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#else
|
||||
#ifndef CONTAINING_RECORD
|
||||
/*#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||
#define CONTAINING_RECORD(address, type, field) \
|
||||
((type *)((uint8_t*)(address) - offsetof(type, field)))
|
||||
#pragma GCC diagnostic pop*/
|
||||
#define BASE 0x1
|
||||
#define myoffsetof(s,m) (((size_t)&(((s*)BASE)->m))-BASE)
|
||||
#define CONTAINING_RECORD(address, type, field) \
|
||||
((type *)((uint8_t*)(address) - myoffsetof(type, field)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This type represents the OpenThread instance structure.
|
||||
*/
|
||||
|
||||
@@ -1621,6 +1621,8 @@ void otPlatformReset(otInstance *aInstance);
|
||||
/**
|
||||
* Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otSetRouterDowngradeThreshold
|
||||
@@ -1630,6 +1632,7 @@ uint8_t otGetRouterDowngradeThreshold(otInstance *aInstance);
|
||||
/**
|
||||
* Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otGetRouterDowngradeThreshold
|
||||
|
||||
Reference in New Issue
Block a user