libctru/synchronization_8h_source.html
2024-11-03 20:36:34 +00:00

487 lines
86 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libctru: include/3ds/synchronization.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</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: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libctru
&#160;<span id="projectnumber">v2.4.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d475325f6a9fe3bfc3a495c72a9e475e.html">3ds</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">synchronization.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="synchronization_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * @file synchronization.h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> * @brief Provides synchronization locks.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#include &lt;sys/lock.h&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="svc_8h.html">3ds/svc.h</a>&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">/// A light lock.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e"> 10</a></span>&#160;<span class="comment"></span><span class="keyword">typedef</span> _LOCK_T <a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">/// A recursive lock.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179"> 13</a></span>&#160;<span class="comment"></span><span class="keyword">typedef</span> _LOCK_RECURSIVE_T <a class="code" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a>;</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">/// A condition variable.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda"> 16</a></span>&#160;<span class="comment"></span><span class="keyword">typedef</span> <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> <a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">/// A light event.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="structLightEvent.html"> 19</a></span>&#160;<span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;{</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="structLightEvent.html#ab74033485c90671a53cacda0b7c594b4"> 21</a></span>&#160; <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> <a class="code" href="structLightEvent.html#ab74033485c90671a53cacda0b7c594b4">state</a>; <span class="comment">///&lt; State of the event: -2=cleared sticky, -1=cleared oneshot, 0=signaled oneshot, 1=signaled sticky</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="structLightEvent.html#aa903d9a20aebc10972fac85def48f1ac"> 22</a></span>&#160; <a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a> <a class="code" href="structLightEvent.html#aa903d9a20aebc10972fac85def48f1ac">lock</a>; <span class="comment">///&lt; Lock used for sticky timer operation</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;} <a class="code" href="structLightEvent.html">LightEvent</a>;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="comment">/// A light semaphore.</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structLightSemaphore.html"> 26</a></span>&#160;<span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;{</div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structLightSemaphore.html#a56ae7109ea28f871c4ff1d70d556ddbb"> 28</a></span>&#160; <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> <a class="code" href="structLightSemaphore.html#a56ae7109ea28f871c4ff1d70d556ddbb">current_count</a>; <span class="comment">///&lt; The current release count of the semaphore</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structLightSemaphore.html#a5f507ade6f7fe63190d268ccc9f83126"> 29</a></span>&#160; <a class="code" href="types_8h.html#aa980e2c02ba2305e0f489d5650655425">s16</a> <a class="code" href="structLightSemaphore.html#a5f507ade6f7fe63190d268ccc9f83126">num_threads_acq</a>; <span class="comment">///&lt; Number of threads concurrently acquiring the semaphore</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="structLightSemaphore.html#a614ad70962a29c7b0bbe7a43450ff686"> 30</a></span>&#160; <a class="code" href="types_8h.html#aa980e2c02ba2305e0f489d5650655425">s16</a> <a class="code" href="structLightSemaphore.html#a614ad70962a29c7b0bbe7a43450ff686">max_count</a>; <span class="comment">///&lt; The maximum release count of the semaphore</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;} <a class="code" href="structLightSemaphore.html">LightSemaphore</a>;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="comment">/// Performs a Data Synchronization Barrier operation.</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a4f5f4fd74aae52a2310fb2c6a5983e4d"> 34</a></span>&#160;<span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a4f5f4fd74aae52a2310fb2c6a5983e4d">__dsb</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;{</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;mcr p15, 0, %[val], c7, c10, 4&quot;</span> :: [val] <span class="stringliteral">&quot;r&quot;</span> (0) : <span class="stringliteral">&quot;memory&quot;</span>);</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;}</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="comment">/// Performs a Data Memory Barrier operation.</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ab76993c9a7d0327437522dc2e53e770d"> 40</a></span>&#160;<span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#ab76993c9a7d0327437522dc2e53e770d">__dmb</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;{</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;mcr p15, 0, %[val], c7, c10, 5&quot;</span> :: [val] <span class="stringliteral">&quot;r&quot;</span> (0) : <span class="stringliteral">&quot;memory&quot;</span>);</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;}</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="comment">/// Performs an Instruction Synchronization Barrier (officially &quot;flush prefetch buffer&quot;) operation.</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a88917e3c9a446a5d078165af7b9c884c"> 46</a></span>&#160;<span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a88917e3c9a446a5d078165af7b9c884c">__isb</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;{</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;mcr p15, 0, %[val], c7, c5, 4&quot;</span> :: [val] <span class="stringliteral">&quot;r&quot;</span> (0) : <span class="stringliteral">&quot;memory&quot;</span>);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;}</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment">/// Performs a clrex operation.</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="synchronization_8h.html#af5fdce28704bc8d418fe9aaed04d4e90"> 52</a></span>&#160;<span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#af5fdce28704bc8d418fe9aaed04d4e90">__clrex</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;{</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;clrex&quot;</span> ::: <span class="stringliteral">&quot;memory&quot;</span>);</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;}</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="comment"> * @brief Performs a ldrex operation.</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="comment"> * @return The resulting value.</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a9fe83ca3ec3c6ae269203acf367ad5a9"> 62</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> <a class="code" href="synchronization_8h.html#a9fe83ca3ec3c6ae269203acf367ad5a9">__ldrex</a>(<a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a>* addr)</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;{</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> val;</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;ldrex %[val], %[addr]&quot;</span> : [val] <span class="stringliteral">&quot;=r&quot;</span> (val) : [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keywordflow">return</span> val;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;}</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="comment"> * @brief Performs a strex operation.</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment"> * @param val Value to store.</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="comment"> * @return Whether the operation was successful.</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ae5b6bc8b7ae74b57efbb0707c1d6cea9"> 75</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="synchronization_8h.html#ae5b6bc8b7ae74b57efbb0707c1d6cea9">__strex</a>(<a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a>* addr, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> val)</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;{</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordtype">bool</span> res;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;strex %[res], %[val], %[addr]&quot;</span> : [res] <span class="stringliteral">&quot;=&amp;r&quot;</span> (res) : [val] <span class="stringliteral">&quot;r&quot;</span> (val), [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;}</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<span class="comment"> * @brief Performs a ldrexh operation.</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<span class="comment"> * @return The resulting value.</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ac8b9943bc74f25d3efa4c413cd3e5be6"> 87</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a> <a class="code" href="synchronization_8h.html#ac8b9943bc74f25d3efa4c413cd3e5be6">__ldrexh</a>(<a class="code" href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a>* addr)</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;{</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <a class="code" href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a> val;</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;ldrexh %[val], %[addr]&quot;</span> : [val] <span class="stringliteral">&quot;=r&quot;</span> (val) : [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keywordflow">return</span> val;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;}</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="comment"> * @brief Performs a strexh operation.</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="comment"> * @param val Value to store.</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<span class="comment"> * @return Whether the operation was successful.</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a276f8cccf5abeb6b35f067b7a8c9a40c"> 100</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="synchronization_8h.html#a276f8cccf5abeb6b35f067b7a8c9a40c">__strexh</a>(<a class="code" href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a>* addr, <a class="code" href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a> val)</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;{</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordtype">bool</span> res;</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;strexh %[res], %[val], %[addr]&quot;</span> : [res] <span class="stringliteral">&quot;=&amp;r&quot;</span> (res) : [val] <span class="stringliteral">&quot;r&quot;</span> (val), [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;}</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="comment"> * @brief Performs a ldrexb operation.</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="comment"> * @return The resulting value.</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a3edf8cb6c54dca775890c04e57919d73"> 112</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> <a class="code" href="synchronization_8h.html#a3edf8cb6c54dca775890c04e57919d73">__ldrexb</a>(<a class="code" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a>* addr)</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;{</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <a class="code" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> val;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;ldrexb %[val], %[addr]&quot;</span> : [val] <span class="stringliteral">&quot;=r&quot;</span> (val) : [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordflow">return</span> val;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;}</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;<span class="comment"> * @brief Performs a strexb operation.</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;<span class="comment"> * @param addr Address to perform the operation on.</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="comment"> * @param val Value to store.</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="comment"> * @return Whether the operation was successful.</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="synchronization_8h.html#acd9826a3a62cf5190048acde58e69776"> 125</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="synchronization_8h.html#acd9826a3a62cf5190048acde58e69776">__strexb</a>(<a class="code" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a>* addr, <a class="code" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> val)</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;{</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordtype">bool</span> res;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; __asm__ __volatile__(<span class="stringliteral">&quot;strexb %[res], %[val], %[addr]&quot;</span> : [res] <span class="stringliteral">&quot;=&amp;r&quot;</span> (res) : [val] <span class="stringliteral">&quot;r&quot;</span> (val), [addr] <span class="stringliteral">&quot;Q&quot;</span> (*addr));</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;}</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;<span class="comment">/// Performs an atomic pre-increment operation.</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a77f9a3fcb480540a1cfc0891f00963ed"> 133</a></span>&#160;<span class="comment"></span><span class="preprocessor">#define AtomicIncrement(ptr) __atomic_add_fetch((u32*)(ptr), 1, __ATOMIC_SEQ_CST)</span><span class="comment"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="comment">/// Performs an atomic pre-decrement operation.</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a609965cc7d1f801675ef5901dbe07a15"> 135</a></span>&#160;<span class="comment"></span><span class="preprocessor">#define AtomicDecrement(ptr) __atomic_sub_fetch((u32*)(ptr), 1, __ATOMIC_SEQ_CST)</span><span class="comment"></span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<span class="comment">/// Performs an atomic post-increment operation.</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a191063fc32cdc8187a24b44cb48ff324"> 137</a></span>&#160;<span class="comment"></span><span class="preprocessor">#define AtomicPostIncrement(ptr) __atomic_fetch_add((u32*)(ptr), 1, __ATOMIC_SEQ_CST)</span><span class="comment"></span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;<span class="comment">/// Performs an atomic post-decrement operation.</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a76bf51e5d535d5bd3d2f34eee9ca4956"> 139</a></span>&#160;<span class="comment"></span><span class="preprocessor">#define AtomicPostDecrement(ptr) __atomic_fetch_sub((u32*)(ptr), 1, __ATOMIC_SEQ_CST)</span><span class="comment"></span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="comment">/// Performs an atomic swap operation.</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a5bc74ad985f95799e927cc50a4ebd9c3"> 141</a></span>&#160;<span class="comment"></span><span class="preprocessor">#define AtomicSwap(ptr, value) __atomic_exchange_n((u32*)(ptr), (value), __ATOMIC_SEQ_CST)</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<span class="comment"> * @brief Function used to implement user-mode synchronization primitives.</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="comment"> * @param addr Pointer to a signed 32-bit value whose address will be used to identify waiting threads.</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;<span class="comment"> * @param type Type of action to be performed by the arbiter</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;<span class="comment"> * @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;<span class="comment"> * This will perform an arbitration based on #type. The comparisons are done between #value and the value at the address #addr.</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;<span class="comment"> * @code</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;<span class="comment"> * s32 val=0;</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;<span class="comment"> * // Does *nothing* since val &gt;= 0</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;<span class="comment"> * syncArbitrateAddress(&amp;val,ARBITRATION_WAIT_IF_LESS_THAN,0);</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;<span class="comment"> * @endcode</span></div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;<span class="comment"> * @note Usage of this function entails an implicit Data Memory Barrier (dmb).</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a15f62531caa3fa14f5eac4735d96f9f7"> 159</a></span>&#160;<a class="code" href="types_8h.html#ac830bf5a4f2cf8273f61ab99a46cf163">Result</a> <a class="code" href="synchronization_8h.html#a15f62531caa3fa14f5eac4735d96f9f7">syncArbitrateAddress</a>(<a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a>* addr, <a class="code" href="svc_8h.html#a00f5b708129ef172b59197a775b533ec">ArbitrationType</a> type, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> value);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;<span class="comment"> * @brief Function used to implement user-mode synchronization primitives (with timeout).</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;<span class="comment"> * @param addr Pointer to a signed 32-bit value whose address will be used to identify waiting threads.</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160;<span class="comment"> * @param type Type of action to be performed by the arbiter (must use \ref ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT or \ref ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT)</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;<span class="comment"> * @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.</span></div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;<span class="comment"> * This will perform an arbitration based on #type. The comparisons are done between #value and the value at the address #addr.</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;<span class="comment"> * @code</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160;<span class="comment"> * s32 val=0;</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;<span class="comment"> * // Thread will wait for a signal or wake up after 10000000 nanoseconds because val &lt; 1.</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;<span class="comment"> * syncArbitrateAddressWithTimeout(&amp;val,ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT,1,10000000LL);</span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160;<span class="comment"> * @endcode</span></div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;<span class="comment"> * @note Usage of this function entails an implicit Data Memory Barrier (dmb).</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a3ce965a644db4534de988a203751c56d"> 177</a></span>&#160;<a class="code" href="types_8h.html#ac830bf5a4f2cf8273f61ab99a46cf163">Result</a> <a class="code" href="synchronization_8h.html#a3ce965a644db4534de988a203751c56d">syncArbitrateAddressWithTimeout</a>(<a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a>* addr, <a class="code" href="svc_8h.html#a00f5b708129ef172b59197a775b533ec">ArbitrationType</a> type, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> value, <a class="code" href="types_8h.html#a350c6fc928e3bdc6c6486268ac8fb269">s64</a> timeout_ns);</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160;<span class="comment"> * @brief Initializes a light lock.</span></div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a81f625fde46405c1d539b1581d54fb05"> 183</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a81f625fde46405c1d539b1581d54fb05">LightLock_Init</a>(<a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock);</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160;<span class="comment"> * @brief Locks a light lock.</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ae75aac6e4bfe30037c8a9de916a6ddb8"> 189</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#ae75aac6e4bfe30037c8a9de916a6ddb8">LightLock_Lock</a>(<a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock);</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;<span class="comment"> * @brief Attempts to lock a light lock.</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="comment"> * @return Zero on success, non-zero on failure.</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a1a1d677c021a8487d567f832dea9d9db"> 196</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#a1a1d677c021a8487d567f832dea9d9db">LightLock_TryLock</a>(<a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="comment"> * @brief Unlocks a light lock.</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a82283ae772ec2eac3a193b1431a681af"> 202</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a82283ae772ec2eac3a193b1431a681af">LightLock_Unlock</a>(<a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock);</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160;<span class="comment"> * @brief Initializes a recursive lock.</span></div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a1bbbe87bf212a32850ac9f0b6aa73408"> 208</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a1bbbe87bf212a32850ac9f0b6aa73408">RecursiveLock_Init</a>(<a class="code" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a>* lock);</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160;<span class="comment"> * @brief Locks a recursive lock.</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00214"></a><span class="lineno"><a class="line" href="synchronization_8h.html#afea61e6ff137d96934bb145d44095ccb"> 214</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#afea61e6ff137d96934bb145d44095ccb">RecursiveLock_Lock</a>(<a class="code" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a>* lock);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;<span class="comment"> * @brief Attempts to lock a recursive lock.</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="comment"> * @return Zero on success, non-zero on failure.</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a8808924fdee80220f83b6992bc5e104d"> 221</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#a8808924fdee80220f83b6992bc5e104d">RecursiveLock_TryLock</a>(<a class="code" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a>* lock);</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;<span class="comment"> * @brief Unlocks a recursive lock.</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;<span class="comment"> * @param lock Pointer to the lock.</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a529b21c4a974abeea24b1dcceb75cf62"> 227</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a529b21c4a974abeea24b1dcceb75cf62">RecursiveLock_Unlock</a>(<a class="code" href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a>* lock);</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160;<span class="comment"> * @brief Initializes a condition variable.</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ab8afa06278ad323a3c80210adef7310b"> 233</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#ab8afa06278ad323a3c80210adef7310b">CondVar_Init</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="comment"> * @brief Waits on a condition variable.</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;<span class="comment"> * @param lock Pointer to the lock to atomically unlock/relock during the wait.</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a9d0a741fa7f5c6be9dc98e296817b293"> 240</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a9d0a741fa7f5c6be9dc98e296817b293">CondVar_Wait</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv, <a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;<span class="comment"> * @brief Waits on a condition variable with a timeout.</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;<span class="comment"> * @param lock Pointer to the lock to atomically unlock/relock during the wait.</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="comment"> * @param timeout_ns Timeout in nanoseconds.</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;<span class="comment"> * @return Zero on success, non-zero on failure.</span></div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="synchronization_8h.html#aa7aabd77eba2813fb5508e726335b211"> 249</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#aa7aabd77eba2813fb5508e726335b211">CondVar_WaitTimeout</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv, <a class="code" href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a>* lock, <a class="code" href="types_8h.html#a350c6fc928e3bdc6c6486268ac8fb269">s64</a> timeout_ns);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;<span class="comment"> * @brief Wakes up threads waiting on a condition variable.</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;<span class="comment"> * @param num_threads Maximum number of threads to wake up (or \ref ARBITRATION_SIGNAL_ALL to wake them all).</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a42f864222898c73a1add9d38dc549879"> 256</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a42f864222898c73a1add9d38dc549879">CondVar_WakeUp</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> num_threads);</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;<span class="comment"> * @brief Wakes up a single thread waiting on a condition variable.</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a3e098ef4bf7e1fe17f2a3929cd38d20d"> 262</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a3e098ef4bf7e1fe17f2a3929cd38d20d">CondVar_Signal</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv)</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;{</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <a class="code" href="synchronization_8h.html#a42f864222898c73a1add9d38dc549879">CondVar_WakeUp</a>(cv, 1);</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160;}</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="comment"> * @brief Wakes up all threads waiting on a condition variable.</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;<span class="comment"> * @param cv Pointer to the condition variable.</span></div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00271"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ac7ba47b2c6fee27ddfe7cdda4d9baa91"> 271</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#ac7ba47b2c6fee27ddfe7cdda4d9baa91">CondVar_Broadcast</a>(<a class="code" href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a>* cv)</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;{</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <a class="code" href="synchronization_8h.html#a42f864222898c73a1add9d38dc549879">CondVar_WakeUp</a>(cv, <a class="code" href="svc_8h.html#acca9c678c119f4d1291e09c58f9ccaf5">ARBITRATION_SIGNAL_ALL</a>);</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160;}</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;<span class="comment"> * @brief Initializes a light event.</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="comment"> * @param reset_type Type of reset the event uses (RESET_ONESHOT/RESET_STICKY).</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00281"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a2c159aa9078752dbd82da805539b2041"> 281</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a2c159aa9078752dbd82da805539b2041">LightEvent_Init</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event, <a class="code" href="svc_8h.html#adfe6b9db49aa88865e1fff5e559f6fdf">ResetType</a> reset_type);</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;<span class="comment"> * @brief Clears a light event.</span></div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00287"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a6c6fd28b9c7fd324c3e70d30118a06ce"> 287</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a6c6fd28b9c7fd324c3e70d30118a06ce">LightEvent_Clear</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event);</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;<span class="comment"> * @brief Wakes up threads waiting on a sticky light event without signaling it. If the event had been signaled before, it is cleared instead.</span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00293"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a3a54526dc1d5f9e1d84b92ce10194a2d"> 293</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a3a54526dc1d5f9e1d84b92ce10194a2d">LightEvent_Pulse</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event);</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;<span class="comment"> * @brief Signals a light event, waking up threads waiting on it.</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00299"></a><span class="lineno"><a class="line" href="synchronization_8h.html#acad8ac29952dad0bb22d2453afd38277"> 299</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#acad8ac29952dad0bb22d2453afd38277">LightEvent_Signal</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event);</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="comment"> * @brief Attempts to wait on a light event.</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160;<span class="comment"> * @return Non-zero if the event was signaled, zero otherwise.</span></div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a347ff040af029b4bbaae6f65f0e48de9"> 306</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#a347ff040af029b4bbaae6f65f0e48de9">LightEvent_TryWait</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event);</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160;<span class="comment"> * @brief Waits on a light event.</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a0cb8fd551e01b94cd6d0ae23da6a1074"> 312</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a0cb8fd551e01b94cd6d0ae23da6a1074">LightEvent_Wait</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event);</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;<span class="comment"> * @brief Waits on a light event until either the event is signaled or the timeout is reached.</span></div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;<span class="comment"> * @param event Pointer to the event.</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;<span class="comment"> * @param timeout_ns Timeout in nanoseconds.</span></div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160;<span class="comment"> * @return Non-zero on timeout, zero otherwise.</span></div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="line" href="synchronization_8h.html#aac847c6acd805d89a04984f166349098"> 320</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#aac847c6acd805d89a04984f166349098">LightEvent_WaitTimeout</a>(<a class="code" href="structLightEvent.html">LightEvent</a>* event, <a class="code" href="types_8h.html#a350c6fc928e3bdc6c6486268ac8fb269">s64</a> timeout_ns);</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160;<span class="comment"> * @brief Initializes a light semaphore.</span></div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160;<span class="comment"> * @param event Pointer to the semaphore.</span></div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160;<span class="comment"> * @param max_count Initial count of the semaphore.</span></div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;<span class="comment"> * @param max_count Maximum count of the semaphore.</span></div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="synchronization_8h.html#acf3e0856c84bcdfd25c389fe5dd8663d"> 328</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#acf3e0856c84bcdfd25c389fe5dd8663d">LightSemaphore_Init</a>(<a class="code" href="structLightSemaphore.html">LightSemaphore</a>* semaphore, <a class="code" href="types_8h.html#aa980e2c02ba2305e0f489d5650655425">s16</a> initial_count, <a class="code" href="types_8h.html#aa980e2c02ba2305e0f489d5650655425">s16</a> max_count);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160;<span class="comment"> * @brief Acquires a light semaphore.</span></div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160;<span class="comment"> * @param semaphore Pointer to the semaphore.</span></div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160;<span class="comment"> * @param count Acquire count</span></div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00335"></a><span class="lineno"><a class="line" href="synchronization_8h.html#ad45ead296d3c1a87bd4e4cc0fb271040"> 335</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#ad45ead296d3c1a87bd4e4cc0fb271040">LightSemaphore_Acquire</a>(<a class="code" href="structLightSemaphore.html">LightSemaphore</a>* semaphore, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> count);</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160;<span class="comment"> * @brief Attempts to acquire a light semaphore.</span></div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160;<span class="comment"> * @param semaphore Pointer to the semaphore.</span></div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160;<span class="comment"> * @param count Acquire count</span></div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160;<span class="comment"> * @return Zero on success, non-zero on failure</span></div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00343"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a45ee3fb7b594430648015119f0f6c352"> 343</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="synchronization_8h.html#a45ee3fb7b594430648015119f0f6c352">LightSemaphore_TryAcquire</a>(<a class="code" href="structLightSemaphore.html">LightSemaphore</a>* semaphore, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> count);</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160;<span class="comment"> * @brief Releases a light semaphore.</span></div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;<span class="comment"> * @param semaphore Pointer to the semaphore.</span></div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160;<span class="comment"> * @param count Release count</span></div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00350"></a><span class="lineno"><a class="line" href="synchronization_8h.html#a3f99c1cb0adc57d94823312b81e5518c"> 350</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="synchronization_8h.html#a3f99c1cb0adc57d94823312b81e5518c">LightSemaphore_Release</a>(<a class="code" href="structLightSemaphore.html">LightSemaphore</a>* semaphore, <a class="code" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> count);</div>
<div class="ttc" id="astructLightEvent_html"><div class="ttname"><a href="structLightEvent.html">LightEvent</a></div><div class="ttdoc">A light event.</div><div class="ttdef"><b>Definition:</b> synchronization.h:20</div></div>
<div class="ttc" id="astructLightEvent_html_aa903d9a20aebc10972fac85def48f1ac"><div class="ttname"><a href="structLightEvent.html#aa903d9a20aebc10972fac85def48f1ac">LightEvent::lock</a></div><div class="ttdeci">LightLock lock</div><div class="ttdoc">Lock used for sticky timer operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:22</div></div>
<div class="ttc" id="astructLightEvent_html_ab74033485c90671a53cacda0b7c594b4"><div class="ttname"><a href="structLightEvent.html#ab74033485c90671a53cacda0b7c594b4">LightEvent::state</a></div><div class="ttdeci">s32 state</div><div class="ttdoc">State of the event: -2=cleared sticky, -1=cleared oneshot, 0=signaled oneshot, 1=signaled sticky.</div><div class="ttdef"><b>Definition:</b> synchronization.h:21</div></div>
<div class="ttc" id="astructLightSemaphore_html"><div class="ttname"><a href="structLightSemaphore.html">LightSemaphore</a></div><div class="ttdoc">A light semaphore.</div><div class="ttdef"><b>Definition:</b> synchronization.h:27</div></div>
<div class="ttc" id="astructLightSemaphore_html_a56ae7109ea28f871c4ff1d70d556ddbb"><div class="ttname"><a href="structLightSemaphore.html#a56ae7109ea28f871c4ff1d70d556ddbb">LightSemaphore::current_count</a></div><div class="ttdeci">s32 current_count</div><div class="ttdoc">The current release count of the semaphore.</div><div class="ttdef"><b>Definition:</b> synchronization.h:28</div></div>
<div class="ttc" id="astructLightSemaphore_html_a5f507ade6f7fe63190d268ccc9f83126"><div class="ttname"><a href="structLightSemaphore.html#a5f507ade6f7fe63190d268ccc9f83126">LightSemaphore::num_threads_acq</a></div><div class="ttdeci">s16 num_threads_acq</div><div class="ttdoc">Number of threads concurrently acquiring the semaphore.</div><div class="ttdef"><b>Definition:</b> synchronization.h:29</div></div>
<div class="ttc" id="astructLightSemaphore_html_a614ad70962a29c7b0bbe7a43450ff686"><div class="ttname"><a href="structLightSemaphore.html#a614ad70962a29c7b0bbe7a43450ff686">LightSemaphore::max_count</a></div><div class="ttdeci">s16 max_count</div><div class="ttdoc">The maximum release count of the semaphore.</div><div class="ttdef"><b>Definition:</b> synchronization.h:30</div></div>
<div class="ttc" id="asvc_8h_html"><div class="ttname"><a href="svc_8h.html">svc.h</a></div><div class="ttdoc">Syscall wrappers.</div></div>
<div class="ttc" id="asvc_8h_html_a00f5b708129ef172b59197a775b533ec"><div class="ttname"><a href="svc_8h.html#a00f5b708129ef172b59197a775b533ec">ArbitrationType</a></div><div class="ttdeci">ArbitrationType</div><div class="ttdoc">Arbitration modes.</div><div class="ttdef"><b>Definition:</b> svc.h:88</div></div>
<div class="ttc" id="asvc_8h_html_acca9c678c119f4d1291e09c58f9ccaf5"><div class="ttname"><a href="svc_8h.html#acca9c678c119f4d1291e09c58f9ccaf5">ARBITRATION_SIGNAL_ALL</a></div><div class="ttdeci">#define ARBITRATION_SIGNAL_ALL</div><div class="ttdoc">Special value to signal all the threads.</div><div class="ttdef"><b>Definition:</b> svc.h:97</div></div>
<div class="ttc" id="asvc_8h_html_adfe6b9db49aa88865e1fff5e559f6fdf"><div class="ttname"><a href="svc_8h.html#adfe6b9db49aa88865e1fff5e559f6fdf">ResetType</a></div><div class="ttdeci">ResetType</div><div class="ttdoc">Reset types (for use with events and timers)</div><div class="ttdef"><b>Definition:</b> svc.h:105</div></div>
<div class="ttc" id="asynchronization_8h_html_a0cb8fd551e01b94cd6d0ae23da6a1074"><div class="ttname"><a href="synchronization_8h.html#a0cb8fd551e01b94cd6d0ae23da6a1074">LightEvent_Wait</a></div><div class="ttdeci">void LightEvent_Wait(LightEvent *event)</div><div class="ttdoc">Waits on a light event.</div></div>
<div class="ttc" id="asynchronization_8h_html_a0d966c33d353bedf60c66a1a75e68c5e"><div class="ttname"><a href="synchronization_8h.html#a0d966c33d353bedf60c66a1a75e68c5e">LightLock</a></div><div class="ttdeci">_LOCK_T LightLock</div><div class="ttdoc">A light lock.</div><div class="ttdef"><b>Definition:</b> synchronization.h:10</div></div>
<div class="ttc" id="asynchronization_8h_html_a15f62531caa3fa14f5eac4735d96f9f7"><div class="ttname"><a href="synchronization_8h.html#a15f62531caa3fa14f5eac4735d96f9f7">syncArbitrateAddress</a></div><div class="ttdeci">Result syncArbitrateAddress(s32 *addr, ArbitrationType type, s32 value)</div><div class="ttdoc">Function used to implement user-mode synchronization primitives.</div></div>
<div class="ttc" id="asynchronization_8h_html_a1a1d677c021a8487d567f832dea9d9db"><div class="ttname"><a href="synchronization_8h.html#a1a1d677c021a8487d567f832dea9d9db">LightLock_TryLock</a></div><div class="ttdeci">int LightLock_TryLock(LightLock *lock)</div><div class="ttdoc">Attempts to lock a light lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a1bbbe87bf212a32850ac9f0b6aa73408"><div class="ttname"><a href="synchronization_8h.html#a1bbbe87bf212a32850ac9f0b6aa73408">RecursiveLock_Init</a></div><div class="ttdeci">void RecursiveLock_Init(RecursiveLock *lock)</div><div class="ttdoc">Initializes a recursive lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a276f8cccf5abeb6b35f067b7a8c9a40c"><div class="ttname"><a href="synchronization_8h.html#a276f8cccf5abeb6b35f067b7a8c9a40c">__strexh</a></div><div class="ttdeci">static bool __strexh(u16 *addr, u16 val)</div><div class="ttdoc">Performs a strexh operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:100</div></div>
<div class="ttc" id="asynchronization_8h_html_a2c159aa9078752dbd82da805539b2041"><div class="ttname"><a href="synchronization_8h.html#a2c159aa9078752dbd82da805539b2041">LightEvent_Init</a></div><div class="ttdeci">void LightEvent_Init(LightEvent *event, ResetType reset_type)</div><div class="ttdoc">Initializes a light event.</div></div>
<div class="ttc" id="asynchronization_8h_html_a347ff040af029b4bbaae6f65f0e48de9"><div class="ttname"><a href="synchronization_8h.html#a347ff040af029b4bbaae6f65f0e48de9">LightEvent_TryWait</a></div><div class="ttdeci">int LightEvent_TryWait(LightEvent *event)</div><div class="ttdoc">Attempts to wait on a light event.</div></div>
<div class="ttc" id="asynchronization_8h_html_a3a54526dc1d5f9e1d84b92ce10194a2d"><div class="ttname"><a href="synchronization_8h.html#a3a54526dc1d5f9e1d84b92ce10194a2d">LightEvent_Pulse</a></div><div class="ttdeci">void LightEvent_Pulse(LightEvent *event)</div><div class="ttdoc">Wakes up threads waiting on a sticky light event without signaling it.</div></div>
<div class="ttc" id="asynchronization_8h_html_a3ce965a644db4534de988a203751c56d"><div class="ttname"><a href="synchronization_8h.html#a3ce965a644db4534de988a203751c56d">syncArbitrateAddressWithTimeout</a></div><div class="ttdeci">Result syncArbitrateAddressWithTimeout(s32 *addr, ArbitrationType type, s32 value, s64 timeout_ns)</div><div class="ttdoc">Function used to implement user-mode synchronization primitives (with timeout).</div></div>
<div class="ttc" id="asynchronization_8h_html_a3e098ef4bf7e1fe17f2a3929cd38d20d"><div class="ttname"><a href="synchronization_8h.html#a3e098ef4bf7e1fe17f2a3929cd38d20d">CondVar_Signal</a></div><div class="ttdeci">static void CondVar_Signal(CondVar *cv)</div><div class="ttdoc">Wakes up a single thread waiting on a condition variable.</div><div class="ttdef"><b>Definition:</b> synchronization.h:262</div></div>
<div class="ttc" id="asynchronization_8h_html_a3edf8cb6c54dca775890c04e57919d73"><div class="ttname"><a href="synchronization_8h.html#a3edf8cb6c54dca775890c04e57919d73">__ldrexb</a></div><div class="ttdeci">static u8 __ldrexb(u8 *addr)</div><div class="ttdoc">Performs a ldrexb operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:112</div></div>
<div class="ttc" id="asynchronization_8h_html_a3f99c1cb0adc57d94823312b81e5518c"><div class="ttname"><a href="synchronization_8h.html#a3f99c1cb0adc57d94823312b81e5518c">LightSemaphore_Release</a></div><div class="ttdeci">void LightSemaphore_Release(LightSemaphore *semaphore, s32 count)</div><div class="ttdoc">Releases a light semaphore.</div></div>
<div class="ttc" id="asynchronization_8h_html_a42f864222898c73a1add9d38dc549879"><div class="ttname"><a href="synchronization_8h.html#a42f864222898c73a1add9d38dc549879">CondVar_WakeUp</a></div><div class="ttdeci">void CondVar_WakeUp(CondVar *cv, s32 num_threads)</div><div class="ttdoc">Wakes up threads waiting on a condition variable.</div></div>
<div class="ttc" id="asynchronization_8h_html_a45ee3fb7b594430648015119f0f6c352"><div class="ttname"><a href="synchronization_8h.html#a45ee3fb7b594430648015119f0f6c352">LightSemaphore_TryAcquire</a></div><div class="ttdeci">int LightSemaphore_TryAcquire(LightSemaphore *semaphore, s32 count)</div><div class="ttdoc">Attempts to acquire a light semaphore.</div></div>
<div class="ttc" id="asynchronization_8h_html_a4f5f4fd74aae52a2310fb2c6a5983e4d"><div class="ttname"><a href="synchronization_8h.html#a4f5f4fd74aae52a2310fb2c6a5983e4d">__dsb</a></div><div class="ttdeci">static void __dsb(void)</div><div class="ttdoc">Performs a Data Synchronization Barrier operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:34</div></div>
<div class="ttc" id="asynchronization_8h_html_a529b21c4a974abeea24b1dcceb75cf62"><div class="ttname"><a href="synchronization_8h.html#a529b21c4a974abeea24b1dcceb75cf62">RecursiveLock_Unlock</a></div><div class="ttdeci">void RecursiveLock_Unlock(RecursiveLock *lock)</div><div class="ttdoc">Unlocks a recursive lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a6c6fd28b9c7fd324c3e70d30118a06ce"><div class="ttname"><a href="synchronization_8h.html#a6c6fd28b9c7fd324c3e70d30118a06ce">LightEvent_Clear</a></div><div class="ttdeci">void LightEvent_Clear(LightEvent *event)</div><div class="ttdoc">Clears a light event.</div></div>
<div class="ttc" id="asynchronization_8h_html_a7da2ad46c2b89e00508f9220dd877eda"><div class="ttname"><a href="synchronization_8h.html#a7da2ad46c2b89e00508f9220dd877eda">CondVar</a></div><div class="ttdeci">s32 CondVar</div><div class="ttdoc">A condition variable.</div><div class="ttdef"><b>Definition:</b> synchronization.h:16</div></div>
<div class="ttc" id="asynchronization_8h_html_a81f625fde46405c1d539b1581d54fb05"><div class="ttname"><a href="synchronization_8h.html#a81f625fde46405c1d539b1581d54fb05">LightLock_Init</a></div><div class="ttdeci">void LightLock_Init(LightLock *lock)</div><div class="ttdoc">Initializes a light lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a82283ae772ec2eac3a193b1431a681af"><div class="ttname"><a href="synchronization_8h.html#a82283ae772ec2eac3a193b1431a681af">LightLock_Unlock</a></div><div class="ttdeci">void LightLock_Unlock(LightLock *lock)</div><div class="ttdoc">Unlocks a light lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a8808924fdee80220f83b6992bc5e104d"><div class="ttname"><a href="synchronization_8h.html#a8808924fdee80220f83b6992bc5e104d">RecursiveLock_TryLock</a></div><div class="ttdeci">int RecursiveLock_TryLock(RecursiveLock *lock)</div><div class="ttdoc">Attempts to lock a recursive lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_a88917e3c9a446a5d078165af7b9c884c"><div class="ttname"><a href="synchronization_8h.html#a88917e3c9a446a5d078165af7b9c884c">__isb</a></div><div class="ttdeci">static void __isb(void)</div><div class="ttdoc">Performs an Instruction Synchronization Barrier (officially &quot;flush prefetch buffer&quot;) operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:46</div></div>
<div class="ttc" id="asynchronization_8h_html_a9d0a741fa7f5c6be9dc98e296817b293"><div class="ttname"><a href="synchronization_8h.html#a9d0a741fa7f5c6be9dc98e296817b293">CondVar_Wait</a></div><div class="ttdeci">void CondVar_Wait(CondVar *cv, LightLock *lock)</div><div class="ttdoc">Waits on a condition variable.</div></div>
<div class="ttc" id="asynchronization_8h_html_a9fe83ca3ec3c6ae269203acf367ad5a9"><div class="ttname"><a href="synchronization_8h.html#a9fe83ca3ec3c6ae269203acf367ad5a9">__ldrex</a></div><div class="ttdeci">static s32 __ldrex(s32 *addr)</div><div class="ttdoc">Performs a ldrex operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:62</div></div>
<div class="ttc" id="asynchronization_8h_html_aa7aabd77eba2813fb5508e726335b211"><div class="ttname"><a href="synchronization_8h.html#aa7aabd77eba2813fb5508e726335b211">CondVar_WaitTimeout</a></div><div class="ttdeci">int CondVar_WaitTimeout(CondVar *cv, LightLock *lock, s64 timeout_ns)</div><div class="ttdoc">Waits on a condition variable with a timeout.</div></div>
<div class="ttc" id="asynchronization_8h_html_aac847c6acd805d89a04984f166349098"><div class="ttname"><a href="synchronization_8h.html#aac847c6acd805d89a04984f166349098">LightEvent_WaitTimeout</a></div><div class="ttdeci">int LightEvent_WaitTimeout(LightEvent *event, s64 timeout_ns)</div><div class="ttdoc">Waits on a light event until either the event is signaled or the timeout is reached.</div></div>
<div class="ttc" id="asynchronization_8h_html_ab76993c9a7d0327437522dc2e53e770d"><div class="ttname"><a href="synchronization_8h.html#ab76993c9a7d0327437522dc2e53e770d">__dmb</a></div><div class="ttdeci">static void __dmb(void)</div><div class="ttdoc">Performs a Data Memory Barrier operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:40</div></div>
<div class="ttc" id="asynchronization_8h_html_ab8afa06278ad323a3c80210adef7310b"><div class="ttname"><a href="synchronization_8h.html#ab8afa06278ad323a3c80210adef7310b">CondVar_Init</a></div><div class="ttdeci">void CondVar_Init(CondVar *cv)</div><div class="ttdoc">Initializes a condition variable.</div></div>
<div class="ttc" id="asynchronization_8h_html_ac7ba47b2c6fee27ddfe7cdda4d9baa91"><div class="ttname"><a href="synchronization_8h.html#ac7ba47b2c6fee27ddfe7cdda4d9baa91">CondVar_Broadcast</a></div><div class="ttdeci">static void CondVar_Broadcast(CondVar *cv)</div><div class="ttdoc">Wakes up all threads waiting on a condition variable.</div><div class="ttdef"><b>Definition:</b> synchronization.h:271</div></div>
<div class="ttc" id="asynchronization_8h_html_ac8b9943bc74f25d3efa4c413cd3e5be6"><div class="ttname"><a href="synchronization_8h.html#ac8b9943bc74f25d3efa4c413cd3e5be6">__ldrexh</a></div><div class="ttdeci">static u16 __ldrexh(u16 *addr)</div><div class="ttdoc">Performs a ldrexh operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:87</div></div>
<div class="ttc" id="asynchronization_8h_html_acad8ac29952dad0bb22d2453afd38277"><div class="ttname"><a href="synchronization_8h.html#acad8ac29952dad0bb22d2453afd38277">LightEvent_Signal</a></div><div class="ttdeci">void LightEvent_Signal(LightEvent *event)</div><div class="ttdoc">Signals a light event, waking up threads waiting on it.</div></div>
<div class="ttc" id="asynchronization_8h_html_acd9826a3a62cf5190048acde58e69776"><div class="ttname"><a href="synchronization_8h.html#acd9826a3a62cf5190048acde58e69776">__strexb</a></div><div class="ttdeci">static bool __strexb(u8 *addr, u8 val)</div><div class="ttdoc">Performs a strexb operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:125</div></div>
<div class="ttc" id="asynchronization_8h_html_acf3e0856c84bcdfd25c389fe5dd8663d"><div class="ttname"><a href="synchronization_8h.html#acf3e0856c84bcdfd25c389fe5dd8663d">LightSemaphore_Init</a></div><div class="ttdeci">void LightSemaphore_Init(LightSemaphore *semaphore, s16 initial_count, s16 max_count)</div><div class="ttdoc">Initializes a light semaphore.</div></div>
<div class="ttc" id="asynchronization_8h_html_ad45ead296d3c1a87bd4e4cc0fb271040"><div class="ttname"><a href="synchronization_8h.html#ad45ead296d3c1a87bd4e4cc0fb271040">LightSemaphore_Acquire</a></div><div class="ttdeci">void LightSemaphore_Acquire(LightSemaphore *semaphore, s32 count)</div><div class="ttdoc">Acquires a light semaphore.</div></div>
<div class="ttc" id="asynchronization_8h_html_ae161b0db2ef331125217c64729e18179"><div class="ttname"><a href="synchronization_8h.html#ae161b0db2ef331125217c64729e18179">RecursiveLock</a></div><div class="ttdeci">_LOCK_RECURSIVE_T RecursiveLock</div><div class="ttdoc">A recursive lock.</div><div class="ttdef"><b>Definition:</b> synchronization.h:13</div></div>
<div class="ttc" id="asynchronization_8h_html_ae5b6bc8b7ae74b57efbb0707c1d6cea9"><div class="ttname"><a href="synchronization_8h.html#ae5b6bc8b7ae74b57efbb0707c1d6cea9">__strex</a></div><div class="ttdeci">static bool __strex(s32 *addr, s32 val)</div><div class="ttdoc">Performs a strex operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:75</div></div>
<div class="ttc" id="asynchronization_8h_html_ae75aac6e4bfe30037c8a9de916a6ddb8"><div class="ttname"><a href="synchronization_8h.html#ae75aac6e4bfe30037c8a9de916a6ddb8">LightLock_Lock</a></div><div class="ttdeci">void LightLock_Lock(LightLock *lock)</div><div class="ttdoc">Locks a light lock.</div></div>
<div class="ttc" id="asynchronization_8h_html_af5fdce28704bc8d418fe9aaed04d4e90"><div class="ttname"><a href="synchronization_8h.html#af5fdce28704bc8d418fe9aaed04d4e90">__clrex</a></div><div class="ttdeci">static void __clrex(void)</div><div class="ttdoc">Performs a clrex operation.</div><div class="ttdef"><b>Definition:</b> synchronization.h:52</div></div>
<div class="ttc" id="asynchronization_8h_html_afea61e6ff137d96934bb145d44095ccb"><div class="ttname"><a href="synchronization_8h.html#afea61e6ff137d96934bb145d44095ccb">RecursiveLock_Lock</a></div><div class="ttdeci">void RecursiveLock_Lock(RecursiveLock *lock)</div><div class="ttdoc">Locks a recursive lock.</div></div>
<div class="ttc" id="atypes_8h_html_a350c6fc928e3bdc6c6486268ac8fb269"><div class="ttname"><a href="types_8h.html#a350c6fc928e3bdc6c6486268ac8fb269">s64</a></div><div class="ttdeci">int64_t s64</div><div class="ttdoc">64-bit signed integer</div><div class="ttdef"><b>Definition:</b> types.h:29</div></div>
<div class="ttc" id="atypes_8h_html_a92c50087ca0e64fa93fc59402c55f8ca"><div class="ttname"><a href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a></div><div class="ttdeci">uint8_t u8</div><div class="ttdoc">would be nice if newlib had this already</div><div class="ttdef"><b>Definition:</b> types.h:21</div></div>
<div class="ttc" id="atypes_8h_html_aa980e2c02ba2305e0f489d5650655425"><div class="ttname"><a href="types_8h.html#aa980e2c02ba2305e0f489d5650655425">s16</a></div><div class="ttdeci">int16_t s16</div><div class="ttdoc">16-bit signed integer</div><div class="ttdef"><b>Definition:</b> types.h:27</div></div>
<div class="ttc" id="atypes_8h_html_ac830bf5a4f2cf8273f61ab99a46cf163"><div class="ttname"><a href="types_8h.html#ac830bf5a4f2cf8273f61ab99a46cf163">Result</a></div><div class="ttdeci">s32 Result</div><div class="ttdoc">Function result.</div><div class="ttdef"><b>Definition:</b> types.h:42</div></div>
<div class="ttc" id="atypes_8h_html_ace9d960e74685e2cd84b36132dbbf8aa"><div class="ttname"><a href="types_8h.html#ace9d960e74685e2cd84b36132dbbf8aa">u16</a></div><div class="ttdeci">uint16_t u16</div><div class="ttdoc">16-bit unsigned integer</div><div class="ttdef"><b>Definition:</b> types.h:22</div></div>
<div class="ttc" id="atypes_8h_html_ae9b1af5c037e57a98884758875d3a7c4"><div class="ttname"><a href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a></div><div class="ttdeci">int32_t s32</div><div class="ttdoc">32-bit signed integer</div><div class="ttdef"><b>Definition:</b> types.h:28</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>