Skip to content

Commit

Permalink
Add StopThreadTask API.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Jan 9, 2025
1 parent 4a19630 commit d7bb2c5
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 17 deletions.
1 change: 1 addition & 0 deletions examples/platform/esp32/common/Esp32ThreadInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void ESPOpenThreadDeinit()
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
openthread_deinit_br_rcp();
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP
ThreadStackMgr().StopThreadStack();
ThreadStackMgr().DeinitThreadStack();
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
}
6 changes: 6 additions & 0 deletions src/include/platform/ThreadStackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class ThreadStackManager
void DeinitThreadStack();
void ProcessThreadActivity();
CHIP_ERROR StartThreadTask();
void StopThreadStack();
void LockThreadStack();
bool TryLockThreadStack();
void UnlockThreadStack();
Expand Down Expand Up @@ -257,6 +258,11 @@ inline CHIP_ERROR ThreadStackManager::StartThreadTask()
return static_cast<ImplClass *>(this)->_StartThreadTask();
}

inline void ThreadStackManager::StopThreadStack()
{
static_cast<ImplClass *>(this)->_StopThreadStack();
}

inline void ThreadStackManager::LockThreadStack()
{
static_cast<ImplClass *>(this)->_LockThreadStack();
Expand Down
2 changes: 1 addition & 1 deletion src/platform/ESP32/ESP32Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ CHIP_ERROR ESP32Utils::InitWiFiStack(void)
return CHIP_NO_ERROR;
}

CHIP_ERROR ESP32Utils::DeInitWiFiStack(void)
CHIP_ERROR ESP32Utils::DeinitWiFiStack(void)
{
esp_err_t err = esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent);
if (err != ESP_OK)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/ESP32/ESP32Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ESP32Utils
static CHIP_ERROR SetWiFiStationProvision(const Internal::DeviceNetworkInfo & netInfo);
static CHIP_ERROR ClearWiFiStationProvision(void);
static CHIP_ERROR InitWiFiStack(void);
static CHIP_ERROR DeInitWiFiStack(void);
static CHIP_ERROR DeinitWiFiStack(void);

static CHIP_ERROR MapError(esp_err_t error);
static void RegisterESP32ErrorFormatter();
Expand Down
6 changes: 5 additions & 1 deletion src/platform/ESP32/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack()

void ThreadStackManagerImpl::_DeinitThreadStack()
{
openthread_delete_task();
openthread_deinit_stack();
}

Expand All @@ -72,6 +71,11 @@ CHIP_ERROR ThreadStackManagerImpl::_StartThreadTask()
return CHIP_NO_ERROR;
}

void ThreadStackManagerImpl::_StopThreadStack()
{
openthread_delete_task();
}

void ThreadStackManagerImpl::_LockThreadStack()
{
esp_openthread_lock_acquire(portMAX_DELAY);
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,

protected:
CHIP_ERROR _StartThreadTask();
void _StopThreadStack();
void _LockThreadStack();
bool _TryLockThreadStack();
void _UnlockThreadStack();
Expand Down
1 change: 1 addition & 0 deletions src/platform/Infineon/CYW30739/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _StartThreadTask();
void _DeinitThreadStack() {}
void _LockThreadStack();
bool _TryLockThreadStack();
void _UnlockThreadStack();
Expand Down
3 changes: 2 additions & 1 deletion src/platform/Linux/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ class ThreadStackManagerImpl : public ThreadStackManager
}

CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _ProcessThreadActivity();

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; } // Intentionally left blank
void _StopThreadStack() {} // Intentionally left blank
void _LockThreadStack() {} // Intentionally left blank
bool _TryLockThreadStack() { return false; } // Intentionally left blank
void _UnlockThreadStack() {} // Intentionally left blank
Expand Down
3 changes: 2 additions & 1 deletion src/platform/NuttX/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ class ThreadStackManagerImpl : public ThreadStackManager
}

CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _ProcessThreadActivity();

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; } // Intentionally left blank
void _StopThreadStack() {} // Intentionally left blank
void _LockThreadStack() {} // Intentionally left blank
bool _TryLockThreadStack() { return false; } // Intentionally left blank
void _UnlockThreadStack() {} // Intentionally left blank
Expand Down
3 changes: 2 additions & 1 deletion src/platform/Tizen/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ class ThreadStackManagerImpl : public ThreadStackManager
ThreadStackManagerImpl();

CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _ProcessThreadActivity();

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; } // Intentionally left blank
void _StopThreadStack() {} // Intentionally left blank
void _LockThreadStack() {} // Intentionally left blank
bool _TryLockThreadStack() { return false; } // Intentionally left blank
void _UnlockThreadStack() {} // Intentionally left blank
Expand Down
3 changes: 2 additions & 1 deletion src/platform/Zephyr/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
public:
// ===== Methods that implement the ThreadStackManager abstract interface.
CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}

protected:
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; }
void _StopThreadStack() {}
void _LockThreadStack();
bool _TryLockThreadStack();
void _UnlockThreadStack();
Expand Down
3 changes: 2 additions & 1 deletion src/platform/bouffalolab/common/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
3 changes: 2 additions & 1 deletion src/platform/nxp/common/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
protected:
// ===== Methods that implement the ThreadStackManager abstract interface.
CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

private:
// ===== Members for internal use by the following friends.
Expand Down
3 changes: 2 additions & 1 deletion src/platform/nxp/k32w0/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
3 changes: 2 additions & 1 deletion src/platform/nxp/mcxw71_k32w1/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
3 changes: 2 additions & 1 deletion src/platform/qpg/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _StopThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
3 changes: 2 additions & 1 deletion src/platform/silabs/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
CHIP_ERROR _StartThreadTask(void);
void _StopThreadStack() {}
void _LockThreadStack(void);
bool _TryLockThreadStack(void);
void _UnlockThreadStack(void);
Expand Down
3 changes: 2 additions & 1 deletion src/platform/stm32/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ class ThreadStackManagerImpl final : public ThreadStackManager,

protected:
CHIP_ERROR _StartThreadTask();
void _StopThreadStack() {}

void _ProcessThreadActivity();

private:
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _InitThreadStack(void);
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}

// ===== Members for internal use by the following friends.

Expand Down
3 changes: 2 additions & 1 deletion src/platform/telink/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
public:
// ===== Methods that implement the ThreadStackManager abstract interface.
CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void SetRadioBlocked(bool state) { mRadioBlocked = state; }
bool IsReadyToAttach(void) const { return mReadyToAttach; }
void Finalize(void);
Expand All @@ -68,6 +68,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
// ===== Methods that implement the ThreadStackManager abstract interface.

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; }
void _StopThreadStack() {}
void _LockThreadStack();
bool _TryLockThreadStack();
void _UnlockThreadStack();
Expand Down
3 changes: 2 additions & 1 deletion src/platform/webos/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ class ThreadStackManagerImpl : public ThreadStackManager
}

CHIP_ERROR _InitThreadStack();
void _DeinitThreadStack(){};
void _DeinitThreadStack() {}
void _ProcessThreadActivity();

CHIP_ERROR _StartThreadTask() { return CHIP_NO_ERROR; } // Intentionally left blank
void _StopThreadStack() {} // Intentionally left blank
void _LockThreadStack() {} // Intentionally left blank
bool _TryLockThreadStack() { return false; } // Intentionally left blank
void _UnlockThreadStack() {} // Intentionally left blank
Expand Down

0 comments on commit d7bb2c5

Please sign in to comment.