SAMV71 Xplained Ultra Software Package 1.4

icm.h

00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2013, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 #ifndef _ICM_
00031 #define _ICM_
00032 
00033 /*------------------------------------------------------------------------------
00034  *         Headers
00035  *------------------------------------------------------------------------------*/
00036 
00037 #include "chip.h"
00038 
00039 
00040 /*------------------------------------------------------------------------------*/
00041 /*         Definition                                                           */
00042 /*------------------------------------------------------------------------------*/
00043 #define ICM_RCFG_CDWBN (0x1u << 0) 
00044 /**< \brief (ICM_RCFG) Compare Digest or Write Back Digest */
00045 #define ICM_RCFG_WRAP (0x1u << 1) 
00046 /**< \brief (ICM_RCFG) Wrap Command */
00047 #define ICM_RCFG_EOM (0x1u << 2) 
00048 /**< \brief (ICM_RCFG) End Of Monitoring */
00049 #define ICM_RCFG_RHIEN (0x1u << 4) 
00050 /**< \brief (ICM_RCFG) Region Hash Completed interrupt enable */
00051 #define ICM_RCFG_DMIEN (0x1u << 5) 
00052 /**< \brief (ICM_RCFG) Digest Mismatch interrupt enable */
00053 #define ICM_RCFG_BEIEN (0x1u << 6) 
00054 /**< \brief (ICM_RCFG) Bus error interrupt enable  */
00055 #define ICM_RCFG_WCIEN (0x1u << 7) 
00056 /**< \brief (ICM_RCFG) Warp condition interrupt enable  */
00057 #define ICM_RCFG_ECIEN (0x1u << 8) 
00058 /**< \brief (ICM_RCFG) End bit condition interrupt enable  */
00059 #define ICM_RCFG_SUIEN (0x1u << 9) 
00060 /**< \brief (ICM_RCFG) Monitoring Status Updated Condition Interrupt Enable  */
00061 #define ICM_RCFG_PROCDLY (0x1u << 10) 
00062 /**< \brief (ICM_RCFG) Processing Delay*/
00063 #define ICM_RCFG_UALGO_Pos 12
00064 #define ICM_RCFG_UALGO_Msk (0x7u << ICM_RCFG_UALGO_Pos) 
00065 /**< \brief (ICM_RCFG) User SHA Algorithm */
00066 #define   ICM_RCFG_ALGO_SHA1 (0x0u << 12) 
00067 /**< \brief (ICM_RCFG) SHA1 algorithm processed */
00068 #define   ICM_RCFG_ALGO_SHA256 (0x1u << 12) 
00069 /**< \brief (ICM_RCFG) SHA256 algorithm processed */
00070 #define   ICM_RCFG_ALGO_SHA224 (0x4u << 12) 
00071 /**< \brief (ICM_RCFG) SHA224 algorithm processed */
00072 #define ICM_RCFG_MRPROT_Pos 24
00073 #define ICM_RCFG_MRPROT_Msk (0x3fu << ICM_RCFG_MRPROT_Pos) 
00074 /**< \brief (ICM_RCFG) Memory Region AHB Protection */
00075 #define ICM_RCFG_MRPROT(value) \
00076     ((ICM_RCFG_MRPROT_Msk & ((value) << ICM_RCFG_MRPROT_Pos)))
00077 
00078 /*----------------------------------------------------------------------------*/
00079 /*         Type                                                               */
00080 /*----------------------------------------------------------------------------*/
00081 
00082 /** \brief Structure ICM region descriptor area. */
00083 typedef struct _LinkedListDescriporIcmRegion
00084 {
00085     /** the first byte address of the Region. */
00086     uint32_t icm_raddr;
00087     /** Configuration Structure Member. */
00088     uint32_t icm_rcfg;
00089     /** Control Structure Member. */
00090     uint32_t icm_rctrl;
00091     /** Next Address Structure Member. */
00092     uint32_t icm_rnext;
00093 }LinkedListDescriporIcmRegion;
00094 
00095 /*----------------------------------------------------------------------------*/
00096 /*         Exported functions                                                 */
00097 /*----------------------------------------------------------------------------*/
00098 extern void ICM_Enable(void);
00099 extern void ICM_Disable(void);
00100 extern void ICM_SoftReset(void);
00101 extern void ICM_ReComputeHash(uint8_t region);
00102 extern void ICM_EnableMonitor(uint8_t region);
00103 extern void ICM_DisableMonitor(uint8_t region);
00104 extern void ICM_Configure(uint32_t mode);
00105 extern void ICM_EnableIt(uint32_t sources);
00106 extern void ICM_DisableIt(uint32_t sources);
00107 extern uint32_t ICM_GetIntStatus(void);
00108 extern uint32_t ICM_GetStatus(void);
00109 extern uint32_t ICM_GetUStatus(void);
00110 extern void ICM_SetDescStartAddress(uint32_t addr);
00111 extern void ICM_SetHashStartAddress(uint32_t addr);
00112 extern void ICM_SetInitHashValue(uint32_t val);
00113 #endif /* #ifndef _ICM_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines