1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Using a CMSIS-RTOS Implementation</title>
<title>CMSIS-RTOS: Using a CMSIS-RTOS Implementation</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 46px;">
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">CMSIS-RTOS
 <span id="projectnumber">Version 1.03</span>
</div>
<div id="projectbrief">Real-Time Operating System: API and RTX Reference Implementation.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
<ul class="tablist">
<script type="text/javascript">
<!--
writeComponentTabs.call(this);
//-->
</script>
</ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Usage and Description</span></a></li>
<li><a href="modules.html"><span>Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('usingOS.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Using a CMSIS-RTOS Implementation </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>A CMSIS-RTOS implementation is typically provided as a library. To add the RTOS functionality to an existing CMSIS-based application, the RTOS library (and typically a configuration file) needs to be added. The available functionality of the RTOS library is defined in the header file <b><a class="el" href="cmsis__os_8h.html">cmsis_os.h</a></b> that is specific for each CMSIS-RTOS implementation.</p>
<div class="image">
<img src="CMSIS_RTOS_Files.png" alt="CMSIS_RTOS_Files.png"/>
<div class="caption">
CMSIS-RTOS File Structure</div></div>
<p> Depending on the CMSIS-RTOS implementation, execution may start with the <b>main</b> function as the first thread. This has the benefit that an application programmer may use other middleware libraries that create threads internally, but the remaining part of the user application just uses the <b>main</b> thread. Therefore, the usage of the RTOS can be invisible to the application programmer, but libraries can use CMSIS-RTOS features.</p>
<p>Once the files are added to a project, the user can start working with the CMSIS-RTOS functions. A code example is provided below:</p>
<p><b>Code Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="cmsis__os_8h.html">cmsis_os.h</a>"</span> <span class="comment">// CMSIS-RTOS header file</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> job1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job1'</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#ga02e19d5e723bfb06ba9324d625162255">osDelay</a> (10); <span class="comment">// delay execution for 10 milliseconds</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaee93d929beb350f16e5cc7fa602e229f">osThreadDef</a>(job1, <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa17b36cd9cd38652c2bc6d4803990674b">osPriorityAboveNormal</a>, 1, 0); <span class="comment">// define job1 as thread function</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> job2 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job2'</span></div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac59b5713cb083702dce759c73fd90dff">osThreadCreate</a>(<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453">osThread</a>(job1),NULL); <span class="comment">// create job1 thread</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaee93d929beb350f16e5cc7fa602e229f">osThreadDef</a>(job2, <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa45a2895ad30c79fb97de18cac7cc19f1">osPriorityNormal</a>, 1, 0); <span class="comment">// define job2 as thread function</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> job3 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job3'</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#ga02e19d5e723bfb06ba9324d625162255">osDelay</a> (20); <span class="comment">// delay execution for 20 milliseconds</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaee93d929beb350f16e5cc7fa602e229f">osThreadDef</a>(job3, <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa45a2895ad30c79fb97de18cac7cc19f1">osPriorityNormal</a>, 1, 0); <span class="comment">// define job3 as thread function</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) { <span class="comment">// program execution starts here</span></div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#ga53d078a801022e202e8115c083ece68e">osKernelInitialize</a> (); <span class="comment">// initialize RTOS kernel</span></div>
<div class="line"> : <span class="comment">// setup and initialize peripherals</span></div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac59b5713cb083702dce759c73fd90dff">osThreadCreate</a> (<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453">osThread</a>(job2));</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac59b5713cb083702dce759c73fd90dff">osThreadCreate</a> (<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453">osThread</a>(job3));</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#gaab668ffd2ea76bb0a77ab0ab385eaef2">osKernelStart</a> (); <span class="comment">// start kernel with job2 execution</span></div>
<div class="line">}</div>
</div><!-- fragment --><h1><a class="anchor" id="cmsis_os_h"></a>
Header File Template: cmsis_os.h</h1>
<p>The file <b><a class="el" href="cmsis__os_8h.html">cmsis_os.h</a></b> is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS). Each RTOS that is compliant with CMSIS-RTOS shall provide a specific <b><a class="el" href="cmsis__os_8h.html">cmsis_os.h</a></b> header file that represents its implementation.</p>
<p>The file <a class="el" href="cmsis__os_8h.html">cmsis_os.h</a> contains:</p>
<ul>
<li>CMSIS-RTOS API function definitions</li>
<li>struct definitions for parameters and return types</li>
<li>status and priority values used by CMSIS-RTOS API functions</li>
<li>macros for defining threads and other kernel objects</li>
</ul>
<p><b>Name conventions and header file modifications</b></p>
<p>All definitions are prefixed with <b>os</b> to give an unique name space for CMSIS-RTOS functions. Definitions that are prefixed <b>os_</b> are not used in the application code but local to this header file. All definitions and functions that belong to a module are grouped and have a common prefix, i.e. <b>osThread</b>.</p>
<p>Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation. These definitions can be specific to the underlying RTOS kernel.</p>
<p>Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.</p>
<p><b>Define and reference object definitions</b></p>
<p>With <b>#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file that is used throughout a project as shown below:</p>
<p><em>Header File</em> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="cmsis__os_8h.html">cmsis_os.h</a>></span> <span class="comment">// CMSIS RTOS header file</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// Thread definition</span></div>
<div class="line"><span class="keyword">extern</span> <span class="keywordtype">void</span> thread_sample (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument); <span class="comment">// function prototype</span></div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaee93d929beb350f16e5cc7fa602e229f">osThreadDef</a> (thread_sample, <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa193b650117c209b4a203954542bcc3e6">osPriorityBelowNormal</a>, 1, 100);</div>
<div class="line"></div>
<div class="line"><span class="comment">// Pool definition</span></div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga87b471d4fe2d5dbd0040708edd52771b">osPoolDef</a>(MyPool, 10, <span class="keywordtype">long</span>);</div>
</div><!-- fragment --><p>This header file defines all objects when included in a C/C++ source file. When <b>#define osObjectsExternal</b> is present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be used throughout the whole project.</p>
<p><em>Example</em> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include "osObjects.h"</span> <span class="comment">// Definition of the CMSIS-RTOS objects</span></div>
</div><!-- fragment --><div class="fragment"><div class="line"><span class="preprocessor">#define osObjectsExternal // Objects will be defined as external symbols</span></div>
<div class="line"><span class="preprocessor">#include "osObjects.h" // Reference to the CMSIS-RTOS objects</span></div>
</div><!-- fragment --><p><b>Header file cmsis_os.h</b></p>
<div class="fragment"><div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
<div class="line"><span class="comment"> * $Date: 5. February 2013</span></div>
<div class="line"><span class="comment"> * $Revision: V1.02</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Project: CMSIS-RTOS API</span></div>
<div class="line"><span class="comment"> * Title: cmsis_os.h template header file</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Version 0.02</span></div>
<div class="line"><span class="comment"> * Initial Proposal Phase</span></div>
<div class="line"><span class="comment"> * Version 0.03</span></div>
<div class="line"><span class="comment"> * osKernelStart added, optional feature: main started as thread</span></div>
<div class="line"><span class="comment"> * osSemaphores have standard behavior</span></div>
<div class="line"><span class="comment"> * osTimerCreate does not start the timer, added osTimerStart</span></div>
<div class="line"><span class="comment"> * osThreadPass is renamed to osThreadYield</span></div>
<div class="line"><span class="comment"> * Version 1.01</span></div>
<div class="line"><span class="comment"> * Support for C++ interface</span></div>
<div class="line"><span class="comment"> * - const attribute removed from the osXxxxDef_t typedef's</span></div>
<div class="line"><span class="comment"> * - const attribute added to the osXxxxDef macros</span></div>
<div class="line"><span class="comment"> * Added: osTimerDelete, osMutexDelete, osSemaphoreDelete</span></div>
<div class="line"><span class="comment"> * Added: osKernelInitialize</span></div>
<div class="line"><span class="comment"> * Version 1.02</span></div>
<div class="line"><span class="comment"> * Control functions for short timeouts in microsecond resolution:</span></div>
<div class="line"><span class="comment"> * Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec</span></div>
<div class="line"><span class="comment"> * Removed: osSignalGet </span></div>
<div class="line"><span class="comment"> *----------------------------------------------------------------------------</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Copyright (c) 2013-2017 ARM LIMITED</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * SPDX-License-Identifier: Apache-2.0</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Licensed under the Apache License, Version 2.0 (the License); you may</span></div>
<div class="line"><span class="comment"> * not use this file except in compliance with the License.</span></div>
<div class="line"><span class="comment"> * You may obtain a copy of the License at</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><span class="comment"> * distributed under the License is distributed on an AS IS BASIS, WITHOUT</span></div>
<div class="line"><span class="comment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><span class="comment"> * limitations under the License.</span></div>
<div class="line"><span class="comment"> *---------------------------------------------------------------------------*/</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#ifndef _CMSIS_OS_H</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define _CMSIS_OS_H</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osCMSIS 0x10002 </span><span class="comment">///< API version (main [31:16] .sub [15:0])</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osCMSIS_KERNEL 0x10000 </span><span class="comment">///< RTOS identification and version (main [31:16] .sub [15:0])</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osKernelSystemId "KERNEL V1.00" </span><span class="comment">///< RTOS identification string</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osFeature_MainThread 1 </span><span class="comment">///< main thread 1=main can be thread, 0=not available</span></div>
<div class="line"><span class="comment"></span>#define osFeature_Pool 1 <span class="comment">///< Memory Pools: 1=available, 0=not available</span></div>
<div class="line"><span class="comment"></span>#define osFeature_MailQ 1 <span class="comment">///< Mail Queues: 1=available, 0=not available</span></div>
<div class="line"><span class="comment"></span>#define osFeature_MessageQ 1 <span class="comment">///< Message Queues: 1=available, 0=not available</span></div>
<div class="line"><span class="comment"></span>#define osFeature_Signals 8 <span class="comment">///< maximum number of Signal Flags available per thread</span></div>
<div class="line"><span class="comment"></span>#define osFeature_Semaphore 30 <span class="comment">///< maximum count for \ref osSemaphoreCreate function</span></div>
<div class="line"><span class="comment"></span>#define osFeature_Wait 1 <span class="comment">///< osWait function: 1=available, 0=not available</span></div>
<div class="line"><span class="comment"></span>#define osFeature_SysTick 1 <span class="comment">///< osKernelSysTick functions: 1=available, 0=not available</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="preprocessor">#include <stdint.h></span></div>
<div class="line"><span class="preprocessor">#include <stddef.h></span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span></div>
<div class="line">{</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Enumeration, structures, defines ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Priority used for thread control.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">enum</span> {</div>
<div class="line"> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa549e79a43ff4f8b2b31afb613f5caa81">osPriorityIdle</a> = -3, <span class="comment">///< priority: idle (lowest)</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa61cb822239ac8f66dfbdc7291598a3d4">osPriorityLow</a> = -2, <span class="comment">///< priority: low</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa193b650117c209b4a203954542bcc3e6">osPriorityBelowNormal</a> = -1, <span class="comment">///< priority: below normal</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa45a2895ad30c79fb97de18cac7cc19f1">osPriorityNormal</a> = 0, <span class="comment">///< priority: normal (default)</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa17b36cd9cd38652c2bc6d4803990674b">osPriorityAboveNormal</a> = +1, <span class="comment">///< priority: above normal</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa914433934143a9ba767e59577c56e6c2">osPriorityHigh</a> = +2, <span class="comment">///< priority: high</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aa1485dec3702434a1ec3cb74c7a17a4af">osPriorityRealtime</a> = +3, <span class="comment">///< priority: realtime (highest)</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="cmsis__os_8h.html#ga7f2b42f1983b9107775ec2a1c69a849aae35f5e2f9c64ad346822521b643bdea4">osPriorityError</a> = 0x84 <span class="comment">///< system cannot determine priority or thread has illegal priority</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga7f2b42f1983b9107775ec2a1c69a849a">osPriority</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Timeout value.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osWaitForever 0xFFFFFFFF </span><span class="comment">///< wait forever timeout value</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/// Status code values returned by CMSIS-RTOS functions.</span></div>
<div class="line"><span class="comment"></span><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">enum</span> {</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea9e1c9e2550bb4de8969a935acffc968f">osOK</a> = 0, <span class="comment">///< function completed; no error or event occurred.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea5df7e9643aa8a2f5f3a6f6ec59758518">osEventSignal</a> = 0x08, <span class="comment">///< function completed; signal event occurred.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ead604f3673359dd4ac643b16dc5a2c342">osEventMessage</a> = 0x10, <span class="comment">///< function completed; message event occurred.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea15b12e42b42b53f35fb8a2724ad02926">osEventMail</a> = 0x20, <span class="comment">///< function completed; mail event occurred.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea78f477732375c0e1fca814e369618177">osEventTimeout</a> = 0x40, <span class="comment">///< function completed; timeout occurred.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99eac24adca6a5d072c9f01c32178ba0d109">osErrorParameter</a> = 0x80, <span class="comment">///< parameter error: a mandatory parameter was missing or specified an incorrect object.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea8fc5801e8b0482bdf22ad63a77f0155d">osErrorResource</a> = 0x81, <span class="comment">///< resource not available: a specified resource was not available.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea314d24a49003f09459035db0dd7c9467">osErrorTimeoutResource</a> = 0xC1, <span class="comment">///< resource not available within given time: a specified resource was not available within the timeout period.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea21635bdc492d3094fe83027fa4a30e2f">osErrorISR</a> = 0x82, <span class="comment">///< not allowed in ISR context: the function cannot be called from interrupt service routines.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99eaf6552310a817452aedfcd453f2805d65">osErrorISRRecursive</a> = 0x83, <span class="comment">///< function called multiple times from ISR with same object.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99eab7dda0ef504817659334cbfd650ae56f">osErrorPriority</a> = 0x84, <span class="comment">///< system cannot determine priority or thread has illegal priority.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99eaf1fac0240218e51eb30a13da2f8aae81">osErrorNoMemory</a> = 0x85, <span class="comment">///< system is out of memory: it was impossible to allocate or reserve memory for the operation.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea4672c8a0c0f6bb1d7981da4602e8e9ee">osErrorValue</a> = 0x86, <span class="comment">///< value of a parameter is out of range.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99ea5fde24ff588ec5ab9cb8314bade26fbc">osErrorOS</a> = 0xFF, <span class="comment">///< unspecified RTOS error: run-time error but no other error message fits.</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99eac7a77f5fe18a15a357790c36a4aca1b1">os_status_reserved</a> = 0x7FFFFFFF <span class="comment">///< prevent from enum down-size compiler optimization.</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a>;</div>
<div class="line"> </div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Timer type value for the timer definition.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">enum</span> {</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#gadac860eb9e1b4b0619271e6595ed83d9ad21712f8df5f97069c82dc9eec37b951">osTimerOnce</a> = 0, <span class="comment">///< one-shot timer</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#gadac860eb9e1b4b0619271e6595ed83d9ab9c91f9699162edb09bb7c90c11c8788">osTimerPeriodic</a> = 1 <span class="comment">///< repeating timer</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#gadac860eb9e1b4b0619271e6595ed83d9">os_timer_type</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Entry point of a thread.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> void (*<a class="code" href="cmsis__os_8h.html#aee631e5ea1b700fc35695cc7bc574cf7">os_pthread</a>) (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Entry point of a timer call back function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> void (*<a class="code" href="cmsis__os_8h.html#aa2d85e49bde9f6951ff3545cd323f065">os_ptimer</a>) (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// >>> the following data type definitions may shall adapted towards a specific RTOS</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Thread ID identifies the thread (pointer to a thread control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_thread_cb *<a class="code" href="cmsis__os_8h.html#adfeb153a84a81309e2d958268197617f">osThreadId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Timer ID identifies the timer (pointer to a timer control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_timer_cb *<a class="code" href="cmsis__os_8h.html#ab8530dd4273f1f5382187732e14fcaa7">osTimerId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Mutex ID identifies the mutex (pointer to a mutex control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_mutex_cb *<a class="code" href="cmsis__os_8h.html#a3263c1ad9fd79b84f908d65e8da44ac2">osMutexId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Semaphore ID identifies the semaphore (pointer to a semaphore control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_semaphore_cb *<a class="code" href="cmsis__os_8h.html#aa8968896c84094aa973683c84fa06f84">osSemaphoreId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Pool ID identifies the memory pool (pointer to a memory pool control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_pool_cb *<a class="code" href="cmsis__os_8h.html#a08d2e20fd9bbd96220fe068d420f3686">osPoolId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Message ID identifies the message queue (pointer to a message queue control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_messageQ_cb *<a class="code" href="cmsis__os_8h.html#ad9ec70c32c6c521970636b521e12d17f">osMessageQId</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Mail ID identifies the mail queue (pointer to a mail queue control block).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_mailQ_cb *<a class="code" href="cmsis__os_8h.html#a1dac049fb7725a8af8b26c71cbb373b5">osMailQId</a>;</div>
<div class="line"> </div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Thread Definition structure contains startup information of a thread.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_thread_def {</div>
<div class="line"> <a class="code" href="cmsis__os_8h.html#aee631e5ea1b700fc35695cc7bc574cf7">os_pthread</a> pthread; <span class="comment">///< start address of thread function</span></div>
<div class="line"><span class="comment"></span> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga7f2b42f1983b9107775ec2a1c69a849a">osPriority</a> tpriority; <span class="comment">///< initial thread priority</span></div>
<div class="line"><span class="comment"></span> uint32_t instances; <span class="comment">///< maximum number of instances of that thread function</span></div>
<div class="line"><span class="comment"></span> uint32_t stacksize; <span class="comment">///< stack size requirements in bytes; 0 is default stack size</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosThreadDef__t">osThreadDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Timer Definition structure contains timer parameters.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_timer_def {</div>
<div class="line"> <a class="code" href="cmsis__os_8h.html#aa2d85e49bde9f6951ff3545cd323f065">os_ptimer</a> ptimer; <span class="comment">///< start address of a timer function</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosTimerDef__t">osTimerDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Mutex Definition structure contains setup information for a mutex.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_mutex_def {</div>
<div class="line"> uint32_t dummy; <span class="comment">///< dummy value.</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosMutexDef__t">osMutexDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Semaphore Definition structure contains setup information for a semaphore.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_semaphore_def {</div>
<div class="line"> uint32_t dummy; <span class="comment">///< dummy value.</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosSemaphoreDef__t">osSemaphoreDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Definition structure for memory block allocation.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_pool_def {</div>
<div class="line"> uint32_t pool_sz; <span class="comment">///< number of items (elements) in the pool</span></div>
<div class="line"><span class="comment"></span> uint32_t item_sz; <span class="comment">///< size of an item</span></div>
<div class="line"><span class="comment"></span> <span class="keywordtype">void</span> *pool; <span class="comment">///< pointer to memory for pool</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosPoolDef__t">osPoolDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Definition structure for message queue.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_messageQ_def {</div>
<div class="line"> uint32_t queue_sz; <span class="comment">///< number of elements in the queue</span></div>
<div class="line"><span class="comment"></span> uint32_t item_sz; <span class="comment">///< size of an item</span></div>
<div class="line"><span class="comment"></span> <span class="keywordtype">void</span> *pool; <span class="comment">///< memory array for messages</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosMessageQDef__t">osMessageQDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Definition structure for mail queue.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>os_mailQ_def {</div>
<div class="line"> uint32_t queue_sz; <span class="comment">///< number of elements in the queue</span></div>
<div class="line"><span class="comment"></span> uint32_t item_sz; <span class="comment">///< size of an item</span></div>
<div class="line"><span class="comment"></span> <span class="keywordtype">void</span> *pool; <span class="comment">///< memory array for mail</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="cmsis__os_8h.html#structosMailQDef__t">osMailQDef_t</a>;</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Event structure contains detailed information about an event.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment">/// However the struct may be extended at the end.</span></div>
<div class="line"><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> status; <span class="comment">///< status code: event or error information</span></div>
<div class="line"><span class="comment"></span> <span class="keyword">union </span>{</div>
<div class="line"> uint32_t v; <span class="comment">///< message as 32-bit value</span></div>
<div class="line"><span class="comment"></span> <span class="keywordtype">void</span> *p; <span class="comment">///< message or mail as void pointer</span></div>
<div class="line"><span class="comment"></span> int32_t signals; <span class="comment">///< signal flags</span></div>
<div class="line"><span class="comment"></span> } value; <span class="comment">///< event value</span></div>
<div class="line"><span class="comment"></span> <span class="keyword">union </span>{</div>
<div class="line"> osMailQId mail_id; <span class="comment">///< mail id obtained by \ref osMailCreate</span></div>
<div class="line"><span class="comment"></span> osMessageQId message_id; <span class="comment">///< message id obtained by \ref osMessageCreate</span></div>
<div class="line"><span class="comment"></span> } def; <span class="comment">///< event definition</span></div>
<div class="line"><span class="comment"></span>} <a class="code" href="group__CMSIS__RTOS__Definitions.html#structosEvent">osEvent</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Kernel Control Functions ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Initialize the RTOS Kernel for creating objects.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#ga53d078a801022e202e8115c083ece68e">osKernelInitialize</a> (<span class="keywordtype">void</span>);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Start the RTOS Kernel.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#gaab668ffd2ea76bb0a77ab0ab385eaef2">osKernelStart</a> (<span class="keywordtype">void</span>);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Check if the RTOS kernel is already started.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment">/// \return 0 RTOS is not started, 1 RTOS is started.</span></div>
<div class="line"><span class="comment"></span>int32_t <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#ga3b571de44cd3094c643247a7397f86b5">osKernelRunning</a>(<span class="keywordtype">void</span>);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Get the RTOS kernel system timer counter </span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment">/// \return RTOS kernel system timer as 32-bit value </span></div>
<div class="line"><span class="comment"></span>uint32_t <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#gad0262e4688e95d1e9038afd9bcc16001">osKernelSysTick</a> (<span class="keywordtype">void</span>);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// The RTOS kernel system timer frequency in Hz</span></div>
<div class="line"><span class="comment">/// \note Reflects the system timer setting and is typically defined in a configuration file.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osKernelSysTickFrequency 100000000</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Convert a microseconds value to a RTOS kernel system timer value.</span></div>
<div class="line"><span class="comment">/// \param microsec time value in microseconds.</span></div>
<div class="line"><span class="comment">/// \return time value normalized to the \ref osKernelSysTickFrequency</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"><span class="preprocessor">#endif // System Timer available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"><span class="comment">// ==== Thread Management ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create a Thread Definition with function, priority, and stack requirements.</span></div>
<div class="line"><span class="comment">/// \param name name of the thread function.</span></div>
<div class="line"><span class="comment">/// \param priority initial priority of the thread function.</span></div>
<div class="line"><span class="comment">/// \param instances number of possible thread instances.</span></div>
<div class="line"><span class="comment">/// \param stacksz stack size (in bytes) requirements for the thread function.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osThreadDef(name, priority, instances, stacksz) \</span></div>
<div class="line"><span class="preprocessor">extern const osThreadDef_t os_thread_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osThreadDef(name, priority, instances, stacksz) \</span></div>
<div class="line"><span class="preprocessor">const osThreadDef_t os_thread_def_##name = \</span></div>
<div class="line"><span class="preprocessor">{ (name), (priority), (instances), (stacksz) }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Access a Thread definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the thread definition object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osThread(name) \</span></div>
<div class="line"><span class="preprocessor">&os_thread_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create a thread and add it to Active Threads and set it to state READY.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_def thread definition referenced with \ref osThread.</span></div>
<div class="line"><span class="comment">/// \param[in] argument pointer that is passed to the thread function as start argument.</span></div>
<div class="line"><span class="comment">/// \return thread ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osThreadId <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac59b5713cb083702dce759c73fd90dff">osThreadCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosThreadDef__t">osThreadDef_t</a> *thread_def, <span class="keywordtype">void</span> *argument);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Return the thread ID of the current running thread.</span></div>
<div class="line"><span class="comment">/// \return thread ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osThreadId <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gab1df2a28925862ef8f9cf4e1c995c5a7">osThreadGetId</a> (<span class="keywordtype">void</span>);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Terminate execution of a thread and remove it from Active Threads.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaea135bb90eb853eff39e0800b91bbeab">osThreadTerminate</a> (osThreadId thread_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Pass control to next thread that is in state \b READY.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaf13a667493c5d629a90c13e113b99233">osThreadYield</a> (<span class="keywordtype">void</span>);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Change priority of an active thread.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.</span></div>
<div class="line"><span class="comment">/// \param[in] priority new priority value for the thread function.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga0dfb90ccf1f6e4b54b9251b12d1cbc8b">osThreadSetPriority</a> (osThreadId thread_id, <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga7f2b42f1983b9107775ec2a1c69a849a">osPriority</a> priority);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Get current priority of an active thread.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.</span></div>
<div class="line"><span class="comment">/// \return current priority value of the thread function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga7f2b42f1983b9107775ec2a1c69a849a">osPriority</a> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga4299d838978bc2aae5e4350754e6a4e9">osThreadGetPriority</a> (osThreadId thread_id);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Generic Wait Functions ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Wait for Timeout (Time Delay).</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue "time delay" value</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__Wait.html#ga02e19d5e723bfb06ba9324d625162255">osDelay</a> (uint32_t millisec);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Wait for Signal, Message, Mail, or Timeout.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out</span></div>
<div class="line"><span class="comment">/// \return event that contains signal, message, or mail information or error code.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Definitions.html#structosEvent">osEvent</a> <a class="code" href="group__CMSIS__RTOS__Wait.html#ga8470c8aaedfde524a44e22e5b2328285">osWait</a> (uint32_t millisec);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#endif // Generic Wait available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Timer Management Functions ====</span><span class="comment"></span></div>
<div class="line"><span class="comment">/// Define a Timer object.</span></div>
<div class="line"><span class="comment">/// \param name name of the timer object.</span></div>
<div class="line"><span class="comment">/// \param function name of the timer call back function.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osTimerDef(name, function) \</span></div>
<div class="line"><span class="preprocessor">extern const osTimerDef_t os_timer_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osTimerDef(name, function) \</span></div>
<div class="line"><span class="preprocessor">const osTimerDef_t os_timer_def_##name = \</span></div>
<div class="line"><span class="preprocessor">{ (function) }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Access a Timer definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the timer object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osTimer(name) \</span></div>
<div class="line"><span class="preprocessor">&os_timer_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create a timer.</span></div>
<div class="line"><span class="comment">/// \param[in] timer_def timer object referenced with \ref osTimer.</span></div>
<div class="line"><span class="comment">/// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.</span></div>
<div class="line"><span class="comment">/// \param[in] argument argument to the timer call back function.</span></div>
<div class="line"><span class="comment">/// \return timer ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osTimerId <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#gaedd312bfdca04e0b8162b666e09a1ae6">osTimerCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosTimerDef__t">osTimerDef_t</a> *timer_def, <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#gadac860eb9e1b4b0619271e6595ed83d9">os_timer_type</a> type, <span class="keywordtype">void</span> *argument);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Start or restart a timer.</span></div>
<div class="line"><span class="comment">/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue "time delay" value of the timer.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#ga27a797a401b068e2644d1125f22a07ca">osTimerStart</a> (osTimerId timer_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Stop the timer.</span></div>
<div class="line"><span class="comment">/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#ga58f36b121a812936435cacc6e1e0e091">osTimerStop</a> (osTimerId timer_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Delete a timer that was created by \ref osTimerCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__TimerMgmt.html#ga746b8043d906849bd65e3900fcb483cf">osTimerDelete</a> (osTimerId timer_id);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Signal Management ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Set the specified Signal Flags of an active thread.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.</span></div>
<div class="line"><span class="comment">/// \param[in] signals specifies the signal flags of the thread that should be set.</span></div>
<div class="line"><span class="comment">/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>int32_t <a class="code" href="group__CMSIS__RTOS__SignalMgmt.html#ga3de2730654589d6c3559c4b9e2825553">osSignalSet</a> (osThreadId thread_id, int32_t signals);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Clear the specified Signal Flags of an active thread.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.</span></div>
<div class="line"><span class="comment">/// \param[in] signals specifies the signal flags of the thread that shall be cleared.</span></div>
<div class="line"><span class="comment">/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters or call from ISR.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>int32_t <a class="code" href="group__CMSIS__RTOS__SignalMgmt.html#ga87283a6ebc31ce9ed42baf3ea7e4eab6">osSignalClear</a> (osThreadId thread_id, int32_t signals);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.</span></div>
<div class="line"><span class="comment">/// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.</span></div>
<div class="line"><span class="comment">/// \return event flag information or error code.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Definitions.html#structosEvent">osEvent</a> <a class="code" href="group__CMSIS__RTOS__SignalMgmt.html#ga38860acda96df47da6923348d96fc4c9">osSignalWait</a> (int32_t signals, uint32_t millisec);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Mutex Management ====</span></div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Define a Mutex.</span></div>
<div class="line"><span class="comment">/// \param name name of the mutex object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMutexDef(name) \</span></div>
<div class="line"><span class="preprocessor">extern const osMutexDef_t os_mutex_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMutexDef(name) \</span></div>
<div class="line"><span class="preprocessor">const osMutexDef_t os_mutex_def_##name = { 0 }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Access a Mutex definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the mutex object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osMutex(name) \</span></div>
<div class="line"><span class="preprocessor">&os_mutex_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create and Initialize a Mutex object.</span></div>
<div class="line"><span class="comment">/// \param[in] mutex_def mutex definition referenced with \ref osMutex.</span></div>
<div class="line"><span class="comment">/// \return mutex ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osMutexId <a class="code" href="group__CMSIS__RTOS__MutexMgmt.html#ga5c9de56e717016e39e788064e9a291cc">osMutexCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosMutexDef__t">osMutexDef_t</a> *mutex_def);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Wait until a Mutex becomes available.</span></div>
<div class="line"><span class="comment">/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__MutexMgmt.html#ga5e1752b73f573ee015dbd9ef1edaba13">osMutexWait</a> (osMutexId mutex_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Release a Mutex that was obtained by \ref osMutexWait.</span></div>
<div class="line"><span class="comment">/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__MutexMgmt.html#ga006e4744d741e8e132c3d5bbc295afe1">osMutexRelease</a> (osMutexId mutex_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Delete a Mutex that was created by \ref osMutexCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__MutexMgmt.html#gac27e24135185d51d18f3dabc20910219">osMutexDelete</a> (osMutexId mutex_id);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Semaphore Management Functions ====</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Define a Semaphore object.</span></div>
<div class="line"><span class="comment">/// \param name name of the semaphore object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osSemaphoreDef(name) \</span></div>
<div class="line"><span class="preprocessor">extern const osSemaphoreDef_t os_semaphore_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osSemaphoreDef(name) \</span></div>
<div class="line"><span class="preprocessor">const osSemaphoreDef_t os_semaphore_def_##name = { 0 }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Access a Semaphore definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the semaphore object.</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osSemaphore(name) \</span></div>
<div class="line"><span class="preprocessor">&os_semaphore_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create and Initialize a Semaphore object used for managing resources.</span></div>
<div class="line"><span class="comment">/// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore.</span></div>
<div class="line"><span class="comment">/// \param[in] count number of available resources.</span></div>
<div class="line"><span class="comment">/// \return semaphore ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osSemaphoreId <a class="code" href="group__CMSIS__RTOS__SemaphoreMgmt.html#ga97381e8e55cd47cec390bf57c96d6edb">osSemaphoreCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosSemaphoreDef__t">osSemaphoreDef_t</a> *semaphore_def, int32_t count);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Wait until a Semaphore token becomes available.</span></div>
<div class="line"><span class="comment">/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.</span></div>
<div class="line"><span class="comment">/// \return number of available tokens, or -1 in case of incorrect parameters.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>int32_t <a class="code" href="group__CMSIS__RTOS__SemaphoreMgmt.html#gacc15b0fc8ce1167fe43da33042e62098">osSemaphoreWait</a> (osSemaphoreId semaphore_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Release a Semaphore token.</span></div>
<div class="line"><span class="comment">/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__SemaphoreMgmt.html#gab108914997c49e14d8ff1ae0d1988ca0">osSemaphoreRelease</a> (osSemaphoreId semaphore_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Delete a Semaphore that was created by \ref osSemaphoreCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__SemaphoreMgmt.html#gabae2801ac2c096f6e8c69a264908f595">osSemaphoreDelete</a> (osSemaphoreId semaphore_id);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#endif // Semaphore available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Memory Pool Management Functions ====</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Define a Memory Pool.</span></div>
<div class="line"><span class="comment">/// \param name name of the memory pool.</span></div>
<div class="line"><span class="comment">/// \param no maximum number of blocks (objects) in the memory pool.</span></div>
<div class="line"><span class="comment">/// \param type data type of a single block (object).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osPoolDef(name, no, type) \</span></div>
<div class="line"><span class="preprocessor">extern const osPoolDef_t os_pool_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osPoolDef(name, no, type) \</span></div>
<div class="line"><span class="preprocessor">const osPoolDef_t os_pool_def_##name = \</span></div>
<div class="line"><span class="preprocessor">{ (no), sizeof(type), NULL }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Access a Memory Pool definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the memory pool</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osPool(name) \</span></div>
<div class="line"><span class="preprocessor">&os_pool_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create and Initialize a memory pool.</span></div>
<div class="line"><span class="comment">/// \param[in] pool_def memory pool definition referenced with \ref osPool.</span></div>
<div class="line"><span class="comment">/// \return memory pool ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osPoolId <a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga34af5c4f4ab38f4138ea7f1f9ece3a1a">osPoolCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosPoolDef__t">osPoolDef_t</a> *pool_def);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Allocate a memory block from a memory pool.</span></div>
<div class="line"><span class="comment">/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.</span></div>
<div class="line"><span class="comment">/// \return address of the allocated memory block or NULL in case of no memory available.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keywordtype">void</span> *<a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#gaa0b2994f1a866c19e0d11e6e0d44f543">osPoolAlloc</a> (osPoolId pool_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Allocate a memory block from a memory pool and set memory block to zero.</span></div>
<div class="line"><span class="comment">/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.</span></div>
<div class="line"><span class="comment">/// \return address of the allocated memory block or NULL in case of no memory available.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keywordtype">void</span> *<a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga9f129fcad4730fbd1048ad4fa262f36a">osPoolCAlloc</a> (osPoolId pool_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Return an allocated memory block back to a specific memory pool.</span></div>
<div class="line"><span class="comment">/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] block address of the allocated memory block that is returned to the memory pool.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga4a861e9c469c9d0daf5721bf174f8e54">osPoolFree</a> (osPoolId pool_id, <span class="keywordtype">void</span> *block);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#endif // Memory Pool Management available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Message Queue Management Functions ====</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Create a Message Queue Definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the queue.</span></div>
<div class="line"><span class="comment">/// \param queue_sz maximum number of messages in the queue.</span></div>
<div class="line"><span class="comment">/// \param type data type of a single message element (for debugger).</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMessageQDef(name, queue_sz, type) \</span></div>
<div class="line"><span class="preprocessor">extern const osMessageQDef_t os_messageQ_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMessageQDef(name, queue_sz, type) \</span></div>
<div class="line"><span class="preprocessor">const osMessageQDef_t os_messageQ_def_##name = \</span></div>
<div class="line"><span class="preprocessor">{ (queue_sz), sizeof (type) }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Access a Message Queue Definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the queue</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osMessageQ(name) \</span></div>
<div class="line"><span class="preprocessor">&os_messageQ_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create and Initialize a Message Queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_def queue definition referenced with \ref osMessageQ.</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.</span></div>
<div class="line"><span class="comment">/// \return message queue ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osMessageQId <a class="code" href="group__CMSIS__RTOS__Message.html#gaf3b9345cf426304d46565152bc26fb78">osMessageCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosMessageQDef__t">osMessageQDef_t</a> *queue_def, osThreadId thread_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Put a Message to a Queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] info message information.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__Message.html#gac0dcf462fc92de8ffaba6cc004514a6d">osMessagePut</a> (osMessageQId queue_id, uint32_t info, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Get a Message or Wait for a Message from a Queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.</span></div>
<div class="line"><span class="comment">/// \return event information that includes status code.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Definitions.html#structosEvent">osEvent</a> <a class="code" href="group__CMSIS__RTOS__Message.html#ga6c6892b8f2296cca6becd57ca2d7e1ae">osMessageGet</a> (osMessageQId queue_id, uint32_t millisec);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#endif // Message Queues available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// ==== Mail Queue Management Functions ====</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Create a Mail Queue Definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the queue</span></div>
<div class="line"><span class="comment">/// \param queue_sz maximum number of messages in queue</span></div>
<div class="line"><span class="comment">/// \param type data type of a single message element</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#if defined (osObjectsExternal) // object is external</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMailQDef(name, queue_sz, type) \</span></div>
<div class="line"><span class="preprocessor">extern const osMailQDef_t os_mailQ_def_##name</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else // define the object</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define osMailQDef(name, queue_sz, type) \</span></div>
<div class="line"><span class="preprocessor">const osMailQDef_t os_mailQ_def_##name = \</span></div>
<div class="line"><span class="preprocessor">{ (queue_sz), sizeof (type) }</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// \brief Access a Mail Queue Definition.</span></div>
<div class="line"><span class="comment">/// \param name name of the queue</span></div>
<div class="line"><span class="comment">/// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the</span></div>
<div class="line"><span class="comment">/// macro body is implementation specific in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="preprocessor">#define osMailQ(name) \</span></div>
<div class="line"><span class="preprocessor">&os_mailQ_def_##name</span></div>
<div class="line"><span class="preprocessor"></span> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Create and Initialize mail queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ</span></div>
<div class="line"><span class="comment">/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.</span></div>
<div class="line"><span class="comment">/// \return mail queue ID for reference by other functions or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span>osMailQId <a class="code" href="group__CMSIS__RTOS__Mail.html#gaa177e7fe5820dd70d8c9e46ded131174">osMailCreate</a> (<span class="keyword">const</span> <a class="code" href="cmsis__os_8h.html#structosMailQDef__t">osMailQDef_t</a> *queue_def, osThreadId thread_id);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Allocate a memory block from a mail.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out</span></div>
<div class="line"><span class="comment">/// \return pointer to memory block that can be filled with mail or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keywordtype">void</span> *<a class="code" href="group__CMSIS__RTOS__Mail.html#gadf5ce811bd6a56e617e902a1db6c2194">osMailAlloc</a> (osMailQId queue_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Allocate a memory block from a mail and set memory block to zero.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out</span></div>
<div class="line"><span class="comment">/// \return pointer to memory block that can be filled with mail or NULL in case of error.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><span class="keywordtype">void</span> *<a class="code" href="group__CMSIS__RTOS__Mail.html#ga8fde74f6fe5b9e88f75cc5eb8f2124fd">osMailCAlloc</a> (osMailQId queue_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Put a mail to a queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__Mail.html#ga485ef6f81854ebda8ffbce4832181e02">osMailPut</a> (osMailQId queue_id, <span class="keywordtype">void</span> *mail);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Get a mail from a queue.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out</span></div>
<div class="line"><span class="comment">/// \return event that contains mail information or error code.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Definitions.html#structosEvent">osEvent</a> <a class="code" href="group__CMSIS__RTOS__Mail.html#gac6ad7e6e7d6c4a80e60da22c57a42ccd">osMailGet</a> (osMailQId queue_id, uint32_t millisec);</div>
<div class="line"> <span class="comment"></span></div>
<div class="line"><span class="comment">/// Free a memory block from a mail.</span></div>
<div class="line"><span class="comment">/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.</span></div>
<div class="line"><span class="comment">/// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet.</span></div>
<div class="line"><span class="comment">/// \return status code that indicates the execution status of the function.</span></div>
<div class="line"><span class="comment">/// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.</span></div>
<div class="line"><span class="comment"></span><a class="code" href="group__CMSIS__RTOS__Status.html#gae2e091fefc4c767117727bd5aba4d99e">osStatus</a> <a class="code" href="group__CMSIS__RTOS__Mail.html#ga27c1060cf21393f96b4fd1ed1c0167cc">osMailFree</a> (osMailQId queue_id, <span class="keywordtype">void</span> *mail);</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#endif // Mail Queues available</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><span class="preprocessor"></span>}</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"><span class="preprocessor">#endif // _CMSIS_OS_H</span></div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="index.html">index</a></li>
<li class="footer">Generated on Wed Jul 10 2019 15:21:01 for CMSIS-RTOS Version 1.03 by Arm Ltd. All rights reserved.
<!--
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
-->
</li>
</ul>
</div>
</body>
</html>
|