1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
arduinolibs/classNoiseSource.html
Rhys Weatherley 25eb9d2eb6 Update docs
2018-02-18 09:12:45 +10:00

298 lines
18 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ArduinoLibs: NoiseSource Class Reference</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/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</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 style="padding-left: 0.5em;">
<div id="projectname">ArduinoLibs
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classNoiseSource-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">NoiseSource Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>Abstract base class for random noise sources.
<a href="classNoiseSource.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="NoiseSource_8h_source.html">NoiseSource.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for NoiseSource:</div>
<div class="dyncontent">
<div class="center">
<img src="classNoiseSource.png" usemap="#NoiseSource_map" alt=""/>
<map id="NoiseSource_map" name="NoiseSource_map">
<area href="classRingOscillatorNoiseSource.html" title="Processes the signal from a ring oscillator based noise source. " alt="RingOscillatorNoiseSource" shape="rect" coords="0,56,164,80"/>
<area href="classTransistorNoiseSource.html" title="Processes the signal from a transistor-based noise source. " alt="TransistorNoiseSource" shape="rect" coords="174,56,338,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a601479b7d8cc215f97f2f8a18d3ef4c2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a601479b7d8cc215f97f2f8a18d3ef4c2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#a601479b7d8cc215f97f2f8a18d3ef4c2">NoiseSource</a> ()</td></tr>
<tr class="memdesc:a601479b7d8cc215f97f2f8a18d3ef4c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new random noise source. <br/></td></tr>
<tr class="separator:a601479b7d8cc215f97f2f8a18d3ef4c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4eca1e894a5d719fb9bf4df34a791cdb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4eca1e894a5d719fb9bf4df34a791cdb"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#a4eca1e894a5d719fb9bf4df34a791cdb">~NoiseSource</a> ()</td></tr>
<tr class="memdesc:a4eca1e894a5d719fb9bf4df34a791cdb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys this random noise source. <br/></td></tr>
<tr class="separator:a4eca1e894a5d719fb9bf4df34a791cdb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac8ac086f830efb5ffe3e8d506aa61c85"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#ac8ac086f830efb5ffe3e8d506aa61c85">calibrating</a> () const =0</td></tr>
<tr class="memdesc:ac8ac086f830efb5ffe3e8d506aa61c85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine if the noise source is still calibrating itself. <a href="#ac8ac086f830efb5ffe3e8d506aa61c85">More...</a><br/></td></tr>
<tr class="separator:ac8ac086f830efb5ffe3e8d506aa61c85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ce647815524fe84f562aca5256e12f3"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#a7ce647815524fe84f562aca5256e12f3">stir</a> ()=0</td></tr>
<tr class="memdesc:a7ce647815524fe84f562aca5256e12f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stirs entropy from this noise source into the global random number pool. <a href="#a7ce647815524fe84f562aca5256e12f3">More...</a><br/></td></tr>
<tr class="separator:a7ce647815524fe84f562aca5256e12f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a48d0efabd71ff6e557a0898be79c49ba"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#a48d0efabd71ff6e557a0898be79c49ba">added</a> ()</td></tr>
<tr class="memdesc:a48d0efabd71ff6e557a0898be79c49ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the noise source is added to RNG with <a class="el" href="classRNGClass.html#aacf23b192b0e4cc8726d9abe05f5a9db">RNG.addNoiseSource()</a>. <a href="#a48d0efabd71ff6e557a0898be79c49ba">More...</a><br/></td></tr>
<tr class="separator:a48d0efabd71ff6e557a0898be79c49ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a1af7449a5ae4a8acd34ac218c9eec6c1"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classNoiseSource.html#a1af7449a5ae4a8acd34ac218c9eec6c1">output</a> (const uint8_t *data, size_t len, unsigned int credit)</td></tr>
<tr class="memdesc:a1af7449a5ae4a8acd34ac218c9eec6c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called from subclasses to output noise to the global random number pool. <a href="#a1af7449a5ae4a8acd34ac218c9eec6c1">More...</a><br/></td></tr>
<tr class="separator:a1af7449a5ae4a8acd34ac218c9eec6c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract base class for random noise sources. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classRNGClass.html">RNG</a>, <a class="el" href="classTransistorNoiseSource.html" title="Processes the signal from a transistor-based noise source. ">TransistorNoiseSource</a> </dd></dl>
<p>Definition at line <a class="el" href="NoiseSource_8h_source.html#l00029">29</a> of file <a class="el" href="NoiseSource_8h_source.html">NoiseSource.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a48d0efabd71ff6e557a0898be79c49ba"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void NoiseSource::added </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when the noise source is added to RNG with <a class="el" href="classRNGClass.html#aacf23b192b0e4cc8726d9abe05f5a9db">RNG.addNoiseSource()</a>. </p>
<p>This function is intended for noise source initialization tasks that must be performed after <a class="el" href="classRNGClass.html#a77eb101a225ce541800ac1361a92b1a6">RNG.begin()</a> has been called to initialize the global random number pool. For example, if the noise source has a unique identifier or serial number then this function can stir it into the pool at startup time. </p>
<p>Definition at line <a class="el" href="NoiseSource_8cpp_source.html#l00095">95</a> of file <a class="el" href="NoiseSource_8cpp_source.html">NoiseSource.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ac8ac086f830efb5ffe3e8d506aa61c85"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool NoiseSource::calibrating </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Determine if the noise source is still calibrating itself. </p>
<dl class="section return"><dt>Returns</dt><dd>Returns true if calibration is in progress; false if the noise source is generating valid random data.</dd></dl>
<p>Noise sources that require calibration start doing so at system startup and then switch over to random data generation once calibration is complete. Since no random data is being generated during calibration, the output from <a class="el" href="classRNGClass.html#a418a833cf18198fd7e5d6dbd78c99c29">RNG.rand()</a> may be predictable. Use <a class="el" href="classRNGClass.html#a49e3231ba65a5e4b045bc90976e0a659">RNG.available()</a> to determine when sufficient entropy is available to generate good random values.</p>
<p>It is possible that the noise source never exits calibration. This can happen if the input voltage is insufficient to trigger noise or if the noise source is not connected. Noise sources may also periodically recalibrate themselves.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classNoiseSource.html#a7ce647815524fe84f562aca5256e12f3" title="Stirs entropy from this noise source into the global random number pool. ">stir()</a> </dd></dl>
<p>Implemented in <a class="el" href="classRingOscillatorNoiseSource.html#ade7f7ed390e23722347b3c207912b3f9">RingOscillatorNoiseSource</a>, and <a class="el" href="classTransistorNoiseSource.html#a9244b327c291c737396e769da9c66af9">TransistorNoiseSource</a>.</p>
</div>
</div>
<a class="anchor" id="a1af7449a5ae4a8acd34ac218c9eec6c1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void NoiseSource::output </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&#160;</td>
<td class="paramname"><em>credit</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called from subclasses to output noise to the global random number pool. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>Points to the noise data. </td></tr>
<tr><td class="paramname">len</td><td>Number of bytes of noise data. </td></tr>
<tr><td class="paramname">credit</td><td>The number of bits of entropy to credit for the data. Note that this is bits, not bytes.</td></tr>
</table>
</dd>
</dl>
<p>The default implementation of this function calls <a class="el" href="classRNGClass.html#ad99535ea23ae2fec55bdebb8c24def02">RNG.stir()</a> to add the entropy from this noise source to the global random number pool.</p>
<p>This function may be overridden by subclasses to capture the raw output from the noise source before it is mixed into the pool to allow the raw data to be analyzed for randomness. </p>
<p>Definition at line <a class="el" href="NoiseSource_8cpp_source.html#l00117">117</a> of file <a class="el" href="NoiseSource_8cpp_source.html">NoiseSource.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7ce647815524fe84f562aca5256e12f3"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void NoiseSource::stir </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Stirs entropy from this noise source into the global random number pool. </p>
<p>This function should call <a class="el" href="classNoiseSource.html#a1af7449a5ae4a8acd34ac218c9eec6c1" title="Called from subclasses to output noise to the global random number pool. ">output()</a> to add the entropy from this noise source to the global random number pool.</p>
<p>The noise source should batch up the entropy data, providing between 16 and 48 bytes of data each time. If the noise source does not have sufficient entropy data at the moment, it should return without stiring the current data in.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classNoiseSource.html#ac8ac086f830efb5ffe3e8d506aa61c85" title="Determine if the noise source is still calibrating itself. ">calibrating()</a>, <a class="el" href="classNoiseSource.html#a1af7449a5ae4a8acd34ac218c9eec6c1" title="Called from subclasses to output noise to the global random number pool. ">output()</a> </dd></dl>
<p>Implemented in <a class="el" href="classRingOscillatorNoiseSource.html#ad71698b5c92b41eef2f1322999b3eff9">RingOscillatorNoiseSource</a>, and <a class="el" href="classTransistorNoiseSource.html#add25c6a14b0506bc30ca781f2d923917">TransistorNoiseSource</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="NoiseSource_8h_source.html">NoiseSource.h</a></li>
<li><a class="el" href="NoiseSource_8cpp_source.html">NoiseSource.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Feb 18 2018 09:12:23 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>