Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenThread Fixes and Updates #447

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

tyler-potyondy
Copy link
Contributor

This PR refactors the libopenthread platform to embrace an async design. The prior implementation included some potentially sync/yielding code within callbacks. Now, these callbacks (radio, alarm, etc) set flags that are then polled during the "libopenthread work" of the the openthread main loop.

Additionally, the 15.4 raw driver merged recently and corresponding changes caused OpenThread to no longer transmit/receive. This was due to OpenThread requesting to sleep the radio (i.e. turn it off), but failed to power the radio on again before requesting to tx/rx. This is now fixed in this PR.

The openthread_hello and tutorial openthread apps were updated respectively.

bool pending_rx_done_callback_status(void);
void reset_pending_rx_done_callback(void);

bool pending_libtock_sys_work(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool pending_libtock_sys_work(void);
// Check if there are pending events that need to be handled before
// calling yield(). These events can be generated if the application happens
// to call yield() somewhere besides the main OpenThread loop.
bool openthread_platform_pending_work(void);

Since this is public can we namespace this function?

@bradjc
Copy link
Contributor

bradjc commented Jun 21, 2024

Looks good.

@alevy
Copy link
Member

alevy commented Jun 21, 2024

+1 to @bradjc's comment and overall approval otherwise.

In the prior design, the libopenthread callbacks would
call openthread "notifier" methods (e.g. `otPlatAlarmFired()`.
OpenThread would then executing OpenThread related work and
potentially dispatch sync functions such as printf for
operations such as logging or sync radio operation.

This refactors libopenthread to:
- set flags for pending completed operations that
 need to be handled by OpenThread
- no longer use sync radio functionality
-Revert to simpler logging that utilizes sync printf. This
is now possible because all callbacks are avoid sync operations
and set flags that are polled.
-Prior to yielding, confirm no pending system or openthread work.
- thread tutorial app refactored to remove callback sync code
@alevy alevy added this pull request to the merge queue Jun 28, 2024
Merged via the queue into tock:master with commit a527d4b Jun 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants