1 //***************************************************************************** 2 // 3 // des.h - Defines and Macros for the DES module. 4 // 5 // Copyright (c) 2012-2020 Texas Instruments Incorporated. All rights reserved. 6 // Software License Agreement 7 // 8 // Redistribution and use in source and binary forms, with or without 9 // modification, are permitted provided that the following conditions 10 // are met: 11 // 12 // Redistributions of source code must retain the above copyright 13 // notice, this list of conditions and the following disclaimer. 14 // 15 // Redistributions in binary form must reproduce the above copyright 16 // notice, this list of conditions and the following disclaimer in the 17 // documentation and/or other materials provided with the 18 // distribution. 19 // 20 // Neither the name of Texas Instruments Incorporated nor the names of 21 // its contributors may be used to endorse or promote products derived 22 // from this software without specific prior written permission. 23 // 24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 // 36 // This is part of revision 2.2.0.295 of the Tiva Peripheral Driver Library. 37 // 38 //***************************************************************************** 39 40 #ifndef __DRIVERLIB_DES_H__ 41 #define __DRIVERLIB_DES_H__ 42 43 //***************************************************************************** 44 // 45 // If building with a C++ compiler, make all of the definitions in this header 46 // have a C binding. 47 // 48 //***************************************************************************** 49 #ifdef __cplusplus 50 extern "C" 51 { 52 #endif 53 54 //***************************************************************************** 55 // 56 // The following defines are used to specify the direction with the 57 // ui32Config argument in the DESConfig() function. Only one is permitted. 58 // 59 //***************************************************************************** 60 #define DES_CFG_DIR_DECRYPT 0x00000000 61 #define DES_CFG_DIR_ENCRYPT 0x00000004 62 63 //***************************************************************************** 64 // 65 // The following defines are used to specify the operational with the 66 // ui32Config argument in the DESConfig() function. Only one is permitted. 67 // 68 //***************************************************************************** 69 #define DES_CFG_MODE_ECB 0x00000000 70 #define DES_CFG_MODE_CBC 0x00000010 71 #define DES_CFG_MODE_CFB 0x00000020 72 73 //***************************************************************************** 74 // 75 // The following defines are used to select between single DES and triple DES 76 // with the ui32Config argument in the DESConfig() function. Only one is 77 // permitted. 78 // 79 //***************************************************************************** 80 #define DES_CFG_SINGLE 0x00000000 81 #define DES_CFG_TRIPLE 0x00000008 82 83 //***************************************************************************** 84 // 85 // The following defines are used with the DESIntEnable(), DESIntDisable() and 86 // DESIntStatus() functions. 87 // 88 //***************************************************************************** 89 #define DES_INT_CONTEXT_IN 0x00000001 90 #define DES_INT_DATA_IN 0x00000002 91 #define DES_INT_DATA_OUT 0x00000004 92 #define DES_INT_DMA_CONTEXT_IN 0x00010000 93 #define DES_INT_DMA_DATA_IN 0x00020000 94 #define DES_INT_DMA_DATA_OUT 0x00040000 95 96 //***************************************************************************** 97 // 98 // The following defines are used with the DESEnableDMA() and DESDisableDMA() 99 // functions. 100 // 101 //***************************************************************************** 102 #define DES_DMA_CONTEXT_IN 0x00000080 103 #define DES_DMA_DATA_OUT 0x00000040 104 #define DES_DMA_DATA_IN 0x00000020 105 106 //***************************************************************************** 107 // 108 // API Function prototypes 109 // 110 //***************************************************************************** 111 extern void DESConfigSet(uint32_t ui32Base, uint32_t ui32Config); 112 extern void DESDataRead(uint32_t ui32Base, uint32_t *pui32Dest); 113 extern bool DESDataReadNonBlocking(uint32_t ui32Base, uint32_t *pui32Dest); 114 extern bool DESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, 115 uint32_t *pui32Dest, uint32_t ui32Length); 116 extern void DESDataWrite(uint32_t ui32Base, uint32_t *pui32Src); 117 extern bool DESDataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src); 118 extern void DESDMADisable(uint32_t ui32Base, uint32_t ui32Flags); 119 extern void DESDMAEnable(uint32_t ui32Base, uint32_t ui32Flags); 120 extern void DESIntClear(uint32_t ui32Base, uint32_t ui32IntFlags); 121 extern void DESIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags); 122 extern void DESIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags); 123 extern void DESIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)); 124 extern uint32_t DESIntStatus(uint32_t ui32Base, bool bMasked); 125 extern void DESIntUnregister(uint32_t ui32Base); 126 extern bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata); 127 extern void DESKeySet(uint32_t ui32Base, uint32_t *pui32Key); 128 extern void DESLengthSet(uint32_t ui32Base, uint32_t ui32Length); 129 extern void DESReset(uint32_t ui32Base); 130 131 //***************************************************************************** 132 // 133 // Mark the end of the C bindings section for C++ compilers. 134 // 135 //***************************************************************************** 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif // __DRIVERLIB_DES_H__ 141