OpenCores
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 11

Go to most recent revision | 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"/>
<title>AES Avalon Slave (avs_aes): avs_aes.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>avs_aes.h File Reference</h1>
<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="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
<div class="center"><img src="avs__aes_8h__dep__incl.png" border="0" usemap="#avs__aes_8hdep_map" alt=""/></div>
<map name="avs__aes_8hdep_map" id="avs__aes_8hdep">
<area shape="rect" href="AEStester_8c.html" title="test program and example of how to use the software" alt="" coords="5,83,96,112"/><area shape="rect" href="avs__aes_8c.html" title="AES Avalon IP Core software driver." alt="" coords="120,83,200,112"/></map>
</div>
 
<p><a href="avs__aes_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structavs__aes__handle.html">avs_aes_handle</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</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><td colspan="2"><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a40ac9fbe108b0ea74f57215528f13196">KEYWORDS</a>&nbsp;&nbsp;&nbsp;8</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Keylength 256 Bit AES.  <a href="#a40ac9fbe108b0ea74f57215528f13196"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#aa93e16f5419a2515d4ebbd5368e9a8c5">AES_BASEADDR</a>&nbsp;&nbsp;&nbsp;0x40000</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">base address of the Avalon Slave component in memory map  <a href="#aa93e16f5419a2515d4ebbd5368e9a8c5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#ac237029d30090de9c406fd8cf6f9df37">KEY_ADDR</a>&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x00</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">memory offset for key DON'T CHANGE!  <a href="#ac237029d30090de9c406fd8cf6f9df37"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a622ef33a8b85e8a7558ce42e9fc73870">DATA_ADDR</a>&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x08</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">memory offset of payload DON'T CHANGE!  <a href="#a622ef33a8b85e8a7558ce42e9fc73870"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#add31e6954a8ef1d40c63409f686135b9">RESULT_ADDR</a>&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x10</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">memory offset of result DON'T CHANGE!  <a href="#add31e6954a8ef1d40c63409f686135b9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="avs__aes_8h.html#a939a4e25c6ce6c1224b8d923038f6639">AESCTRLWD</a>&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x18</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">memory offset for control word DON'T CHANGE!  <a href="#a939a4e25c6ce6c1224b8d923038f6639"></a><br/></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">setup the context to be used later.  <a href="#a962dd946798faab0e83d401c7d43c33c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">setup the context to be used later.  <a href="#af18edc2beecc3842a131423f55c7636a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">loads payload for processing to the core basically memcopy.  <a href="#a22f9afae76f645e31b514b5aa4df2cc1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</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"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">set the ENCRYPT flag in the control word start encryption of (hopefully) previously loaded payload  <a href="#acea23b2ab998f18b9aca810765632cac"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">set the DECRYPT flag in the control word start encryption of (hopefully) previously loaded payload  <a href="#aef16b7ecbb1b091934a9c670ce3b2fcf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</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><td class="mdescLeft">&nbsp;</td><td class="mdescRight">checks the COMPLETED flag can be used for ugly polling the slave if IRQs are not used  <a href="#a827a78f73dd8fef9d2c9e72ad9bb4ea9"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<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>
<h2><a class="anchor" id="AUTHORS">
AUTHORS</a></h2>
<p>Thomas Ruschival -- <a href="mailto:ruschi@opencores.org">ruschi@opencores.org</a> (www.ruschival.de)</p>
<h2><a class="anchor" id="LICENSE">
LICENSE</a></h2>
<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: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. * 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 </p>
 
<p>Definition in file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="aa93e16f5419a2515d4ebbd5368e9a8c5"></a><!-- doxytag: member="avs_aes.h::AES_BASEADDR" ref="aa93e16f5419a2515d4ebbd5368e9a8c5" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define AES_BASEADDR&nbsp;&nbsp;&nbsp;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#l00060">60</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
 
</div>
</div>
<a class="anchor" id="a939a4e25c6ce6c1224b8d923038f6639"></a><!-- doxytag: member="avs_aes.h::AESCTRLWD" ref="a939a4e25c6ce6c1224b8d923038f6639" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define AESCTRLWD&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x18</td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>memory offset for control word DON'T CHANGE! </p>
 
<p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00075">75</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
 
</div>
</div>
<a class="anchor" id="a622ef33a8b85e8a7558ce42e9fc73870"></a><!-- doxytag: member="avs_aes.h::DATA_ADDR" ref="a622ef33a8b85e8a7558ce42e9fc73870" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DATA_ADDR&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x08</td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>memory offset of payload DON'T CHANGE! </p>
 
<p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00071">71</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
 
</div>
</div>
<a class="anchor" id="ac237029d30090de9c406fd8cf6f9df37"></a><!-- doxytag: member="avs_aes.h::KEY_ADDR" ref="ac237029d30090de9c406fd8cf6f9df37" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define KEY_ADDR&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x00</td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>memory offset for key DON'T CHANGE! </p>
<h2><a class="anchor" id="Constants">
Constants</a></h2>
<p>Constants no need to change them! </p>
 
<p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00069">69</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><!-- doxytag: member="avs_aes.h::KEYWORDS" ref="a40ac9fbe108b0ea74f57215528f13196" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define KEYWORDS&nbsp;&nbsp;&nbsp;8</td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>Keylength 256 Bit AES. </p>
<h2><a class="anchor" id="Configuration">
Configuration</a></h2>
<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#l00053">53</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
 
</div>
</div>
<a class="anchor" id="add31e6954a8ef1d40c63409f686135b9"></a><!-- doxytag: member="avs_aes.h::RESULT_ADDR" ref="add31e6954a8ef1d40c63409f686135b9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RESULT_ADDR&nbsp;&nbsp;&nbsp;AES_BASEADDR+0x10</td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>memory offset of result DON'T CHANGE! </p>
 
<p>Definition at line <a class="el" href="avs__aes_8h_source.html#l00073">73</a> of file <a class="el" href="avs__aes_8h_source.html">avs_aes.h</a>.</p>
 
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="aef16b7ecbb1b091934a9c670ce3b2fcf"></a><!-- doxytag: member="avs_aes.h::avs_aes_decrypt" ref="aef16b7ecbb1b091934a9c670ce3b2fcf" args="(avs_aes_handle *context)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em></td>
          <td>&nbsp;)&nbsp;</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><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
  </table>
  </dd>
</dl>
 
<p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00115">115</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00115"></a>00115                                              {
<a name="l00116"></a>00116     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) |= 0x00000002;
<a name="l00117"></a>00117 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="acea23b2ab998f18b9aca810765632cac"></a><!-- doxytag: member="avs_aes.h::avs_aes_encrypt" ref="acea23b2ab998f18b9aca810765632cac" args="(avs_aes_handle *context)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em></td>
          <td>&nbsp;)&nbsp;</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><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
  </table>
  </dd>
</dl>
 
<p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00106">106</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00106"></a>00106                                              {
<a name="l00107"></a>00107     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) |= 0x00000001;
<a name="l00108"></a>00108 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="a962dd946798faab0e83d401c7d43c33c"></a><!-- doxytag: member="avs_aes.h::avs_aes_init" ref="a962dd946798faab0e83d401c7d43c33c" args="(avs_aes_handle *context)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>setup the context to be used later. </p>
<h2><a class="anchor" id="functions">
functions</a></h2>
<p>initializes the pointers to the correct memory locations </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>: struct grouping address information</td></tr>
  </table>
  </dd>
</dl>
<p>initializes the pointers to the correct memory locations </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>: struct grouping address information </td></tr>
  </table>
  </dd>
</dl>
 
<p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00047">47</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00047"></a>00047                                           {
<a name="l00048"></a>00048     context-&gt;<a class="code" href="structavs__aes__handle.html#acb9eb474c8310afe4b082b79914f274c" title="pointer &amp;quot;KEY&amp;quot; field in memory mapping">key</a>    = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8h.html#ac237029d30090de9c406fd8cf6f9df37" title="memory offset for key DON&amp;#39;T CHANGE!">KEY_ADDR</a>;
<a name="l00049"></a>00049     context-&gt;<a class="code" href="structavs__aes__handle.html#adae23dc33b7dec54b9da34f347256214" title="pointer &amp;quot;data&amp;quot; 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_8h.html#a622ef33a8b85e8a7558ce42e9fc73870" title="memory offset of payload DON&amp;#39;T CHANGE!">DATA_ADDR</a>;
<a name="l00050"></a>00050     context-&gt;<a class="code" href="structavs__aes__handle.html#ae0ad9e7bde68d07c018a299a0cda66af" title="pointer &amp;quot;RESULT&amp;quot; field in memory mapping">result</a> = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*) <a class="code" href="avs__aes_8h.html#add31e6954a8ef1d40c63409f686135b9" title="memory offset of result DON&amp;#39;T CHANGE!">RESULT_ADDR</a>;
<a name="l00051"></a>00051     context-&gt;<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_8h.html#a939a4e25c6ce6c1224b8d923038f6639" title="memory offset for control word DON&amp;#39;T CHANGE!">AESCTRLWD</a>;
<a name="l00052"></a>00052     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) = 0x00000000;
<a name="l00053"></a>00053 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="a827a78f73dd8fef9d2c9e72ad9bb4ea9"></a><!-- doxytag: member="avs_aes.h::avs_aes_isBusy" ref="a827a78f73dd8fef9d2c9e72ad9bb4ea9" args="(avs_aes_handle *context)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em></td>
          <td>&nbsp;)&nbsp;</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><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 if still computing 0 if done. </dd></dl>
 
<p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00125">125</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00125"></a>00125                                            {
<a name="l00126"></a>00126     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mycontrol = *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>);   
<a name="l00127"></a>00127     <span class="keywordflow">return</span> mycontrol &amp; 0x03; 
<a name="l00128"></a>00128 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="af18edc2beecc3842a131423f55c7636a"></a><!-- doxytag: member="avs_aes.h::avs_aes_setKey" ref="af18edc2beecc3842a131423f55c7636a" args="(avs_aes_handle *context, unsigned int *key)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int *&nbsp;</td>
          <td class="paramname"> <em>key</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
 
<p>setup the context to be used later. </p>
<p>initializes the pointers to the correct memory locations </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</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>
 
<p><div class="fragment"><pre class="fragment"><a name="l00062"></a>00062                                                                {
<a name="l00063"></a>00063     <span class="keywordtype">int</span> i=0;
<a name="l00064"></a>00064     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* target_ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* )context-&gt;<a class="code" href="structavs__aes__handle.html#acb9eb474c8310afe4b082b79914f274c" title="pointer &amp;quot;KEY&amp;quot; field in memory mapping">key</a>;
<a name="l00065"></a>00065     <span class="comment">// Invalidate old key;</span>
<a name="l00066"></a>00066     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) &amp;= (~0x00000080);
<a name="l00067"></a>00067     <span class="keywordflow">for</span>(i=0; i&lt;<a class="code" href="avs__aes_8h.html#a40ac9fbe108b0ea74f57215528f13196" title="Keylength 256 Bit AES.">KEYWORDS</a>; i++){
<a name="l00068"></a>00068         *(target_ptr++) = *(key++);
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070     <span class="comment">// validate key;</span>
<a name="l00071"></a>00071     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) |= 0x00000080;
<a name="l00072"></a>00072 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="a55f078baaf019797ab6de7ea1a02475f"></a><!-- doxytag: member="avs_aes.h::avs_aes_setKeyvalid" ref="a55f078baaf019797ab6de7ea1a02475f" args="(avs_aes_handle *context)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em></td>
          <td>&nbsp;)&nbsp;</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><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
  </table>
  </dd>
</dl>
 
<p>Definition at line <a class="el" href="avs__aes_8c_source.html#l00096">96</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00096"></a>00096                                                  {
<a name="l00097"></a>00097     *(context-&gt;<a class="code" href="structavs__aes__handle.html#a15143869a0c8bfcacc8e1839e4e789c9" title="pointer to control word">control</a>) |= 0x00000080;
<a name="l00098"></a>00098 }
</pre></div></p>
 
</div>
</div>
<a class="anchor" id="a22f9afae76f645e31b514b5aa4df2cc1"></a><!-- doxytag: member="avs_aes.h::avs_aes_setPayload" ref="a22f9afae76f645e31b514b5aa4df2cc1" args="(avs_aes_handle *context, unsigned int *payload)" -->
<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> *&nbsp;</td>
          <td class="paramname"> <em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int *&nbsp;</td>
          <td class="paramname"> <em>payload</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <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>
<p>.. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>struct grouping address information </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>payload</em>&nbsp;</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#l00081">81</a> of file <a class="el" href="avs__aes_8c_source.html">avs_aes.c</a>.</p>
 
<p><div class="fragment"><pre class="fragment"><a name="l00081"></a>00081                                                                        {
<a name="l00082"></a>00082     <span class="keywordtype">int</span> i=0;
<a name="l00083"></a>00083     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* target_ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* )context-&gt;<a class="code" href="structavs__aes__handle.html#adae23dc33b7dec54b9da34f347256214" title="pointer &amp;quot;data&amp;quot; field in memory mapping used for both decryption and encryption...">payload</a>;
<a name="l00084"></a>00084     <span class="keywordflow">for</span>(i=0; i&lt;4; i++){
<a name="l00085"></a>00085         *(target_ptr++) = *(payload++);
<a name="l00086"></a>00086     }   
<a name="l00087"></a>00087 }
</pre></div></p>
 
</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Fri Apr 2 23:22:36 2010 for AES Avalon Slave (avs_aes) by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.