urtware / doc / classdiagrams / osal.uml @ 17d978fe
History | View | Annotate | Download (11.993 KB)
1 |
/' |
---|---|
2 |
µRtWare is a lightweight publish/subscribe middleware for real-time |
3 |
applications. It was developed as part of the software habitat for the |
4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
5 |
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
7 |
|
8 |
This program is free software: you can redistribute it and/or modify |
9 |
it under the terms of the GNU General Public License as published by |
10 |
the Free Software Foundation, either version 3 of the License, or |
11 |
(at your option) any later version. |
12 |
|
13 |
This program is distributed in the hope that it will be useful, |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
GNU General Public License for more details. |
17 |
|
18 |
You should have received a copy of the GNU General Public License |
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
'/ |
21 |
|
22 |
/'### INTRO ##################################################################'/ |
23 |
|
24 |
@startuml |
25 |
|
26 |
title **µRtWare**\nOperating System Abstraction Layer (OSAL) |
27 |
|
28 |
!include ./functions.iuml |
29 |
|
30 |
/'### ENTITIES ###############################################################'/ |
31 |
|
32 |
!startsub ENTITIES |
33 |
|
34 |
/' OS time measurement feature. '/ |
35 |
$group("time") { |
36 |
/' OS time type with arbitrary resolution. '/ |
37 |
$type("urt_osTime_t") { |
38 |
'Converts an OS time to 64 bit microsecond precise value. |
39 |
+ {method} urtTime2Us (t : urt_osTime_t*) : uint64_t |
40 |
'Retrieves the current time. |
41 |
+ {method} urtTimeNow (void) : urt_osTime_t |
42 |
'Increase a system time object. |
43 |
+ {method} urtTimeAddUs (time : urt_osTime_t*, offset : urt_delay_t) : void |
44 |
} |
45 |
} |
46 |
|
47 |
/' OS mutex lock feature. '/ |
48 |
$group("mutex") { |
49 |
/' OS mutex lock interface. '/ |
50 |
$type("urt_osMutex_t") { |
51 |
'Initializes a urt_osMutex_t object. |
52 |
+ {method} urtMutexInit (mutex : urt_osMutex_t*) : void |
53 |
'Block the thread until the mutex could be locked. |
54 |
+ {method} urtMutexLock (mutex : urt_osMutex_t*) : void |
55 |
'Tries to lock the mutex, but does not block but immediately returns an indicator. |
56 |
+ {method} urtMutexTryLock (mutex : urt_osMutex_t*) : bool |
57 |
'Unlocks a previously locked mutex. |
58 |
+ {method} urtMutexUnlock (mutex : urt_osMutex_t*) : void |
59 |
} |
60 |
} |
61 |
|
62 |
/' OS condition variable feature. '/ |
63 |
$group("condition variable") { |
64 |
/' Return type for the wait function on condition variables. '/ |
65 |
$enumeration("urt_osCondvarWaitStatus_t") { |
66 |
'The condition variable has been signaled. |
67 |
URT_CONDVAR_WAITSTATUS_SIGNAL = 1 |
68 |
'The condition variable has been broadcasted. |
69 |
URT_CONDVAR_WAITSTATUS_BROADCAST = 2 |
70 |
'The wait function timed out. |
71 |
URT_CONDVAR_WAITSTATUS_TIMEOUT = 0 |
72 |
} |
73 |
|
74 |
/' Condition variable interface. '/ |
75 |
$type("urt_osCondvar_t") { |
76 |
'Initializes a urt_osCondvar_t object. |
77 |
+ {method} urtCondvarInit (condvar : urt_osCondvar_t*) : void |
78 |
'Signals one thread that is waiting for the condition variable. |
79 |
+ {method} urtCondvarSignal (condvar : urt_osCondvar_t*) : void |
80 |
'Signals all threads that are waiting for the condition variable. |
81 |
+ {method} urtCondvarBroadcast (condvar : urt_osCondvar_t*) : void |
82 |
'Waits for the condition variable. |
83 |
+ {method} urtCondvarWait (condvar : urt_osCondvar_t*, mutex : urt_osMutex_t*, timeout : urt_delay_t) : urt_osCondvarWaitStatus_t |
84 |
} |
85 |
} |
86 |
|
87 |
/' OS timer feature. '/ |
88 |
$group("timer") { |
89 |
/' Timer callback definition. '/ |
90 |
$type("urt_osTimerCallback_t") { |
91 |
urt_osTimerCallback_t (parameter : void*) : void |
92 |
} |
93 |
|
94 |
/' OS timer interface. '/ |
95 |
$type("urt_osTimer_t") { |
96 |
'Initializes an urt_osTimer_t object. |
97 |
+ {method} urtTimerInit (timer : urt_osTimer_t*) : void |
98 |
'Sets the timer to a specified delay with specified callback and arguments. |
99 |
+ {method} urtTimerSet (timer : urt_osTimer_t*, delay : urt_delay_t, callback : urt_osTimerCallback_t*, parameter : void*) : void |
100 |
'Sets the timer to a specified period with specified callback and arguments. |
101 |
+ {method} urtTimerSetPeriodic (timer : urt_osTimer_t*, period : urt_delay_t, callback : urt_osTimerCallback_t*, parameter : void*) : void |
102 |
'Resets the timer. |
103 |
+ {method} urtTimerReset (timer : urt_osTimer_t*) : void |
104 |
'Check whether the timer is already armed. |
105 |
+ {method} urtTimerIsArmed (timer : urt_osTimer_t*) : bool |
106 |
} |
107 |
} /'condition variable'/ |
108 |
|
109 |
/' OS thread feature. '/ |
110 |
$group("thread") { |
111 |
/' Thread priority type. '/ |
112 |
$type("urt_osThreadPrio_t") { |
113 |
'Minimum priority for low priority threads. |
114 |
URT_THREAD_PRIO_LOW_MIN |
115 |
'Maximum priority for low priority threads. |
116 |
URT_THREAD_PRIO_LOW_MAX |
117 |
'Minimum priority for normal priority threads. |
118 |
URT_THREAD_PRIO_NORMAL_MIN |
119 |
'Maximum priority for normal priority threads. |
120 |
URT_THREAD_PRIO_NORMAL_MAX |
121 |
'Minimum priority for high priority threads. |
122 |
URT_THREAD_PRIO_HIGH_MIN |
123 |
'Maximum priority for high priority threads. |
124 |
URT_THREAD_PRIO_HIGH_MAX |
125 |
'Minimum priority for real-time threads. |
126 |
URT_THREAD_PRIO_RT_MIN |
127 |
'Maximum priority for real-time threads. |
128 |
URT_THREAD_PRIO_RT_MAX |
129 |
} |
130 |
|
131 |
/' Thread main function type. '/ |
132 |
$type("urt_osThreadFunction_t") { |
133 |
urt_osThreadFunction_t (arg : void*) : void |
134 |
} |
135 |
|
136 |
/' Thread terminate signals. '/ |
137 |
$enumeration("urt_osThreadTerminateSignal_t") { |
138 |
'Signal to request termination asap. |
139 |
URT_THREAD_TERMINATE_REQUEST = 15 |
140 |
'Signal to kill a thread immediately. |
141 |
URT_THREAD_TERMINATE_KILL = 9 |
142 |
} |
143 |
|
144 |
/' Thread execution states. '/ |
145 |
$enumeration("urt_osThreadState_t") { |
146 |
'Thread has not been started yet. |
147 |
URT_THREAD_STATE_INACTIVE = 0 |
148 |
'Thread is currently being executed. |
149 |
URT_THREAD_STATE_RUNNING = 1 |
150 |
'Thread is ready but waiting to be scheduled. |
151 |
URT_THREAD_STATE_READY = 2 |
152 |
'Thread is actively sleeping. |
153 |
URT_THREAD_STATE_SLEEPING = 3 |
154 |
'Thread has ben suspended explicitely. |
155 |
URT_THREAD_STATE_SUSPENDED = 4 |
156 |
'Thread is waiting for something (e.g. Mutex, event, etc.). |
157 |
URT_THREAD_STATE_WAITING = 5 |
158 |
'Thread has terminated. |
159 |
URT_THREAD_STATE_TERMINATED = 6 |
160 |
} |
161 |
|
162 |
/' OS thread interface. '/ |
163 |
$type("urt_osThread_t") { |
164 |
'Maximum sleep interval in seconds (as float). |
165 |
URT_THREAD_SLEEP_MAX : float |
166 |
'Maximum sleep interval in seconds. |
167 |
URT_THREAD_SSLEP_MAX : unsigned int |
168 |
'Maximum sleep interval in milliseconds. |
169 |
URT_THREAD_MSLEEP_MAX : unsigned int |
170 |
'Maximum sleep interval in microseconds. |
171 |
URT_THREAD_USLEEP_MAX : urt_delay_t |
172 |
-- |
173 |
'Macro to setup working area as static variable (handles alignment if required). |
174 |
+ {method} URT_THREAD_MEMORY (varname, stacksize) |
175 |
.. |
176 |
'Initializes an urt_osThread_t object. |
177 |
+ {method} urtThreadInit (memory : void*, size : size_t, prio : urt_osThreadPrio_t, func : urt_osThreadFunction_t*, arg : void*) : urt_osThread_t* |
178 |
'Starts a thread. |
179 |
+ {method} urtThreadStart (thread : urt_osThread_t*) : void |
180 |
'The calling threads yields. |
181 |
+ {method} urtThreadYield (void) : void |
182 |
'Retrieves the priority of the calling thread. |
183 |
+ {method} urtThreadGetPriority (void) : urt_osThreadPrio_t |
184 |
'Sets the priority of the calling thread. |
185 |
+ {method} urtThreadSetPriority (prio : urt_osThreadPrio_t) : void |
186 |
'Suspends the calling thread for the specified time. |
187 |
+ {method} urtThreadSleep (seconds : float) : void |
188 |
'Suspends the calling thread for the specified time. |
189 |
+ {method} urtThreadSSleep (seconds : unsigned int) : void |
190 |
'Suspends the calling thread for the specified time. |
191 |
+ {method} urtThreadMSleep (milliseconds : unsigned int) : void |
192 |
'Suspends the calling thread for the specified time. |
193 |
+ {method} urtThreadUSleep (microseconds : urt_delay_t) : void |
194 |
'Suspends the calling thread until the specified time. |
195 |
+ {method} urtThreadSleepUntil (time : urt_osTime_t) : void |
196 |
'The calling thread exits execution (terminates). |
197 |
+ {method} urtThreadExit (void) : void |
198 |
'Terminates a specified thread. |
199 |
+ {method} urtThreadTerminate (thread : urt_osThread_t*, sig : urt_osThreadTerminateSignal_t) : void |
200 |
'Waits until the specified thread terminates. |
201 |
+ {method} urtThreadJoin (thread : urt_osThread_t*) : void |
202 |
'Retrieves the execution state of the specified thread. |
203 |
+ {method} urtThreadGetState (thread : urt_osThread_t*) : urt_osThreadState_t |
204 |
'Retrieves the calling thread itself. |
205 |
+ {method} urtThreadGetSelf (void) : urt_osThread_t* |
206 |
'Retrieves the first child of a thread or ""NULL"". |
207 |
+ urtThreadGetChildren (thread : urt_osThread_t*) : urt_osThread_t* |
208 |
'Retrieves a sibling (next child in a list) of the thread or ""NULL"". |
209 |
+ urtThreadGetSibling (thread : urt_osThread_t*) : urt_osThread_t* |
210 |
'Retrieves the parent thread. |
211 |
+ urtThreadGetParent (thread : urt_osThread_t*) : urt_osThread_t* |
212 |
} |
213 |
} /'thread'/ |
214 |
|
215 |
/' OS event feature. '/ |
216 |
$group("events") { |
217 |
/' OS event mask type. '/ |
218 |
$type("urt_osEventMask_t") { |
219 |
'The event mask, which will be handled with maximum priority by the event system. |
220 |
URT_EVENTMASK_MAXPRIO : urt_osEventMask_t |
221 |
} |
222 |
|
223 |
/' OS event flag type. '/ |
224 |
$type("urt_osEventFlags_t") { |
225 |
} |
226 |
|
227 |
/' OS event wait type. '/ |
228 |
$enumeration("urt_osEventWait_t") { |
229 |
'Wait for exactly one event. |
230 |
URT_EVENT_WAIT_ONE = 0 |
231 |
'Wait for at least one event. |
232 |
URT_EVENT_WAIT_ANY = 1 |
233 |
'Wait for all events. |
234 |
URT_EVENT_WAIT_ALL = 2 |
235 |
} |
236 |
|
237 |
/' OS event listener interface. '/ |
238 |
$type("urt_osEventListener_t") { |
239 |
'Initializes an urt_osEventListener_t object. |
240 |
+ {method} urtEventListenerInit (listener : urt_osEventListener_t*) : void |
241 |
'Retrieves the flags of the event listener. |
242 |
+ {method} urtEventListenerGetFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t |
243 |
'Retrieves and clears the flags of the event listener. |
244 |
+ {method} urtEventListenerClearFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t |
245 |
} |
246 |
|
247 |
/' OS event source interface. '/ |
248 |
$type("urt_osEventSource_t") { |
249 |
'Initializes an urt_osEventSource_t object. |
250 |
+ {method} urtEventSourceInit (source : urt_osEventSource_t*) : void |
251 |
'Emits an event. |
252 |
+ {method} urtEventSourceBroadcast (source : urt_osEventSource_t*, flags : urt_osEventFlags_t) : void |
253 |
} |
254 |
|
255 |
/' Not a class/type but a set of static event-related functions. '/ |
256 |
$function("urt_events") { |
257 |
'Registers a lister to a source. |
258 |
+ {method} urtEventRegister (source : urt_osEventSource_t*, listener : urt_osEventListener_t*, mask : urt_osEventMask_t, flags : urt_osEventFlags_t) : void |
259 |
'Unregisters a listener from a source. |
260 |
+ {method} urtEventUnregister (source _ urt_osEventSource_t*, listener : urt_osEventListener_t*) : void |
261 |
'Blocks the thread until any event occurs or the timeout expires. |
262 |
+ {method} urtEventWait (mask : urt_osEventMask_t, type : urt_osEventWait_t, timeout : urt_delay_t) : urt_osEventMask_t |
263 |
} |
264 |
} /'events'/ |
265 |
|
266 |
/' OS streams feature. '/ |
267 |
$group("streams") { |
268 |
/' Not a class/type but a set of output-related functions. '/ |
269 |
$function("urt_streams") { |
270 |
'Prints a formatted string to the standard output stream (stdout). |
271 |
+ {method} urtPrintf(fmt : char*, ... ) : int |
272 |
'Prints a formatted string to the standard error stream (stderr). |
273 |
+ {method} urtErrPrintf(fmt : char*, ... ) : int |
274 |
} |
275 |
} |
276 |
|
277 |
/' OS debugging feature. '/ |
278 |
$group("debug") { |
279 |
/' Just a function for debugging. '/ |
280 |
$function("urt_debug") { |
281 |
'Checks the condition in debug mode. |
282 |
+ {method} urtDebugAssert(condition : bool) : void |
283 |
} |
284 |
} |
285 |
|
286 |
!endsub |
287 |
|
288 |
/'### DEPENDENCIES & LAYOUT ##################################################'/ |
289 |
|
290 |
!startsub DEPENDENCIES |
291 |
|
292 |
urt_osCondvar_t ..> urt_osCondvarWaitStatus_t |
293 |
urt_osCondvar_t .> urt_osMutex_t |
294 |
|
295 |
urt_osTimer_t ..> urt_osTimerCallback_t |
296 |
|
297 |
urt_osThread_t ..> urt_osThreadPrio_t |
298 |
urt_osThread_t ..> urt_osThreadFunction_t |
299 |
urt_osThread_t ..> urt_osThreadTerminateSignal_t |
300 |
urt_osThread_t ..> urt_osThreadState_t |
301 |
urt_osThread_t .> urt_osTime_t |
302 |
|
303 |
urt_osEventListener_t ..> urt_osEventFlags_t |
304 |
urt_osEventSource_t ..> urt_osEventFlags_t |
305 |
urt_events ..> urt_osEventSource_t |
306 |
urt_events ..> urt_osEventListener_t |
307 |
urt_events ..> urt_osEventMask_t |
308 |
urt_events ..> urt_osEventFlags_t |
309 |
urt_events ..> urt_osEventWait_t |
310 |
|
311 |
!endsub |
312 |
|
313 |
/'### OUTRO ##################################################################'/ |
314 |
|
315 |
@enduml |
316 |
|