]> Git Repo - pico-vscode.git/blob - web/docs/group__hardware__riscv__platform__timer.html
Add rp2350 support
[pico-vscode.git] / web / docs / group__hardware__riscv__platform__timer.html
1 <!-- HTML header for doxygen 1.8.20-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5         <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6         <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7         <meta name="generator" content="Doxygen 1.9.4"/>
8         <meta name="viewport" content="width=device-width, initial-scale=1"/>
9         <title>Raspberry Pi Pico SDK: hardware_riscv_platform_timer</title>
10         <!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
11         <script type="text/javascript" src="jquery.js"></script>
12         <script type="text/javascript" src="dynsections.js"></script>
13         <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17         <link href="search/search.css" rel="stylesheet" type="text/css"/>
18 <script type="text/javascript" src="search/searchdata.js"></script>
19 <script type="text/javascript" src="search/search.js"></script>
20     <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
21         <link href="doxygen.css" rel="stylesheet" type="text/css" />
22         <link href="normalise.css" rel="stylesheet" type="text/css"/>
23 <link href="main.css" rel="stylesheet" type="text/css"/>
24 <link href="styles.css" rel="stylesheet" type="text/css"/>
25 </head>
26 <body>
27         <div class="navigation-mobile">
28                 <div class="logo--mobile">
29                         <a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
30                 </div>
31                 <div class="navigation-toggle">
32                         <span class="line-1"></span>
33                         <span class="line-2">
34                                 <p>Menu Toggle</p>
35                         </span>
36                         <span class="line-3"></span>
37                 </div>
38         </div>
39         <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
40                 <div class="logo">
41                         <a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
42                         <span style="display: inline-block; margin-top: 10px;">
43                                 v2.0.0
44                         </span>
45                 </div>
46                 <div class="navigation-footer">
47                         <img src="logo-mobile.svg" alt="Raspberry Pi">
48                         <a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
49                 </div>
50 <!--            <div class="search">
51                         <form>
52                                 <input type="search" name="search" id="search" placeholder="Search">
53                                 <input type="submit" value="Search">
54                         </form>
55                 </div> -->
56 <!-- Generated by Doxygen 1.9.4 -->
57 <script type="text/javascript">
58 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
59 var searchBox = new SearchBox("searchBox", "search",'Search','.html');
60 /* @license-end */
61 </script>
62 <script type="text/javascript" src="menudata.js"></script>
63 <script type="text/javascript" src="menu.js"></script>
64 <script type="text/javascript">
65 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
66 $(function() {
67   initMenu('',true,false,'search.php','Search');
68   $(document).ready(function() { init_search(); });
69 });
70 /* @license-end */
71 </script>
72 <div id="main-nav"></div>
73 </div><!-- top -->
74 <div id="side-nav" class="ui-resizable side-nav-resizable">
75   <div id="nav-tree">
76     <div id="nav-tree-contents">
77       <div id="nav-sync" class="sync"></div>
78     </div>
79   </div>
80   <div id="splitbar" style="-moz-user-select:none;" 
81        class="ui-resizable-handle">
82   </div>
83 </div>
84 <script type="text/javascript">
85 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
86 $(document).ready(function(){initNavTree('group__hardware__riscv__platform__timer.html',''); initResizable(); });
87 /* @license-end */
88 </script>
89 <div id="doc-content">
90 <!-- window showing the filter options -->
91 <div id="MSearchSelectWindow"
92      onmouseover="return searchBox.OnSearchSelectShow()"
93      onmouseout="return searchBox.OnSearchSelectHide()"
94      onkeydown="return searchBox.OnSearchSelectKey(event)">
95 </div>
96
97 <!-- iframe showing the search results (closed by default) -->
98 <div id="MSearchResultsWindow">
99 <iframe src="javascript:void(0)" frameborder="0" 
100         name="MSearchResults" id="MSearchResults">
101 </iframe>
102 </div>
103
104 <div class="header">
105   <div class="summary">
106 <a href="#func-members">Functions</a>  </div>
107   <div class="headertitle"><div class="title">hardware_riscv_platform_timer<div class="ingroups"><a class="el" href="group__hardware.html">Hardware APIs</a></div></div></div>
108 </div><!--header-->
109 <div class="contents">
110
111 <p>Accessors for standard RISC-V platform timer (mtime/mtimecmp), available on Raspberry Pi microcontrollers with RISC-V processors.  
112 <a href="#details">More...</a></p>
113 <table class="memberdecls">
114 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
115 Functions</h2></td></tr>
116 <tr class="memitem:ga2afc7ae3feafc019abd3883a3f2fe04f"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#ga2afc7ae3feafc019abd3883a3f2fe04f">riscv_timer_set_enabled</a> (bool enabled)</td></tr>
117 <tr class="memdesc:ga2afc7ae3feafc019abd3883a3f2fe04f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable or disable the RISC-V platform timer.  <a href="group__hardware__riscv__platform__timer.html#ga2afc7ae3feafc019abd3883a3f2fe04f">More...</a><br /></td></tr>
118 <tr class="separator:ga2afc7ae3feafc019abd3883a3f2fe04f"><td class="memSeparator" colspan="2">&#160;</td></tr>
119 <tr class="memitem:gacdd646c3b36c51473a16c07a799f9eec"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#gacdd646c3b36c51473a16c07a799f9eec">riscv_timer_set_fullspeed</a> (bool fullspeed)</td></tr>
120 <tr class="memdesc:gacdd646c3b36c51473a16c07a799f9eec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure the RISC-V platform timer to run at full system clock speed.  <a href="group__hardware__riscv__platform__timer.html#gacdd646c3b36c51473a16c07a799f9eec">More...</a><br /></td></tr>
121 <tr class="separator:gacdd646c3b36c51473a16c07a799f9eec"><td class="memSeparator" colspan="2">&#160;</td></tr>
122 <tr class="memitem:gab016600bb8fc7553da83a90501371693"><td class="memItemLeft" align="right" valign="top">static uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#gab016600bb8fc7553da83a90501371693">riscv_timer_get_mtime</a> (void)</td></tr>
123 <tr class="memdesc:gab016600bb8fc7553da83a90501371693"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the RISC-V platform timer.  <a href="group__hardware__riscv__platform__timer.html#gab016600bb8fc7553da83a90501371693">More...</a><br /></td></tr>
124 <tr class="separator:gab016600bb8fc7553da83a90501371693"><td class="memSeparator" colspan="2">&#160;</td></tr>
125 <tr class="memitem:ga96285c497dceb9126e6ea3130be72bcb"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#ga96285c497dceb9126e6ea3130be72bcb">riscv_timer_set_mtime</a> (uint64_t mtime)</td></tr>
126 <tr class="memdesc:ga96285c497dceb9126e6ea3130be72bcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update the RISC-V platform timer.  <a href="group__hardware__riscv__platform__timer.html#ga96285c497dceb9126e6ea3130be72bcb">More...</a><br /></td></tr>
127 <tr class="separator:ga96285c497dceb9126e6ea3130be72bcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
128 <tr class="memitem:ga148695c3ff3dce3222934040cfc77d91"><td class="memItemLeft" align="right" valign="top">static uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#ga148695c3ff3dce3222934040cfc77d91">riscv_timer_get_mtimecmp</a> (void)</td></tr>
129 <tr class="memdesc:ga148695c3ff3dce3222934040cfc77d91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current RISC-V platform timer mtimecmp value for this core.  <a href="group__hardware__riscv__platform__timer.html#ga148695c3ff3dce3222934040cfc77d91">More...</a><br /></td></tr>
130 <tr class="separator:ga148695c3ff3dce3222934040cfc77d91"><td class="memSeparator" colspan="2">&#160;</td></tr>
131 <tr class="memitem:ga7003005e0d2142e95ce53f2ceee29fdd"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__riscv__platform__timer.html#ga7003005e0d2142e95ce53f2ceee29fdd">riscv_timer_set_mtimecmp</a> (uint64_t mtimecmp)</td></tr>
132 <tr class="memdesc:ga7003005e0d2142e95ce53f2ceee29fdd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a new RISC-V platform timer interrupt comparison value (mtimecmp) for this core.  <a href="group__hardware__riscv__platform__timer.html#ga7003005e0d2142e95ce53f2ceee29fdd">More...</a><br /></td></tr>
133 <tr class="separator:ga7003005e0d2142e95ce53f2ceee29fdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
134 </table>
135 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
136 <p >Accessors for standard RISC-V platform timer (mtime/mtimecmp), available on Raspberry Pi microcontrollers with RISC-V processors. </p>
137 <p >Note this header can be used by Arm as well as RISC-V processors, as the timer is a memory-mapped peripheral external to the processors. The name refers to this timer being a standard RISC-V peripheral. </p>
138 <h2 class="groupheader">Function Documentation</h2>
139 <a id="gab016600bb8fc7553da83a90501371693" name="gab016600bb8fc7553da83a90501371693"></a>
140 <h2 class="memtitle"><span class="permalink"><a href="#gab016600bb8fc7553da83a90501371693">&#9670;&nbsp;</a></span>riscv_timer_get_mtime()</h2>
141
142 <div class="memitem">
143 <div class="memproto">
144 <table class="mlabels">
145   <tr>
146   <td class="mlabels-left">
147       <table class="memname">
148         <tr>
149           <td class="memname">static uint64_t riscv_timer_get_mtime </td>
150           <td>(</td>
151           <td class="paramtype">void&#160;</td>
152           <td class="paramname"></td><td>)</td>
153           <td></td>
154         </tr>
155       </table>
156   </td>
157   <td class="mlabels-right">
158 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
159   </tr>
160 </table>
161 </div><div class="memdoc">
162
163 <p>Read the RISC-V platform timer. </p>
164 <dl class="section return"><dt>Returns</dt><dd>Current 64-bit mtime value </dd></dl>
165
166 </div>
167 </div>
168 <a id="ga148695c3ff3dce3222934040cfc77d91" name="ga148695c3ff3dce3222934040cfc77d91"></a>
169 <h2 class="memtitle"><span class="permalink"><a href="#ga148695c3ff3dce3222934040cfc77d91">&#9670;&nbsp;</a></span>riscv_timer_get_mtimecmp()</h2>
170
171 <div class="memitem">
172 <div class="memproto">
173 <table class="mlabels">
174   <tr>
175   <td class="mlabels-left">
176       <table class="memname">
177         <tr>
178           <td class="memname">static uint64_t riscv_timer_get_mtimecmp </td>
179           <td>(</td>
180           <td class="paramtype">void&#160;</td>
181           <td class="paramname"></td><td>)</td>
182           <td></td>
183         </tr>
184       </table>
185   </td>
186   <td class="mlabels-right">
187 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
188   </tr>
189 </table>
190 </div><div class="memdoc">
191
192 <p>Get the current RISC-V platform timer mtimecmp value for this core. </p>
193 <p >Get the current mtimecmp value for the calling core. This function is interrupt-safe as long as timer interrupts only increase the value of mtimecmp. Otherwise, it must be called with timer interrupts disabled.</p>
194 <dl class="section return"><dt>Returns</dt><dd>Current value of mtimecmp </dd></dl>
195
196 </div>
197 </div>
198 <a id="ga2afc7ae3feafc019abd3883a3f2fe04f" name="ga2afc7ae3feafc019abd3883a3f2fe04f"></a>
199 <h2 class="memtitle"><span class="permalink"><a href="#ga2afc7ae3feafc019abd3883a3f2fe04f">&#9670;&nbsp;</a></span>riscv_timer_set_enabled()</h2>
200
201 <div class="memitem">
202 <div class="memproto">
203 <table class="mlabels">
204   <tr>
205   <td class="mlabels-left">
206       <table class="memname">
207         <tr>
208           <td class="memname">static void riscv_timer_set_enabled </td>
209           <td>(</td>
210           <td class="paramtype">bool&#160;</td>
211           <td class="paramname"><em>enabled</em></td><td>)</td>
212           <td></td>
213         </tr>
214       </table>
215   </td>
216   <td class="mlabels-right">
217 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
218   </tr>
219 </table>
220 </div><div class="memdoc">
221
222 <p>Enable or disable the RISC-V platform timer. </p>
223 <p >This enables and disables the counting of the RISC-V platform timer. It does not enable or disable the interrupts, which are asserted unconditionally when a given core's mtimecmp/mtimecmph registers are greater than the current 64-bit value of the mtime/mtimeh registers.</p>
224 <dl class="params"><dt>Parameters</dt><dd>
225   <table class="params">
226     <tr><td class="paramname">enabled</td><td>Pass true to enable, false to disable </td></tr>
227   </table>
228   </dd>
229 </dl>
230
231 </div>
232 </div>
233 <a id="gacdd646c3b36c51473a16c07a799f9eec" name="gacdd646c3b36c51473a16c07a799f9eec"></a>
234 <h2 class="memtitle"><span class="permalink"><a href="#gacdd646c3b36c51473a16c07a799f9eec">&#9670;&nbsp;</a></span>riscv_timer_set_fullspeed()</h2>
235
236 <div class="memitem">
237 <div class="memproto">
238 <table class="mlabels">
239   <tr>
240   <td class="mlabels-left">
241       <table class="memname">
242         <tr>
243           <td class="memname">static void riscv_timer_set_fullspeed </td>
244           <td>(</td>
245           <td class="paramtype">bool&#160;</td>
246           <td class="paramname"><em>fullspeed</em></td><td>)</td>
247           <td></td>
248         </tr>
249       </table>
250   </td>
251   <td class="mlabels-right">
252 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
253   </tr>
254 </table>
255 </div><div class="memdoc">
256
257 <p>Configure the RISC-V platform timer to run at full system clock speed. </p>
258 <dl class="params"><dt>Parameters</dt><dd>
259   <table class="params">
260     <tr><td class="paramname">fullspeed</td><td>Pass true to increment at system clock speed, false to increment at the frequency defined by the system tick generator (the <code>ticks</code> block) </td></tr>
261   </table>
262   </dd>
263 </dl>
264
265 </div>
266 </div>
267 <a id="ga96285c497dceb9126e6ea3130be72bcb" name="ga96285c497dceb9126e6ea3130be72bcb"></a>
268 <h2 class="memtitle"><span class="permalink"><a href="#ga96285c497dceb9126e6ea3130be72bcb">&#9670;&nbsp;</a></span>riscv_timer_set_mtime()</h2>
269
270 <div class="memitem">
271 <div class="memproto">
272 <table class="mlabels">
273   <tr>
274   <td class="mlabels-left">
275       <table class="memname">
276         <tr>
277           <td class="memname">static void riscv_timer_set_mtime </td>
278           <td>(</td>
279           <td class="paramtype">uint64_t&#160;</td>
280           <td class="paramname"><em>mtime</em></td><td>)</td>
281           <td></td>
282         </tr>
283       </table>
284   </td>
285   <td class="mlabels-right">
286 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
287   </tr>
288 </table>
289 </div><div class="memdoc">
290
291 <p>Update the RISC-V platform timer. </p>
292 <p >This function should only be called when the timer is disabled via <a class="el" href="group__hardware__riscv__platform__timer.html#ga2afc7ae3feafc019abd3883a3f2fe04f" title="Enable or disable the RISC-V platform timer.">riscv_timer_set_enabled()</a>. Note also that unlike the mtimecmp comparison values, mtime is <em>not</em> core-local, so updates on one core will be visible to the other core.</p>
293 <dl class="params"><dt>Parameters</dt><dd>
294   <table class="params">
295     <tr><td class="paramname">mtime</td><td>New value to set the RISC-V platform timer to </td></tr>
296   </table>
297   </dd>
298 </dl>
299
300 </div>
301 </div>
302 <a id="ga7003005e0d2142e95ce53f2ceee29fdd" name="ga7003005e0d2142e95ce53f2ceee29fdd"></a>
303 <h2 class="memtitle"><span class="permalink"><a href="#ga7003005e0d2142e95ce53f2ceee29fdd">&#9670;&nbsp;</a></span>riscv_timer_set_mtimecmp()</h2>
304
305 <div class="memitem">
306 <div class="memproto">
307 <table class="mlabels">
308   <tr>
309   <td class="mlabels-left">
310       <table class="memname">
311         <tr>
312           <td class="memname">static void riscv_timer_set_mtimecmp </td>
313           <td>(</td>
314           <td class="paramtype">uint64_t&#160;</td>
315           <td class="paramname"><em>mtimecmp</em></td><td>)</td>
316           <td></td>
317         </tr>
318       </table>
319   </td>
320   <td class="mlabels-right">
321 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
322   </tr>
323 </table>
324 </div><div class="memdoc">
325
326 <p>Set a new RISC-V platform timer interrupt comparison value (mtimecmp) for this core. </p>
327 <p >This function updates the mtimecmp value for the current core. The calling core's RISC-V platform timer interrupt is asserted whenever the 64-bit mtime value (stored in 32-bit mtime/mtimeh registers) is greater than or equal to this core's current mtime/mtimecmph value.</p>
328 <dl class="params"><dt>Parameters</dt><dd>
329   <table class="params">
330     <tr><td class="paramname">mtime</td><td>New value to set the RISC-V platform timer to </td></tr>
331   </table>
332   </dd>
333 </dl>
334
335 </div>
336 </div>
337 </div><!-- contents -->
338 </div><!-- doc-content -->
339
340         <script src="main.js"></script>
341 </body>
342 </html>
This page took 0.046004 seconds and 4 git commands to generate.