]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_GCC/freedom-metal/doc/html/apiref/lock.html
Added the "full" demo to the RISC-V_RV32_SiFive_HiFive1_GCC demo - backup check in...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_GCC / freedom-metal / doc / html / apiref / lock.html
1
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml">
6   <head>
7     <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
8     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9     <title>Locks &#8212; Freedom Metal v201905 documentation</title>
10     <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
11     <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
12     <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
13     <script type="text/javascript" src="../_static/jquery.js"></script>
14     <script type="text/javascript" src="../_static/underscore.js"></script>
15     <script type="text/javascript" src="../_static/doctools.js"></script>
16     <link rel="index" title="Index" href="../genindex.html" />
17     <link rel="search" title="Search" href="../search.html" />
18     <link rel="next" title="Memory Enumeration" href="memory.html" />
19     <link rel="prev" title="LEDs" href="led.html" />
20    
21   <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
22   
23   
24   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
25
26   </head><body>
27   
28
29     <div class="document">
30       <div class="documentwrapper">
31         <div class="bodywrapper">
32           
33
34           <div class="body" role="main">
35             
36   <div class="section" id="locks">
37 <h1>Locks<a class="headerlink" href="#locks" title="Permalink to this headline">¶</a></h1>
38 <p>An API for creating and using a software lock/mutex. </p>
39 <div class="breathe-sectiondef docutils container">
40 <p class="breathe-sectiondef-title rubric">Defines</p>
41 <dl class="macro">
42 <dt id="c.METAL_LOCK_DECLARE">
43 <span class="target" id="lock_8h_1ab374ff07975df10c0dd028439b351af9"></span><code class="descname">METAL_LOCK_DECLARE</code><span class="sig-paren">(</span>name<span class="sig-paren">)</span><a class="headerlink" href="#c.METAL_LOCK_DECLARE" title="Permalink to this definition">¶</a></dt>
44 <dd><p>Declare a lock. </p>
45 <p>Locks must be declared with METAL_LOCK_DECLARE to ensure that the lock is linked into a memory region which supports atomic memory operations. </p>
46 </dd></dl>
47
48 </div>
49 <div class="breathe-sectiondef docutils container">
50 <p class="breathe-sectiondef-title rubric">Functions</p>
51 <dl class="function">
52 <dt id="_CPPv315metal_lock_initP10metal_lock">
53 <span id="_CPPv215metal_lock_initP10metal_lock"></span><span id="metal_lock_init__metal_lockP"></span><span class="target" id="lock_8h_1ac6c3769091eb4746302c9c5c9b42050c"></span>int <code class="descname">metal_lock_init</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv310metal_lock" title="metal_lock">metal_lock</a> *<em>lock</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv315metal_lock_initP10metal_lock" title="Permalink to this definition">¶</a><br /></dt>
54 <dd><p>Initialize a lock. </p>
55 <p><p>If the lock cannot be initialized, attempts to take or give the lock will result in a Store/AMO access fault. </p>
56 <dl class="docutils">
57 <dt><strong>Return</strong></dt>
58 <dd>0 if the lock is successfully initialized. A non-zero code indicates failure.</dd>
59 <dt><strong>Parameters</strong></dt>
60 <dd><ul class="breatheparameterlist first last simple">
61 <li><code class="docutils literal notranslate"><span class="pre">lock</span></code>: The handle for a lock </li>
62 </ul>
63 </dd>
64 </dl>
65 </p>
66 </dd></dl>
67
68 <dl class="function">
69 <dt id="_CPPv315metal_lock_takeP10metal_lock">
70 <span id="_CPPv215metal_lock_takeP10metal_lock"></span><span id="metal_lock_take__metal_lockP"></span><span class="target" id="lock_8h_1a62f98dd8920e3e1dcab6e87763a0e413"></span>int <code class="descname">metal_lock_take</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv310metal_lock" title="metal_lock">metal_lock</a> *<em>lock</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv315metal_lock_takeP10metal_lock" title="Permalink to this definition">¶</a><br /></dt>
71 <dd><p>Take a lock. </p>
72 <p><p>If the lock initialization failed, attempts to take a lock will result in a Store/AMO access fault. </p>
73 <dl class="docutils">
74 <dt><strong>Return</strong></dt>
75 <dd>0 if the lock is successfully taken</dd>
76 <dt><strong>Parameters</strong></dt>
77 <dd><ul class="breatheparameterlist first last simple">
78 <li><code class="docutils literal notranslate"><span class="pre">lock</span></code>: The handle for a lock </li>
79 </ul>
80 </dd>
81 </dl>
82 </p>
83 </dd></dl>
84
85 <dl class="function">
86 <dt id="_CPPv315metal_lock_giveP10metal_lock">
87 <span id="_CPPv215metal_lock_giveP10metal_lock"></span><span id="metal_lock_give__metal_lockP"></span><span class="target" id="lock_8h_1a2a107fe4f7faea16bb3f98e572dc480b"></span>int <code class="descname">metal_lock_give</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv310metal_lock" title="metal_lock">metal_lock</a> *<em>lock</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv315metal_lock_giveP10metal_lock" title="Permalink to this definition">¶</a><br /></dt>
88 <dd><p>Give back a held lock. </p>
89 <p><p>If the lock initialization failed, attempts to give a lock will result in a Store/AMO access fault. </p>
90 <dl class="docutils">
91 <dt><strong>Return</strong></dt>
92 <dd>0 if the lock is successfully given</dd>
93 <dt><strong>Parameters</strong></dt>
94 <dd><ul class="breatheparameterlist first last simple">
95 <li><code class="docutils literal notranslate"><span class="pre">lock</span></code>: The handle for a lock </li>
96 </ul>
97 </dd>
98 </dl>
99 </p>
100 </dd></dl>
101
102 </div>
103 <dl class="class">
104 <dt id="_CPPv310metal_lock">
105 <span id="_CPPv210metal_lock"></span><span id="metal_lock"></span><span class="target" id="structmetal__lock"></span><em class="property">struct </em><code class="descname">metal_lock</code><a class="headerlink" href="#_CPPv310metal_lock" title="Permalink to this definition">¶</a><br /></dt>
106 <dd><em>#include &lt;lock.h&gt;</em><p>A handle for a lock. </p>
107 </dd></dl>
108
109 </div>
110
111
112           </div>
113           
114         </div>
115       </div>
116       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
117         <div class="sphinxsidebarwrapper">
118 <h1 class="logo"><a href="../index.html">Freedom Metal</a></h1>
119
120
121
122
123
124
125
126
127 <h3>Navigation</h3>
128 <ul class="current">
129 <li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction to Freedom Metal</a></li>
130 <li class="toctree-l1"><a class="reference internal" href="../devguide.html">Developer Guide</a></li>
131 <li class="toctree-l1 current"><a class="reference internal" href="../api.html">API Reference</a><ul class="current">
132 <li class="toctree-l2"><a class="reference internal" href="button.html">Buttons</a></li>
133 <li class="toctree-l2"><a class="reference internal" href="cache.html">Caches</a></li>
134 <li class="toctree-l2"><a class="reference internal" href="clock.html">Clocks</a></li>
135 <li class="toctree-l2"><a class="reference internal" href="cpu.html">CPU</a></li>
136 <li class="toctree-l2"><a class="reference internal" href="gpio.html">GPIO</a></li>
137 <li class="toctree-l2"><a class="reference internal" href="interrupt.html">Interrupts</a></li>
138 <li class="toctree-l2"><a class="reference internal" href="itim.html">ITIM</a></li>
139 <li class="toctree-l2"><a class="reference internal" href="led.html">LEDs</a></li>
140 <li class="toctree-l2 current"><a class="current reference internal" href="#">Locks</a></li>
141 <li class="toctree-l2"><a class="reference internal" href="memory.html">Memory Enumeration</a></li>
142 <li class="toctree-l2"><a class="reference internal" href="pmp.html">PMPs</a></li>
143 <li class="toctree-l2"><a class="reference internal" href="shutdown.html">Shutdown</a></li>
144 <li class="toctree-l2"><a class="reference internal" href="spi.html">SPIs</a></li>
145 <li class="toctree-l2"><a class="reference internal" href="switch.html">Switches</a></li>
146 <li class="toctree-l2"><a class="reference internal" href="timer.html">Timer API</a></li>
147 <li class="toctree-l2"><a class="reference internal" href="tty.html">TTY</a></li>
148 <li class="toctree-l2"><a class="reference internal" href="uart.html">UARTs</a></li>
149 </ul>
150 </li>
151 </ul>
152
153 <div class="relations">
154 <h3>Related Topics</h3>
155 <ul>
156   <li><a href="../index.html">Documentation overview</a><ul>
157   <li><a href="../api.html">API Reference</a><ul>
158       <li>Previous: <a href="led.html" title="previous chapter">LEDs</a></li>
159       <li>Next: <a href="memory.html" title="next chapter">Memory Enumeration</a></li>
160   </ul></li>
161   </ul></li>
162 </ul>
163 </div>
164 <div id="searchbox" style="display: none" role="search">
165   <h3>Quick search</h3>
166     <div class="searchformwrapper">
167     <form class="search" action="../search.html" method="get">
168       <input type="text" name="q" />
169       <input type="submit" value="Go" />
170       <input type="hidden" name="check_keywords" value="yes" />
171       <input type="hidden" name="area" value="default" />
172     </form>
173     </div>
174 </div>
175 <script type="text/javascript">$('#searchbox').show(0);</script>
176         </div>
177       </div>
178       <div class="clearer"></div>
179     </div>
180     <div class="footer">
181       &copy;2019, SiFive Inc..
182       
183       |
184       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
185       &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
186       
187       |
188       <a href="../_sources/apiref/lock.rst.txt"
189           rel="nofollow">Page source</a>
190     </div>
191
192     
193
194     
195   </body>
196 </html>