]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_GCC/freedom-metal/doc/html/apiref/pmp.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 / pmp.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>PMPs &#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="Shutdown" href="shutdown.html" />
19     <link rel="prev" title="Memory Enumeration" href="memory.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="pmps">
37 <h1>PMPs<a class="headerlink" href="#pmps" title="Permalink to this headline">¶</a></h1>
38 <p>API for Configuring Physical Memory Protection on RISC-V Cores. </p>
39 <p>The Physical Memory Protection (PMP) interface on RISC-V cores is a form of memory protection unit which allows for a finite number of physical memory regions to be configured with certain access permissions.</p>
40 <p>Additional information about the use and configuration rules for PMPs can be found by reading the RISC-V Privileged Architecture Specification. </p>
41 <div class="breathe-sectiondef docutils container">
42 <p class="breathe-sectiondef-title rubric">Enums</p>
43 <dl class="type">
44 <dt id="_CPPv322metal_pmp_address_mode">
45 <span id="_CPPv222metal_pmp_address_mode"></span><span id="metal_pmp_address_mode"></span><span class="target" id="pmp_8h_1a5a253e3e28b6e55a3340924161611437"></span><em class="property">enum </em><code class="descname">metal_pmp_address_mode</code><a class="headerlink" href="#_CPPv322metal_pmp_address_mode" title="Permalink to this definition">¶</a><br /></dt>
46 <dd><p>Set of available PMP addressing modes. </p>
47 <p><em>Values:</em></p>
48 <dl class="enumerator">
49 <dt id="_CPPv313METAL_PMP_OFF">
50 <span id="_CPPv213METAL_PMP_OFF"></span><span class="target" id="pmp_8h_1a5a253e3e28b6e55a3340924161611437ae577426e9497040f7937944ae5ae6a40"></span><code class="descname">METAL_PMP_OFF</code> = 0<a class="headerlink" href="#_CPPv313METAL_PMP_OFF" title="Permalink to this definition">¶</a><br /></dt>
51 <dd><p>Disable the PMP region. </p>
52 </dd></dl>
53
54 <dl class="enumerator">
55 <dt id="_CPPv313METAL_PMP_TOR">
56 <span id="_CPPv213METAL_PMP_TOR"></span><span class="target" id="pmp_8h_1a5a253e3e28b6e55a3340924161611437aabb496bcbbde420b39e6ff7c39b3280a"></span><code class="descname">METAL_PMP_TOR</code> = 1<a class="headerlink" href="#_CPPv313METAL_PMP_TOR" title="Permalink to this definition">¶</a><br /></dt>
57 <dd><p>Use Top-of-Range mode. </p>
58 </dd></dl>
59
60 <dl class="enumerator">
61 <dt id="_CPPv313METAL_PMP_NA4">
62 <span id="_CPPv213METAL_PMP_NA4"></span><span class="target" id="pmp_8h_1a5a253e3e28b6e55a3340924161611437a6a5c13be0ca5ad62ec720aed29bca8fb"></span><code class="descname">METAL_PMP_NA4</code> = 2<a class="headerlink" href="#_CPPv313METAL_PMP_NA4" title="Permalink to this definition">¶</a><br /></dt>
63 <dd><p>Use naturally-aligned 4-byte region mode. </p>
64 </dd></dl>
65
66 <dl class="enumerator">
67 <dt id="_CPPv315METAL_PMP_NAPOT">
68 <span id="_CPPv215METAL_PMP_NAPOT"></span><span class="target" id="pmp_8h_1a5a253e3e28b6e55a3340924161611437ab0439f955da13acbabbc2d370e6b5d21"></span><code class="descname">METAL_PMP_NAPOT</code> = 3<a class="headerlink" href="#_CPPv315METAL_PMP_NAPOT" title="Permalink to this definition">¶</a><br /></dt>
69 <dd><p>Use naturally-aligned power-of-two mode. </p>
70 </dd></dl>
71
72 </dd></dl>
73
74 </div>
75 <div class="breathe-sectiondef docutils container">
76 <p class="breathe-sectiondef-title rubric">Functions</p>
77 <dl class="function">
78 <dt id="_CPPv320metal_pmp_get_devicev">
79 <span id="_CPPv220metal_pmp_get_devicev"></span><span id="metal_pmp_get_device__void"></span><span class="target" id="pmp_8h_1a285362cb084160ce14af26d75f9116f5"></span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<code class="descname">metal_pmp_get_device</code><span class="sig-paren">(</span>void<span class="sig-paren">)</span><a class="headerlink" href="#_CPPv320metal_pmp_get_devicev" title="Permalink to this definition">¶</a><br /></dt>
80 <dd><p>Get the PMP device handle. </p>
81 </dd></dl>
82
83 <dl class="function">
84 <dt id="_CPPv314metal_pmp_initP9metal_pmp">
85 <span id="_CPPv214metal_pmp_initP9metal_pmp"></span><span id="metal_pmp_init__metal_pmpP"></span><span class="target" id="pmp_8h_1a27f187e13bd7100571a7a404bd0a0f06"></span>void <code class="descname">metal_pmp_init</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv314metal_pmp_initP9metal_pmp" title="Permalink to this definition">¶</a><br /></dt>
86 <dd><p>Initialize the PMP. </p>
87 <p><p>The PMP initialization routine is optional and may be called as many times as is desired. The effect of the initialization routine is to attempt to set all regions to unlocked and disabled, as well as to clear the X, W, and R bits. Only the pmp configuration of the hart which executes the routine will be affected.</p>
88 <dl class="docutils">
89 <dt><strong>Parameters</strong></dt>
90 <dd><ul class="breatheparameterlist first last simple">
91 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle to be initialized</li>
92 </ul>
93 </dd>
94 </dl>
95 </p>
96 <p>If any regions are fused to preset values by the implementation or locked, those PMP regions will silently remain uninitialized. </p>
97 </dd></dl>
98
99 <dl class="function">
100 <dt id="_CPPv320metal_pmp_set_regionP9metal_pmpj16metal_pmp_config6size_t">
101 <span id="_CPPv220metal_pmp_set_regionP9metal_pmpj16metal_pmp_config6size_t"></span><span id="metal_pmp_set_region__metal_pmpP.unsigned-i.metal_pmp_config.s"></span><span class="target" id="pmp_8h_1acdbdbc7cc2727d4ae10205617aee3013"></span>int <code class="descname">metal_pmp_set_region</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, <em class="property">struct</em> <a class="reference internal" href="#_CPPv316metal_pmp_config" title="metal_pmp_config">metal_pmp_config</a> <em>config</em>, size_t <em>address</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv320metal_pmp_set_regionP9metal_pmpj16metal_pmp_config6size_t" title="Permalink to this definition">¶</a><br /></dt>
102 <dd><p>Configure a PMP region. </p>
103 <p><dl class="docutils">
104 <dt><strong>Return</strong></dt>
105 <dd>0 upon success </dd>
106 <dt><strong>Parameters</strong></dt>
107 <dd><ul class="breatheparameterlist first last simple">
108 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
109 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to configure </li>
110 <li><code class="docutils literal notranslate"><span class="pre">config</span></code>: The desired configuration of the PMP region </li>
111 <li><code class="docutils literal notranslate"><span class="pre">address</span></code>: The desired address of the PMP region </li>
112 </ul>
113 </dd>
114 </dl>
115 </p>
116 </dd></dl>
117
118 <dl class="function">
119 <dt id="_CPPv320metal_pmp_get_regionP9metal_pmpjP16metal_pmp_configP6size_t">
120 <span id="_CPPv220metal_pmp_get_regionP9metal_pmpjP16metal_pmp_configP6size_t"></span><span id="metal_pmp_get_region__metal_pmpP.unsigned-i.metal_pmp_configP.sP"></span><span class="target" id="pmp_8h_1a638771730de250707e03355a20eba302"></span>int <code class="descname">metal_pmp_get_region</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, <em class="property">struct</em> <a class="reference internal" href="#_CPPv316metal_pmp_config" title="metal_pmp_config">metal_pmp_config</a> *<em>config</em>, size_t *<em>address</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv320metal_pmp_get_regionP9metal_pmpjP16metal_pmp_configP6size_t" title="Permalink to this definition">¶</a><br /></dt>
121 <dd><p>Get the configuration for a PMP region. </p>
122 <p><dl class="docutils">
123 <dt><strong>Return</strong></dt>
124 <dd>0 if the region is read successfully </dd>
125 <dt><strong>Parameters</strong></dt>
126 <dd><ul class="breatheparameterlist first last simple">
127 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
128 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
129 <li><code class="docutils literal notranslate"><span class="pre">config</span></code>: Variable to store the PMP region configuration </li>
130 <li><code class="docutils literal notranslate"><span class="pre">address</span></code>: Variable to store the PMP region address </li>
131 </ul>
132 </dd>
133 </dl>
134 </p>
135 </dd></dl>
136
137 <dl class="function">
138 <dt id="_CPPv314metal_pmp_lockP9metal_pmpj">
139 <span id="_CPPv214metal_pmp_lockP9metal_pmpj"></span><span id="metal_pmp_lock__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1a6a3fa4e30f321f322e5327c5626298a6"></span>int <code class="descname">metal_pmp_lock</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv314metal_pmp_lockP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
140 <dd><p>Lock a PMP region. </p>
141 <p><dl class="docutils">
142 <dt><strong>Return</strong></dt>
143 <dd>0 if the region is successfully locked </dd>
144 <dt><strong>Parameters</strong></dt>
145 <dd><ul class="breatheparameterlist first last simple">
146 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
147 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to lock </li>
148 </ul>
149 </dd>
150 </dl>
151 </p>
152 </dd></dl>
153
154 <dl class="function">
155 <dt id="_CPPv321metal_pmp_set_addressP9metal_pmpj6size_t">
156 <span id="_CPPv221metal_pmp_set_addressP9metal_pmpj6size_t"></span><span id="metal_pmp_set_address__metal_pmpP.unsigned-i.s"></span><span class="target" id="pmp_8h_1a813aa0c76c58567d72d742ae26413d43"></span>int <code class="descname">metal_pmp_set_address</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, size_t <em>address</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv321metal_pmp_set_addressP9metal_pmpj6size_t" title="Permalink to this definition">¶</a><br /></dt>
157 <dd><p>Set the address for a PMP region. </p>
158 <p><dl class="docutils">
159 <dt><strong>Return</strong></dt>
160 <dd>0 if the address is successfully set </dd>
161 <dt><strong>Parameters</strong></dt>
162 <dd><ul class="breatheparameterlist first last simple">
163 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
164 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to set </li>
165 <li><code class="docutils literal notranslate"><span class="pre">address</span></code>: The desired address of the PMP region </li>
166 </ul>
167 </dd>
168 </dl>
169 </p>
170 </dd></dl>
171
172 <dl class="function">
173 <dt id="_CPPv321metal_pmp_get_addressP9metal_pmpj">
174 <span id="_CPPv221metal_pmp_get_addressP9metal_pmpj"></span><span id="metal_pmp_get_address__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1acd173df5015b18af2a24c18db8b4e29d"></span>size_t <code class="descname">metal_pmp_get_address</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv321metal_pmp_get_addressP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
175 <dd><p>Get the address of a PMP region. </p>
176 <p><dl class="docutils">
177 <dt><strong>Return</strong></dt>
178 <dd>The address of the PMP region, or 0 if the region could not be read </dd>
179 <dt><strong>Parameters</strong></dt>
180 <dd><ul class="breatheparameterlist first last simple">
181 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
182 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
183 </ul>
184 </dd>
185 </dl>
186 </p>
187 </dd></dl>
188
189 <dl class="function">
190 <dt id="_CPPv326metal_pmp_set_address_modeP9metal_pmpj22metal_pmp_address_mode">
191 <span id="_CPPv226metal_pmp_set_address_modeP9metal_pmpj22metal_pmp_address_mode"></span><span id="metal_pmp_set_address_mode__metal_pmpP.unsigned-i.metal_pmp_address_mode"></span><span class="target" id="pmp_8h_1af437f62af730b1ced6b024320224b44f"></span>int <code class="descname">metal_pmp_set_address_mode</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, <em class="property">enum</em> <a class="reference internal" href="#_CPPv322metal_pmp_address_mode" title="metal_pmp_address_mode">metal_pmp_address_mode</a> <em>mode</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv326metal_pmp_set_address_modeP9metal_pmpj22metal_pmp_address_mode" title="Permalink to this definition">¶</a><br /></dt>
192 <dd><p>Set the addressing mode of a PMP region. </p>
193 <p><dl class="docutils">
194 <dt><strong>Return</strong></dt>
195 <dd>0 if the addressing mode is successfully set </dd>
196 <dt><strong>Parameters</strong></dt>
197 <dd><ul class="breatheparameterlist first last simple">
198 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
199 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to set </li>
200 <li><code class="docutils literal notranslate"><span class="pre">mode</span></code>: The PMP addressing mode to set </li>
201 </ul>
202 </dd>
203 </dl>
204 </p>
205 </dd></dl>
206
207 <dl class="function">
208 <dt id="_CPPv326metal_pmp_get_address_modeP9metal_pmpj">
209 <span id="_CPPv226metal_pmp_get_address_modeP9metal_pmpj"></span><span id="metal_pmp_get_address_mode__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1ae8bf626c403ce2f5d9647e900becc479"></span><em class="property">enum</em> <a class="reference internal" href="#_CPPv322metal_pmp_address_mode" title="metal_pmp_address_mode">metal_pmp_address_mode</a> <code class="descname">metal_pmp_get_address_mode</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv326metal_pmp_get_address_modeP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
210 <dd><p>Get the addressing mode of a PMP region. </p>
211 <p><dl class="docutils">
212 <dt><strong>Return</strong></dt>
213 <dd>The address mode of the PMP region </dd>
214 <dt><strong>Parameters</strong></dt>
215 <dd><ul class="breatheparameterlist first last simple">
216 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
217 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
218 </ul>
219 </dd>
220 </dl>
221 </p>
222 </dd></dl>
223
224 <dl class="function">
225 <dt id="_CPPv324metal_pmp_set_executableP9metal_pmpji">
226 <span id="_CPPv224metal_pmp_set_executableP9metal_pmpji"></span><span id="metal_pmp_set_executable__metal_pmpP.unsigned-i.i"></span><span class="target" id="pmp_8h_1a7ca9b72029d7ece4c1f0411fa30ce200"></span>int <code class="descname">metal_pmp_set_executable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, int <em>X</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv324metal_pmp_set_executableP9metal_pmpji" title="Permalink to this definition">¶</a><br /></dt>
227 <dd><p>Set the executable bit for a PMP region. </p>
228 <p><dl class="docutils">
229 <dt><strong>Return</strong></dt>
230 <dd>0 if the executable bit is successfully set </dd>
231 <dt><strong>Parameters</strong></dt>
232 <dd><ul class="breatheparameterlist first last simple">
233 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
234 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to set </li>
235 <li><code class="docutils literal notranslate"><span class="pre">X</span></code>: The desired value of the executable bit </li>
236 </ul>
237 </dd>
238 </dl>
239 </p>
240 </dd></dl>
241
242 <dl class="function">
243 <dt id="_CPPv324metal_pmp_get_executableP9metal_pmpj">
244 <span id="_CPPv224metal_pmp_get_executableP9metal_pmpj"></span><span id="metal_pmp_get_executable__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1a25cca706020249225e12244146ae561b"></span>int <code class="descname">metal_pmp_get_executable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv324metal_pmp_get_executableP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
245 <dd><p>Get the executable bit for a PMP region. </p>
246 <p><dl class="docutils">
247 <dt><strong>Return</strong></dt>
248 <dd>the value of the executable bit </dd>
249 <dt><strong>Parameters</strong></dt>
250 <dd><ul class="breatheparameterlist first last simple">
251 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
252 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
253 </ul>
254 </dd>
255 </dl>
256 </p>
257 </dd></dl>
258
259 <dl class="function">
260 <dt id="_CPPv323metal_pmp_set_writeableP9metal_pmpji">
261 <span id="_CPPv223metal_pmp_set_writeableP9metal_pmpji"></span><span id="metal_pmp_set_writeable__metal_pmpP.unsigned-i.i"></span><span class="target" id="pmp_8h_1a64007037321db518728f354a3517ef30"></span>int <code class="descname">metal_pmp_set_writeable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, int <em>W</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv323metal_pmp_set_writeableP9metal_pmpji" title="Permalink to this definition">¶</a><br /></dt>
262 <dd><p>Set the writable bit for a PMP region. </p>
263 <p><dl class="docutils">
264 <dt><strong>Return</strong></dt>
265 <dd>0 if the writable bit is successfully set </dd>
266 <dt><strong>Parameters</strong></dt>
267 <dd><ul class="breatheparameterlist first last simple">
268 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
269 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to set </li>
270 <li><code class="docutils literal notranslate"><span class="pre">W</span></code>: The desired value of the writable bit </li>
271 </ul>
272 </dd>
273 </dl>
274 </p>
275 </dd></dl>
276
277 <dl class="function">
278 <dt id="_CPPv323metal_pmp_get_writeableP9metal_pmpj">
279 <span id="_CPPv223metal_pmp_get_writeableP9metal_pmpj"></span><span id="metal_pmp_get_writeable__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1a53515b1abf4a9738170747b17d9415e1"></span>int <code class="descname">metal_pmp_get_writeable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv323metal_pmp_get_writeableP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
280 <dd><p>Get the writable bit for a PMP region. </p>
281 <p><dl class="docutils">
282 <dt><strong>Return</strong></dt>
283 <dd>the value of the writable bit </dd>
284 <dt><strong>Parameters</strong></dt>
285 <dd><ul class="breatheparameterlist first last simple">
286 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
287 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
288 </ul>
289 </dd>
290 </dl>
291 </p>
292 </dd></dl>
293
294 <dl class="function">
295 <dt id="_CPPv322metal_pmp_set_readableP9metal_pmpji">
296 <span id="_CPPv222metal_pmp_set_readableP9metal_pmpji"></span><span id="metal_pmp_set_readable__metal_pmpP.unsigned-i.i"></span><span class="target" id="pmp_8h_1a6bd197dc75911ef545ee9ba434a147fc"></span>int <code class="descname">metal_pmp_set_readable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em>, int <em>R</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv322metal_pmp_set_readableP9metal_pmpji" title="Permalink to this definition">¶</a><br /></dt>
297 <dd><p>Set the readable bit for a PMP region. </p>
298 <p><dl class="docutils">
299 <dt><strong>Return</strong></dt>
300 <dd>0 if the readable bit is successfully set </dd>
301 <dt><strong>Parameters</strong></dt>
302 <dd><ul class="breatheparameterlist first last simple">
303 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
304 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to set </li>
305 <li><code class="docutils literal notranslate"><span class="pre">R</span></code>: The desired value of the readable bit </li>
306 </ul>
307 </dd>
308 </dl>
309 </p>
310 </dd></dl>
311
312 <dl class="function">
313 <dt id="_CPPv322metal_pmp_get_readableP9metal_pmpj">
314 <span id="_CPPv222metal_pmp_get_readableP9metal_pmpj"></span><span id="metal_pmp_get_readable__metal_pmpP.unsigned-i"></span><span class="target" id="pmp_8h_1a7962720fc55049422ae70a58c3bf30a1"></span>int <code class="descname">metal_pmp_get_readable</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv39metal_pmp" title="metal_pmp">metal_pmp</a> *<em>pmp</em>, unsigned int <em>region</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv322metal_pmp_get_readableP9metal_pmpj" title="Permalink to this definition">¶</a><br /></dt>
315 <dd><p>Set the readable bit for a PMP region. </p>
316 <p><dl class="docutils">
317 <dt><strong>Return</strong></dt>
318 <dd>the value of the readable bit </dd>
319 <dt><strong>Parameters</strong></dt>
320 <dd><ul class="breatheparameterlist first last simple">
321 <li><code class="docutils literal notranslate"><span class="pre">pmp</span></code>: The PMP device handle </li>
322 <li><code class="docutils literal notranslate"><span class="pre">region</span></code>: The PMP region to read </li>
323 </ul>
324 </dd>
325 </dl>
326 </p>
327 </dd></dl>
328
329 </div>
330 <dl class="class">
331 <dt id="_CPPv316metal_pmp_config">
332 <span id="_CPPv216metal_pmp_config"></span><span id="metal_pmp_config"></span><span class="target" id="structmetal__pmp__config"></span><em class="property">struct </em><code class="descname">metal_pmp_config</code><a class="headerlink" href="#_CPPv316metal_pmp_config" title="Permalink to this definition">¶</a><br /></dt>
333 <dd><em>#include &lt;pmp.h&gt;</em><p>Configuration for a PMP region. </p>
334 <div class="breathe-sectiondef docutils container">
335 <p class="breathe-sectiondef-title rubric">Public Types</p>
336 <dl class="type">
337 <dt id="_CPPv316metal_pmp_locked">
338 <span id="_CPPv216metal_pmp_locked"></span><span id="metal_pmp_locked"></span><span class="target" id="structmetal__pmp__config_1ae58135921201a45e356316894ea415e1"></span><em class="property">enum </em><code class="descname">metal_pmp_locked</code><a class="headerlink" href="#_CPPv316metal_pmp_locked" title="Permalink to this definition">¶</a><br /></dt>
339 <dd><p>Sets whether the PMP region is locked. </p>
340 <p><em>Values:</em></p>
341 <dl class="enumerator">
342 <dt id="_CPPv318METAL_PMP_UNLOCKED">
343 <span id="_CPPv218METAL_PMP_UNLOCKED"></span><span class="target" id="structmetal__pmp__config_1ae58135921201a45e356316894ea415e1a47f6f950ceb2afeb7e712f6ea7c74167"></span><code class="descname">METAL_PMP_UNLOCKED</code> = 0<a class="headerlink" href="#_CPPv318METAL_PMP_UNLOCKED" title="Permalink to this definition">¶</a><br /></dt>
344 <dd></dd></dl>
345
346 <dl class="enumerator">
347 <dt id="_CPPv316METAL_PMP_LOCKED">
348 <span id="_CPPv216METAL_PMP_LOCKED"></span><span class="target" id="structmetal__pmp__config_1ae58135921201a45e356316894ea415e1ab5f8338bd1b8d19ae7a46491cf90c47d"></span><code class="descname">METAL_PMP_LOCKED</code> = 1<a class="headerlink" href="#_CPPv316METAL_PMP_LOCKED" title="Permalink to this definition">¶</a><br /></dt>
349 <dd></dd></dl>
350
351 </dd></dl>
352
353 </div>
354 <div class="breathe-sectiondef docutils container">
355 <p class="breathe-sectiondef-title rubric">Public Members</p>
356 <dl class="member">
357 <dt id="_CPPv3N16metal_pmp_config1RE">
358 <span id="_CPPv2N16metal_pmp_config1RE"></span><span id="metal_pmp_config::R__i"></span><span class="target" id="structmetal__pmp__config_1ae7a18f7b2449ed6502e7b2ac6418d0b9"></span>int <code class="descname">R</code><a class="headerlink" href="#_CPPv3N16metal_pmp_config1RE" title="Permalink to this definition">¶</a><br /></dt>
359 <dd><p>Sets whether reads to the PMP region succeed. </p>
360 </dd></dl>
361
362 <dl class="member">
363 <dt id="_CPPv3N16metal_pmp_config1WE">
364 <span id="_CPPv2N16metal_pmp_config1WE"></span><span id="metal_pmp_config::W__i"></span><span class="target" id="structmetal__pmp__config_1ad625b6d3fccc337da37e79bb61b6505b"></span>int <code class="descname">W</code><a class="headerlink" href="#_CPPv3N16metal_pmp_config1WE" title="Permalink to this definition">¶</a><br /></dt>
365 <dd><p>Sets whether writes to the PMP region succeed. </p>
366 </dd></dl>
367
368 <dl class="member">
369 <dt id="_CPPv3N16metal_pmp_config1XE">
370 <span id="_CPPv2N16metal_pmp_config1XE"></span><span id="metal_pmp_config::X__i"></span><span class="target" id="structmetal__pmp__config_1adff0ca4e2efb45e8734ab747bb6e44b3"></span>int <code class="descname">X</code><a class="headerlink" href="#_CPPv3N16metal_pmp_config1XE" title="Permalink to this definition">¶</a><br /></dt>
371 <dd><p>Sets whether the PMP region is executable. </p>
372 </dd></dl>
373
374 <dl class="member">
375 <dt id="_CPPv3N16metal_pmp_config1AE">
376 <span id="_CPPv2N16metal_pmp_config1AE"></span><span id="metal_pmp_config::A__metal_pmp_address_mode"></span><span class="target" id="structmetal__pmp__config_1a2c3377be13c911aa3a245213818faed5"></span><a class="reference internal" href="#_CPPv322metal_pmp_address_mode" title="metal_pmp_address_mode">metal_pmp_address_mode</a> <code class="descname">A</code><a class="headerlink" href="#_CPPv3N16metal_pmp_config1AE" title="Permalink to this definition">¶</a><br /></dt>
377 <dd><p>Sets the addressing mode of the PMP region. </p>
378 </dd></dl>
379
380 <dl class="member">
381 <dt id="_CPPv3N16metal_pmp_config1LE">
382 <span id="_CPPv2N16metal_pmp_config1LE"></span><span id="metal_pmp_config::L__metal_pmp_config::metal_pmp_locked"></span><span class="target" id="structmetal__pmp__config_1a246339508928c4362075bb549f00be89"></span><a class="reference internal" href="#_CPPv316metal_pmp_config" title="metal_pmp_config">metal_pmp_config</a>::<a class="reference internal" href="../devguide/pmps.html#_CPPv3N16metal_pmp_config16metal_pmp_lockedE" title="metal_pmp_config::metal_pmp_locked">metal_pmp_locked</a> <code class="descname">L</code><a class="headerlink" href="#_CPPv3N16metal_pmp_config1LE" title="Permalink to this definition">¶</a><br /></dt>
383 <dd></dd></dl>
384
385 </div>
386 </dd></dl>
387
388 <dl class="class">
389 <dt id="_CPPv39metal_pmp">
390 <span id="_CPPv29metal_pmp"></span><span id="metal_pmp"></span><span class="target" id="structmetal__pmp"></span><em class="property">struct </em><code class="descname">metal_pmp</code><a class="headerlink" href="#_CPPv39metal_pmp" title="Permalink to this definition">¶</a><br /></dt>
391 <dd><em>#include &lt;pmp.h&gt;</em><p>A handle for the PMP device. </p>
392 </dd></dl>
393
394 </div>
395
396
397           </div>
398           
399         </div>
400       </div>
401       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
402         <div class="sphinxsidebarwrapper">
403 <h1 class="logo"><a href="../index.html">Freedom Metal</a></h1>
404
405
406
407
408
409
410
411
412 <h3>Navigation</h3>
413 <ul class="current">
414 <li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction to Freedom Metal</a></li>
415 <li class="toctree-l1"><a class="reference internal" href="../devguide.html">Developer Guide</a></li>
416 <li class="toctree-l1 current"><a class="reference internal" href="../api.html">API Reference</a><ul class="current">
417 <li class="toctree-l2"><a class="reference internal" href="button.html">Buttons</a></li>
418 <li class="toctree-l2"><a class="reference internal" href="cache.html">Caches</a></li>
419 <li class="toctree-l2"><a class="reference internal" href="clock.html">Clocks</a></li>
420 <li class="toctree-l2"><a class="reference internal" href="cpu.html">CPU</a></li>
421 <li class="toctree-l2"><a class="reference internal" href="gpio.html">GPIO</a></li>
422 <li class="toctree-l2"><a class="reference internal" href="interrupt.html">Interrupts</a></li>
423 <li class="toctree-l2"><a class="reference internal" href="itim.html">ITIM</a></li>
424 <li class="toctree-l2"><a class="reference internal" href="led.html">LEDs</a></li>
425 <li class="toctree-l2"><a class="reference internal" href="lock.html">Locks</a></li>
426 <li class="toctree-l2"><a class="reference internal" href="memory.html">Memory Enumeration</a></li>
427 <li class="toctree-l2 current"><a class="current reference internal" href="#">PMPs</a></li>
428 <li class="toctree-l2"><a class="reference internal" href="shutdown.html">Shutdown</a></li>
429 <li class="toctree-l2"><a class="reference internal" href="spi.html">SPIs</a></li>
430 <li class="toctree-l2"><a class="reference internal" href="switch.html">Switches</a></li>
431 <li class="toctree-l2"><a class="reference internal" href="timer.html">Timer API</a></li>
432 <li class="toctree-l2"><a class="reference internal" href="tty.html">TTY</a></li>
433 <li class="toctree-l2"><a class="reference internal" href="uart.html">UARTs</a></li>
434 </ul>
435 </li>
436 </ul>
437
438 <div class="relations">
439 <h3>Related Topics</h3>
440 <ul>
441   <li><a href="../index.html">Documentation overview</a><ul>
442   <li><a href="../api.html">API Reference</a><ul>
443       <li>Previous: <a href="memory.html" title="previous chapter">Memory Enumeration</a></li>
444       <li>Next: <a href="shutdown.html" title="next chapter">Shutdown</a></li>
445   </ul></li>
446   </ul></li>
447 </ul>
448 </div>
449 <div id="searchbox" style="display: none" role="search">
450   <h3>Quick search</h3>
451     <div class="searchformwrapper">
452     <form class="search" action="../search.html" method="get">
453       <input type="text" name="q" />
454       <input type="submit" value="Go" />
455       <input type="hidden" name="check_keywords" value="yes" />
456       <input type="hidden" name="area" value="default" />
457     </form>
458     </div>
459 </div>
460 <script type="text/javascript">$('#searchbox').show(0);</script>
461         </div>
462       </div>
463       <div class="clearer"></div>
464     </div>
465     <div class="footer">
466       &copy;2019, SiFive Inc..
467       
468       |
469       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
470       &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
471       
472       |
473       <a href="../_sources/apiref/pmp.rst.txt"
474           rel="nofollow">Page source</a>
475     </div>
476
477     
478
479     
480   </body>
481 </html>