Lightweight, portable template C++ framework encapsulatig RTOS system calls.
Virtual functions are avoided, most of the calls are inline. Contains locks,
signals, semaphore, mailboxes, arrays (both statically and dynamically
allocated), pools, stacks (both statically and dynamically created), timers.
equally efficient when work with C++ object and raw data arrays. System can
optionally store pointer to the buffer inside of the data (system prefix) to
allow the buffer to be freed using only pointer to the data - it is MUST for DMA
transfers. Among other features pools support aligned blocks, user counters,
extensive statistics, different locks for multithread access.
AOS requires only very
basic system calls from underlying OS - signal (or binary semaphore), task spawn, system tick (if you use timers)
The system was tested with Windows, vxWorks and Linux User Space (requires pthread). Additional platforms can easily be added - typically only one C file should be replaced.
The library is not ready for Linux kernel development, but i think it is possible without too much pain to link AOS with Lnux kernel. Fortunately
it did not use scanf/printf functions and calls to stdlib/string can be easily replaced.
Browse source code in SVN and older version
Find more comments here
Timers (implemented in C)
Application spawns one or more timer tasks handling
different timer sets. Every timer set contains one or more timer lists. List is
a queue of running/started/not stopped timers with same timeout and different expiration time. Timer list can contain 0 - empty list,
1 - only one running timer, or more timers with the same timeout started at the same
or different time. Function StartTimer() allocates free entry from the stack of free timers
and places the timer in the end of the timer list (FIFO)
- ~O(1). Timer task waits for expiration of the nearest timer, calls provided by the application hook TimerExpired(),
find the next timer to be expired using sequential search in the set
(always the first entry in a timer list) - ~ O(size of set), where size of set is a number of different timers (timers with different timeouts)
used by the application. Function stop timer
marks a running timer as stopped. Time ~O(1) Any application/task can
handle the timers by itself. This feature can be useful if for example application wants timer handlers to be called in the context of the
same task which started the timers. Typically size of the set is a single digit number,
like 1 (list of timers with 300 ms timeout) or 3 (2 lists containing slow timers with 5s and 10s timeout and one list with fast 100 ms timers).
Usually fast timers - polling of timeout sensitive counters, for example, will be handled by high priority task and slow timers
like socket keep alive timers, in the low priority task.
Do not hesitate to contact the author with any questions. See http://larytet.sourceforge.net/tryRodi.shtml
for contact info.