To Whom It May Concern,
This small OS has been tested on various other processors and I ported it to the Arduino ATMega328p to see how it would work. I am contributing it to the public domain hoping someone might find it of use as well.
I tried to ask how to properly submit this software for evaluation on a different topic called "How to submit software to the Arduino public domain?" and I did not make much progress with that approach so I am just going to punt and submit it here.
I have attached my Arduino_OS.ino file that has all of the OS and example tasking code. I wrote this little OS awhile back and I have ported variations of it to various processors (ARM-7, Coldfire, X86 etc) and projects successfully.
The code is a small cooperative OS that I wrote to make the creation of more sophisticated and modular projects easier.
The OS has implements the following features:
CreateThread - Called from main to initially setup a task.
Block - Stop a task from running.
UnBlock - Called to make another task ready to run that was previously blocked.
Delay - Cause a task to suspend execution for the designated number of ticks.
InitThread - Must be called from a task thread, prior to "FOREVER" loop, to complete the task setup initially begun in CreateThread.
Pause - Give up the processor and allow another task to run.
A general purpose timer class (GPTimer) has been included to allow a user to create various random timers as needed for projects. This class was used to implement the "Delay" function.
Finally, a small Queue class with Put and Get methods has been included for inter-task communications if needed.
I hope that someone finds it useful.
Thank You and Best Regards
David Q. R. Wagoner
Addendum: A bug was found in the attached Arduino_OS.ino in the Queue.Put method. This error was corrected and uploaded with OS documentation in a later posting (DQRW).
Arduino_OS.ino (9.34 KB)