00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 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 /** the first byte address of the Region. */ 00085 uint32_t icm_raddr; 00086 /** Configuration Structure Member. */ 00087 uint32_t icm_rcfg; 00088 /** Control Structure Member. */ 00089 uint32_t icm_rctrl; 00090 /** Next Address Structure Member. */ 00091 uint32_t icm_rnext; 00092 } LinkedListDescriporIcmRegion; 00093 00094 /*----------------------------------------------------------------------------*/ 00095 /* Exported functions */ 00096 /*----------------------------------------------------------------------------*/ 00097 extern void ICM_Enable(void); 00098 extern void ICM_Disable(void); 00099 extern void ICM_SoftReset(void); 00100 extern void ICM_ReComputeHash(uint8_t region); 00101 extern void ICM_EnableMonitor(uint8_t region); 00102 extern void ICM_DisableMonitor(uint8_t region); 00103 extern void ICM_Configure(uint32_t mode); 00104 extern void ICM_EnableIt(uint32_t sources); 00105 extern void ICM_DisableIt(uint32_t sources); 00106 extern uint32_t ICM_GetIntStatus(void); 00107 extern uint32_t ICM_GetStatus(void); 00108 extern uint32_t ICM_GetUStatus(void); 00109 extern void ICM_SetDescStartAddress(uint32_t addr); 00110 extern void ICM_SetHashStartAddress(uint32_t addr); 00111 extern void ICM_SetInitHashValue(uint32_t val); 00112 #endif /* #ifndef _ICM_ */