Line 35... |
Line 35... |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
* THE POSSIBILITY OF SUCH DAMAGE
|
* THE POSSIBILITY OF SUCH DAMAGE
|
*/
|
*/
|
|
|
|
|
#ifndef AVS_AES_H_
|
#ifndef AVS_AES_H_
|
#define AVS_AES_H_
|
#define AVS_AES_H_
|
|
|
/**
|
/**
|
* \section Configuration
|
* \section Configuration
|
Line 58... |
Line 57... |
* base address of the Avalon Slave component in memory map
|
* base address of the Avalon Slave component in memory map
|
*/
|
*/
|
#define AES_BASEADDR 0x40000
|
#define AES_BASEADDR 0x40000
|
#endif /* AES_BASEADDR */
|
#endif /* AES_BASEADDR */
|
|
|
|
|
/**
|
/**
|
* \section Constants
|
* \addtogroup control-register
|
* Constants no need to change them!
|
* Bits in Control Register
|
*/
|
* \see{avs_aes_handle::control}
|
/** memory offset for key DON'T CHANGE! */
|
* \{
|
#define KEY_ADDR AES_BASEADDR+0x00
|
*/
|
/** memory offset of payload DON'T CHANGE!*/
|
|
#define DATA_ADDR AES_BASEADDR+0x08
|
/** Signal load of new key valid \see{avs_aes_handle::control} */
|
/** memory offset of result DON'T CHANGE! */
|
#define KEY_VALID (1 << 7)
|
#define RESULT_ADDR AES_BASEADDR+0x10
|
/** Enable interrupt bit \see{avs_aes_handle::control} */
|
/** memory offset for control word DON'T CHANGE! */
|
#define IRQ_ENA (1 << 6)
|
#define AESCTRLWD AES_BASEADDR+0x18
|
/** Start decryption bit \see{avs_aes_handle::control} */
|
|
#define DECRYPT (1 << 1)
|
|
/** start encryption bit \see{avs_aes_handle::control} */
|
|
#define ENCRYPT (1 << 0)
|
|
|
|
/** \} */
|
|
|
/**
|
/**
|
* \brief object storing addresses for this Avalon AES slave
|
* \brief object storing addresses for this Avalon AES slave
|
* might be useful in case there are more attached, also for convinience
|
* might be useful in case there are more attached, also for convinience
|
*/
|
*/
|
typedef struct{
|
typedef struct{
|
/**
|
/**
|
* \brief pointer "KEY" field in memory mapping
|
* \brief pointer to key field in memory mapping
|
*/
|
*/
|
volatile unsigned int* key;
|
volatile unsigned int* key;
|
/**
|
/**
|
* \brief pointer "data" field in memory mapping
|
* \brief pointer to data field in memory mapping
|
* used for both decryption and encryption
|
* used for both decryption and encryption
|
*/
|
*/
|
volatile unsigned int* payload;
|
volatile unsigned int* payload;
|
/**
|
/**
|
* \brief pointer "RESULT" field in memory mapping
|
* \brief pointer to result field in memory mapping
|
*/
|
*/
|
volatile unsigned int* result;
|
volatile unsigned int* result;
|
/**
|
/**
|
* \brief pointer to control word
|
* \brief pointer to control word
|
*/
|
*/
|
volatile unsigned int* control;
|
volatile unsigned int* control;
|
|
|
} avs_aes_handle;
|
} avs_aes_handle;
|
|
|
/**
|
/**
|
* \section functions
|
* \section functions
|
**/
|
**/
|
|
|
|
|
/**
|
/**
|
* \brief setup the context to be used later.
|
* \brief setup the context to be used later.
|
* initializes the pointers to the correct memory locations
|
* initializes the pointers to the correct memory locations
|
* \param context : struct grouping address information
|
* \param context : struct grouping address information
|
*/
|
*/
|
void avs_aes_init(avs_aes_handle* context);
|
void avs_aes_init(avs_aes_handle* context);
|
|
|
/**
|
/**
|
* \brief setup the context to be used later.
|
* \brief Set a new key
|
* initializes the pointers to the correct memory locations
|
* This call asserts the KEY_VALID flag and triggers the key-expansion in the core
|
* \param context struct grouping address information
|
* \param context struct grouping address information
|
* \param key user key to load
|
* \param key user key to load
|
*/
|
*/
|
void avs_aes_setKey(avs_aes_handle* context, unsigned int* key);
|
void avs_aes_setKey(avs_aes_handle* context, unsigned int* key);
|
|
|
Line 153... |
Line 156... |
* \param context struct grouping address information
|
* \param context struct grouping address information
|
* \return 1 if still computing 0 if done.
|
* \return 1 if still computing 0 if done.
|
*/
|
*/
|
int avs_aes_isBusy(avs_aes_handle* context);
|
int avs_aes_isBusy(avs_aes_handle* context);
|
|
|
|
|
#endif /*AVS_AES_H_*/
|
#endif /*AVS_AES_H_*/
|
|
|
No newline at end of file
|
No newline at end of file
|