des.h 6.1 KB

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