des.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // des.h - Defines and Macros for the DES module.
4 //
5 // Copyright (c) 2012-2017 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 //*****************************************************************************
37 
38 #ifndef __DRIVERLIB_DES_H__
39 #define __DRIVERLIB_DES_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 //*****************************************************************************
45 //
46 // If building with a C++ compiler, make all of the definitions in this header
47 // have a C binding.
48 //
49 //*****************************************************************************
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 //*****************************************************************************
56 //
57 // The following defines are used to specify the direction with the
58 // ui32Config argument in the DESConfig() function. Only one is permitted.
59 //
60 //*****************************************************************************
61 #define DES_CFG_DIR_DECRYPT 0x00000000
62 #define DES_CFG_DIR_ENCRYPT 0x00000004
63 
64 //*****************************************************************************
65 //
66 // The following defines are used to specify the operational with the
67 // ui32Config argument in the DESConfig() function. Only one is permitted.
68 //
69 //*****************************************************************************
70 #define DES_CFG_MODE_ECB 0x00000000
71 #define DES_CFG_MODE_CBC 0x00000010
72 #define DES_CFG_MODE_CFB 0x00000020
73 
74 //*****************************************************************************
75 //
76 // The following defines are used to select between single DES and triple DES
77 // with the ui32Config argument in the DESConfig() function. Only one is
78 // permitted.
79 //
80 //*****************************************************************************
81 #define DES_CFG_SINGLE 0x00000000
82 #define DES_CFG_TRIPLE 0x00000008
83 
84 //*****************************************************************************
85 //
86 // The following defines are used with the DESIntEnable(), DESIntDisable() and
87 // DESIntStatus() functions.
88 //
89 //*****************************************************************************
90 #define DES_INT_CONTEXT_IN 0x00000001
91 #define DES_INT_DATA_IN 0x00000002
92 #define DES_INT_DATA_OUT 0x00000004
93 #define DES_INT_DMA_CONTEXT_IN 0x00010000
94 #define DES_INT_DMA_DATA_IN 0x00020000
95 #define DES_INT_DMA_DATA_OUT 0x00040000
96 
97 //*****************************************************************************
98 //
99 // The following defines are used with the DESEnableDMA() and DESDisableDMA()
100 // functions.
101 //
102 //*****************************************************************************
103 #define DES_DMA_CONTEXT_IN 0x00000080
104 #define DES_DMA_DATA_OUT 0x00000040
105 #define DES_DMA_DATA_IN 0x00000020
106 
107 //*****************************************************************************
108 //
109 // API Function prototypes
110 //
111 //*****************************************************************************
112 extern void DESConfigSet(uint32_t ui32Base, uint32_t ui32Config);
113 extern void DESDataRead(uint32_t ui32Base, uint32_t *pui32Dest);
114 extern bool DESDataReadNonBlocking(uint32_t ui32Base, uint32_t *pui32Dest);
115 extern bool DESDataProcess(uint32_t ui32Base, uint32_t *pui32Src,
116  uint32_t *pui32Dest, uint32_t ui32Length);
117 extern void DESDataWrite(uint32_t ui32Base, uint32_t *pui32Src);
118 extern bool DESDataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src);
119 extern void DESDMADisable(uint32_t ui32Base, uint32_t ui32Flags);
120 extern void DESDMAEnable(uint32_t ui32Base, uint32_t ui32Flags);
121 extern void DESIntClear(uint32_t ui32Base, uint32_t ui32IntFlags);
122 extern void DESIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags);
123 extern void DESIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags);
124 extern void DESIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
125 extern uint32_t DESIntStatus(uint32_t ui32Base, bool bMasked);
126 extern void DESIntUnregister(uint32_t ui32Base);
127 extern bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata);
128 extern void DESKeySet(uint32_t ui32Base, uint32_t *pui32Key);
129 extern void DESLengthSet(uint32_t ui32Base, uint32_t ui32Length);
130 extern void DESReset(uint32_t ui32Base);
131 
132 //*****************************************************************************
133 //
134 // Mark the end of the C bindings section for C++ compilers.
135 //
136 //*****************************************************************************
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif // __DRIVERLIB_DES_H__
void DESConfigSet(uint32_t ui32Base, uint32_t ui32Config)
Definition: des.c:122
uint32_t DESIntStatus(uint32_t ui32Base, bool bMasked)
Definition: des.c:510
bool DESDataReadNonBlocking(uint32_t ui32Base, uint32_t *pui32Dest)
Definition: des.c:271
void DESLengthSet(uint32_t ui32Base, uint32_t ui32Length)
Definition: des.c:244
void DESDMADisable(uint32_t ui32Base, uint32_t ui32Flags)
Definition: des.c:783
bool DESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length)
Definition: des.c:435
void DESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Definition: des.c:679
void DESKeySet(uint32_t ui32Base, uint32_t *pui32Key)
Definition: des.c:156
bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
Definition: des.c:199
void DESIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: des.c:556
void DESReset(uint32_t ui32Base)
Definition: des.c:66
void DESDataWrite(uint32_t ui32Base, uint32_t *pui32Src)
Definition: des.c:390
void DESDMAEnable(uint32_t ui32Base, uint32_t ui32Flags)
Definition: des.c:749
void DESIntUnregister(uint32_t ui32Base)
Definition: des.c:713
void DESIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: des.c:640
void DESDataRead(uint32_t ui32Base, uint32_t *pui32Dest)
Definition: des.c:313
void DESIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: des.c:598
bool DESDataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src)
Definition: des.c:348
Copyright 2018, Texas Instruments Incorporated