URL
https://opencores.org/ocsvn/avs_aes/avs_aes/trunk
Subversion Repositories avs_aes
[/] [avs_aes/] [trunk/] [doc/] [sw/] [html/] [avs__aes_8h.html] - Rev 21
Compare with Previous | Blame | View Log
<!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.4"/> <title>AES Avalon Slave (avs_aes): avs_aes.h File 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="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </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">AES Avalon Slave (avs_aes) </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('avs__aes_8h.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Macros</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">avs_aes.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>header file for AES Avalon IP Core software driver offers interfaces to convinient access to the core <a href="#details">More...</a></p> <div class="textblock"><div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"> <img id="dynsection-0-trigger" src="closed.png" alt="+"/> This graph shows which files directly or indirectly include this file:</div> <div id="dynsection-0-summary" class="dynsummary" style="display:block;"> </div> <div id="dynsection-0-content" class="dyncontent" style="display:none;"> <div class="center"><img src="avs__aes_8h__dep__incl.png" border="0" usemap="#avs__aes_8hdep" alt=""/></div> <map name="avs__aes_8hdep" id="avs__aes_8hdep"> <area shape="rect" id="node3" href="AEStester_8c.html" title="test program and example of how to use the software " alt="" coords="5,83,96,111"/><area shape="rect" id="node5" href="avs__aes_8c.html" title="AES Avalon IP Core software driver. " alt="" coords="120,83,197,111"/></map> </div> </div> <p><a href="avs__aes_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">object storing addresses for this Avalon AES slave might be useful in case there are more attached, also for convinience <a href="structavs__aes__handle.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:a40ac9fbe108b0ea74f57215528f13196"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a40ac9fbe108b0ea74f57215528f13196">KEYWORDS</a>   8</td></tr> <tr class="memdesc:a40ac9fbe108b0ea74f57215528f13196"><td class="mdescLeft"> </td><td class="mdescRight">Keylength 256 Bit AES. <a href="#a40ac9fbe108b0ea74f57215528f13196">More...</a><br/></td></tr> <tr class="separator:a40ac9fbe108b0ea74f57215528f13196"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aa93e16f5419a2515d4ebbd5368e9a8c5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#aa93e16f5419a2515d4ebbd5368e9a8c5">AES_BASEADDR</a>   0x40000</td></tr> <tr class="memdesc:aa93e16f5419a2515d4ebbd5368e9a8c5"><td class="mdescLeft"> </td><td class="mdescRight">base address of the Avalon Slave component in memory map <a href="#aa93e16f5419a2515d4ebbd5368e9a8c5">More...</a><br/></td></tr> <tr class="separator:aa93e16f5419a2515d4ebbd5368e9a8c5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaf27449032ce353aa329edd80cd2759a5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__control-register.html#gaf27449032ce353aa329edd80cd2759a5">KEY_VALID</a>   (1 << 7)</td></tr> <tr class="memdesc:gaf27449032ce353aa329edd80cd2759a5"><td class="mdescLeft"> </td><td class="mdescRight">Signal load of new key valid. <a href="group__control-register.html#gaf27449032ce353aa329edd80cd2759a5">More...</a><br/></td></tr> <tr class="separator:gaf27449032ce353aa329edd80cd2759a5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gab062bac21e942042e0e9a0b5c8bc6c04"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__control-register.html#gab062bac21e942042e0e9a0b5c8bc6c04">IRQ_ENA</a>   (1 << 6)</td></tr> <tr class="memdesc:gab062bac21e942042e0e9a0b5c8bc6c04"><td class="mdescLeft"> </td><td class="mdescRight">Enable interrupt bit. <a href="group__control-register.html#gab062bac21e942042e0e9a0b5c8bc6c04">More...</a><br/></td></tr> <tr class="separator:gab062bac21e942042e0e9a0b5c8bc6c04"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga36fab47015485191712a579a059a7c20"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__control-register.html#ga36fab47015485191712a579a059a7c20">DECRYPT</a>   (1 << 1)</td></tr> <tr class="memdesc:ga36fab47015485191712a579a059a7c20"><td class="mdescLeft"> </td><td class="mdescRight">Start decryption bit. <a href="group__control-register.html#ga36fab47015485191712a579a059a7c20">More...</a><br/></td></tr> <tr class="separator:ga36fab47015485191712a579a059a7c20"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga1cb0c60ca582db30ae87362ca43e8c19"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__control-register.html#ga1cb0c60ca582db30ae87362ca43e8c19">ENCRYPT</a>   (1 << 0)</td></tr> <tr class="memdesc:ga1cb0c60ca582db30ae87362ca43e8c19"><td class="mdescLeft"> </td><td class="mdescRight">start encryption bit <a href="group__control-register.html#ga1cb0c60ca582db30ae87362ca43e8c19">More...</a><br/></td></tr> <tr class="separator:ga1cb0c60ca582db30ae87362ca43e8c19"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a962dd946798faab0e83d401c7d43c33c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a962dd946798faab0e83d401c7d43c33c">avs_aes_init</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context)</td></tr> <tr class="memdesc:a962dd946798faab0e83d401c7d43c33c"><td class="mdescLeft"> </td><td class="mdescRight">setup the context to be used later. <a href="#a962dd946798faab0e83d401c7d43c33c">More...</a><br/></td></tr> <tr class="separator:a962dd946798faab0e83d401c7d43c33c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af18edc2beecc3842a131423f55c7636a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#af18edc2beecc3842a131423f55c7636a">avs_aes_setKey</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context, unsigned int *key)</td></tr> <tr class="memdesc:af18edc2beecc3842a131423f55c7636a"><td class="mdescLeft"> </td><td class="mdescRight">Set a new key This call asserts the KEY_VALID flag and triggers the key-expansion in the core. <a href="#af18edc2beecc3842a131423f55c7636a">More...</a><br/></td></tr> <tr class="separator:af18edc2beecc3842a131423f55c7636a"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a22f9afae76f645e31b514b5aa4df2cc1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a22f9afae76f645e31b514b5aa4df2cc1">avs_aes_setPayload</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context, unsigned int *payload)</td></tr> <tr class="memdesc:a22f9afae76f645e31b514b5aa4df2cc1"><td class="mdescLeft"> </td><td class="mdescRight">loads payload for processing to the core basically memcopy... <a href="#a22f9afae76f645e31b514b5aa4df2cc1">More...</a><br/></td></tr> <tr class="separator:a22f9afae76f645e31b514b5aa4df2cc1"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a55f078baaf019797ab6de7ea1a02475f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a55f078baaf019797ab6de7ea1a02475f">avs_aes_setKeyvalid</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context)</td></tr> <tr class="memdesc:a55f078baaf019797ab6de7ea1a02475f"><td class="mdescLeft"> </td><td class="mdescRight">set the KEY_VALID flag in the control word used to signal the completion of writing the key ( <a class="el" href="avs__aes_8h.html#af18edc2beecc3842a131423f55c7636a">avs_aes_setKey</a> ) <a href="#a55f078baaf019797ab6de7ea1a02475f">More...</a><br/></td></tr> <tr class="separator:a55f078baaf019797ab6de7ea1a02475f"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:acea23b2ab998f18b9aca810765632cac"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#acea23b2ab998f18b9aca810765632cac">avs_aes_encrypt</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context)</td></tr> <tr class="memdesc:acea23b2ab998f18b9aca810765632cac"><td class="mdescLeft"> </td><td class="mdescRight">set the ENCRYPT flag in the control word start encryption of (hopefully) previously loaded payload <a href="#acea23b2ab998f18b9aca810765632cac">More...</a><br/></td></tr> <tr class="separator:acea23b2ab998f18b9aca810765632cac"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aef16b7ecbb1b091934a9c670ce3b2fcf"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#aef16b7ecbb1b091934a9c670ce3b2fcf">avs_aes_decrypt</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context)</td></tr> <tr class="memdesc:aef16b7ecbb1b091934a9c670ce3b2fcf"><td class="mdescLeft"> </td><td class="mdescRight">set the DECRYPT flag in the control word start encryption of (hopefully) previously loaded payload <a href="#aef16b7ecbb1b091934a9c670ce3b2fcf">More...</a><br/></td></tr> <tr class="separator:aef16b7ecbb1b091934a9c670ce3b2fcf"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a827a78f73dd8fef9d2c9e72ad9bb4ea9"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a827a78f73dd8fef9d2c9e72ad9bb4ea9">avs_aes_isBusy</a> (<a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> *context)</td></tr> <tr class="memdesc:a827a78f73dd8fef9d2c9e72ad9bb4ea9"><td class="mdescLeft"> </td><td class="mdescRight">checks the COMPLETED flag can be used for ugly polling the slave if IRQs are not used <a href="#a827a78f73dd8fef9d2c9e72ad9bb4ea9">More...</a><br/></td></tr> <tr class="separator:a827a78f73dd8fef9d2c9e72ad9bb4ea9"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>header file for AES Avalon IP Core software driver offers interfaces to convinient access to the core </p> <p>This file is part of the project avs_aes see: <a href="http://opencores.org/project,avs_aes">http://opencores.org/project,avs_aes</a></p> <h1><a class="anchor" id="AUTHORS"></a> AUTHORS</h1> <p>Thomas Ruschival – <a href="#" onclick="location.href='mai'+'lto:'+'rus'+'ch'+'i@o'+'pe'+'nco'+'re'+'s.o'+'rg'; return false;">rusch<span style="display: none;">.nosp@m.</span>i@op<span style="display: none;">.nosp@m.</span>encor<span style="display: none;">.nosp@m.</span>es.o<span style="display: none;">.nosp@m.</span>rg</a> (www.ruschival.de)</p> <h1><a class="anchor" id="LICENSE"></a> LICENSE</h1> <p>Copyright (c) 2009, Authors and opencores.org All rights reserved.</p> <p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p> <ul> <li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li> <li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li> <li>Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE </li> </ul> <p>Definition in file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a class="anchor" id="aa93e16f5419a2515d4ebbd5368e9a8c5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define AES_BASEADDR   0x40000</td> </tr> </table> </div><div class="memdoc"> <p>base address of the Avalon Slave component in memory map </p> <p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00059">59</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p> </div> </div> <a class="anchor" id="a40ac9fbe108b0ea74f57215528f13196"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define KEYWORDS   8</td> </tr> </table> </div><div class="memdoc"> <p>Keylength 256 Bit AES. </p> <h1><a class="anchor" id="Configuration"></a> Configuration</h1> <p>Configuration items for the Avalon Slave component change them or define them elsewhere </p> <p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00052">52</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="aef16b7ecbb1b091934a9c670ce3b2fcf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_decrypt </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>set the DECRYPT flag in the control word start encryption of (hopefully) previously loaded payload </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00098">98</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  {</div> <div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) |= <a class="code" href="group__control-register.html#ga36fab47015485191712a579a059a7c20" title="Start decryption bit. ">DECRYPT</a>;</div> <div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keyword">asm</span> __volatile(<span class="stringliteral">"sync"</span> :::);</div> <div class="line"><a name="l00101"></a><span class="lineno"> 101</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="acea23b2ab998f18b9aca810765632cac"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_encrypt </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>set the ENCRYPT flag in the control word start encryption of (hopefully) previously loaded payload </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00092">92</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  {</div> <div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) |= <a class="code" href="group__control-register.html#ga1cb0c60ca582db30ae87362ca43e8c19" title="start encryption bit ">ENCRYPT</a>;</div> <div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keyword">asm</span> __volatile(<span class="stringliteral">"sync"</span> :::);</div> <div class="line"><a name="l00095"></a><span class="lineno"> 95</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="a962dd946798faab0e83d401c7d43c33c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_init </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>setup the context to be used later. </p> <h1><a class="anchor" id="functions"></a> functions</h1> <p>initializes the pointers to the correct memory locations </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>: struct grouping address information </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00053">53</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  {</div> <div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  context-><a class="code" href="structavs__aes__handle.html#acb9eb474c8310afe4b082b79914f274c" title="pointer to key field in memory mapping ">key</a> = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8c.html#aac9313626ecf492e39b0f4add66e370d" title="memory offset for key DON'T CHANGE! ">KEY_ADDR</a>;</div> <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  context-><a class="code" href="structavs__aes__handle.html#adae23dc33b7dec54b9da34f347256214" title="pointer to data field in memory mapping used for both decryption and encryption ">payload</a>= (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8c.html#a994843be3758f70aa91454a9ddfacb19" title="memory offset of payload ">DATA_ADDR</a>;</div> <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  context-><a class="code" href="structavs__aes__handle.html#ae0ad9e7bde68d07c018a299a0cda66af" title="pointer to result field in memory mapping ">result</a> = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8c.html#a192250a419c33c4ff96948f692a44254" title="memory offset of result ">RESULT_ADDR</a>;</div> <div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a> = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8c.html#a30e81662ebaec8c1b8a283c42e88df36" title="memory offset for control word ">AESCTRLWD</a>;</div> <div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) = 0x00000000;</div> <div class="line"><a name="l00059"></a><span class="lineno"> 59</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="a827a78f73dd8fef9d2c9e72ad9bb4ea9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int avs_aes_isBusy </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>checks the COMPLETED flag can be used for ugly polling the slave if IRQs are not used </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>1 if still computing 0 if done. </dd></dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00104">104</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  {</div> <div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mycontrol = *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>); </div> <div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">return</span> mycontrol & (<a class="code" href="group__control-register.html#ga36fab47015485191712a579a059a7c20" title="Start decryption bit. ">DECRYPT</a> | <a class="code" href="group__control-register.html#ga1cb0c60ca582db30ae87362ca43e8c19" title="start encryption bit ">ENCRYPT</a>);</div> <div class="line"><a name="l00107"></a><span class="lineno"> 107</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="af18edc2beecc3842a131423f55c7636a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_setKey </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int * </td> <td class="paramname"><em>key</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Set a new key This call asserts the KEY_VALID flag and triggers the key-expansion in the core. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> <tr><td class="paramname">key</td><td>user key to load </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00062">62</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  {</div> <div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordtype">int</span> i=0;</div> <div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* target_ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* )context-><a class="code" href="structavs__aes__handle.html#acb9eb474c8310afe4b082b79914f274c" title="pointer to key field in memory mapping ">key</a>;</div> <div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">/* Invalidate old key; */</span></div> <div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) &= (~<a class="code" href="group__control-register.html#gaf27449032ce353aa329edd80cd2759a5" title="Signal load of new key valid. ">KEY_VALID</a>);</div> <div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keyword">asm</span> __volatile(<span class="stringliteral">"sync"</span> :::);</div> <div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">for</span>(i=0; i<<a class="code" href="avs__aes_8h.html#a40ac9fbe108b0ea74f57215528f13196" title="Keylength 256 Bit AES. ">KEYWORDS</a>; i++){</div> <div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  *(target_ptr++) = *(key++);</div> <div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  }</div> <div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keyword">asm</span> __volatile(<span class="stringliteral">"sync"</span> :::);</div> <div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="comment">/* validate key */</span></div> <div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) |= <a class="code" href="group__control-register.html#gaf27449032ce353aa329edd80cd2759a5" title="Signal load of new key valid. ">KEY_VALID</a>;</div> <div class="line"><a name="l00074"></a><span class="lineno"> 74</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="a55f078baaf019797ab6de7ea1a02475f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_setKeyvalid </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>set the KEY_VALID flag in the control word used to signal the completion of writing the key ( <a class="el" href="avs__aes_8h.html#af18edc2beecc3842a131423f55c7636a">avs_aes_setKey</a> ) </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00086">86</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  {</div> <div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  *(context-><a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word ">control</a>) |= <a class="code" href="group__control-register.html#gaf27449032ce353aa329edd80cd2759a5" title="Signal load of new key valid. ">KEY_VALID</a>;</div> <div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">asm</span> __volatile(<span class="stringliteral">"sync"</span> :::);</div> <div class="line"><a name="l00089"></a><span class="lineno"> 89</span> }</div> </div><!-- fragment --> </div> </div> <a class="anchor" id="a22f9afae76f645e31b514b5aa4df2cc1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void avs_aes_setPayload </td> <td>(</td> <td class="paramtype"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a> * </td> <td class="paramname"><em>context</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int * </td> <td class="paramname"><em>payload</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>loads payload for processing to the core basically memcopy... </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">context</td><td>struct grouping address information </td></tr> <tr><td class="paramname">payload</td><td>user data to be processed </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00077">77</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p> <div class="fragment"><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  {</div> <div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordtype">int</span> i=0;</div> <div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* target_ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* )context-><a class="code" href="structavs__aes__handle.html#adae23dc33b7dec54b9da34f347256214" title="pointer to data field in memory mapping used for both decryption and encryption ">payload</a>;</div> <div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">for</span>(i=0; i<4; i++){</div> <div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  *(target_ptr++) = *(payload++);</div> <div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  } </div> <div class="line"><a name="l00083"></a><span class="lineno"> 83</span> }</div> </div><!-- fragment --> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="avs__aes_8h.html">avs_aes.h</a></li> <li class="footer">Generated on Sat Apr 19 2014 17:55:55 for AES Avalon Slave (avs_aes) by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.4 </li> </ul> </div> </body> </html>