-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Fixed several issues in HAL_COMPLETION code #1370
Conversation
Hi @AdrianSoundy, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
The "completions" mechanism was abandoned in the early stages of the project when the execution engine code was reviewed. The thought process behind the decision was (in short):
The existing "clients" of the completion list (if I recall correctly) : GPIO debounce, I2C transactions (don't exist anymore) and some other network where replaced with RTOS features. Any code still there related with completions is a leftover that has to be removed. Is there any good reason/motive to revert this decision and have back completions? |
As it was still there i thought i would use it and i knew its was needed for Enc28j60 driver. |
Hate to see your work wasted... There is still a lot of code to be cleaned up... |
Wasn't sure from your last comment. For code like Enc28j60 driver which would be common code for all platforms it is good to have a common timer / callback api that can be used . So i think we should leave it. |
This is tough call… I'm not fond of taking steps back from the work already done to alleviate the execution engine in an effort to make it lighter... But I understand that there isn't available a "standard" API to make this work through RTOS features. Let's keep this fix and leave the completions there until we do a deeper rework on execution engine. In the mean time, let's avoid depending on those. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (considering all the discussed above 😉 )
Description
When doing a new version of GPIO for ESP32 i used a completion to handle the bounce timeout
Found the completions where not working at all. Timers expired nearly straight away randomly.
After further investigation found a number of issues.
The double linked list was no longer protected with locks when items were deleted and inserted.
When inserting to list (EnqueueTicks) and list was empty it referred to random memory outside list head by using ptr->EventTimeTicks on list head.
Timers ended early due no check if time actually reached when a queued timer was superseded with short wait when CLR has nothing else to do. Although comments said there should be a check. This was probably hidden before due to CPU_Sleep.
Now we don't have CPU_Sleep implemented so goes wrong all the time.
We should have a CPU_Sleep to allow more time to be given to other tasks in RTOS.
This should be implemented.
How Has This Been Tested?
I couldn't see anything else using completion in nanoframework but i know the Env28j60 driver does use it. Tested with GPIO driver which will be separate PR.
Types of changes
Checklist:
Signed-off-by: adriansoundy [email protected]