1
0

hw_des.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. //*****************************************************************************
  2. //
  3. // hw_des.h - Macros used when accessing the DES hardware.
  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 Firmware Development Package.
  37. //
  38. //*****************************************************************************
  39. #ifndef __HW_DES_H__
  40. #define __HW_DES_H__
  41. //*****************************************************************************
  42. //
  43. // The following are defines for the DES register offsets.
  44. //
  45. //*****************************************************************************
  46. #define DES_O_KEY3_L 0x00000000 // DES Key 3 LSW for 192-Bit Key
  47. #define DES_O_KEY3_H 0x00000004 // DES Key 3 MSW for 192-Bit Key
  48. #define DES_O_KEY2_L 0x00000008 // DES Key 2 LSW for 128-Bit Key
  49. #define DES_O_KEY2_H 0x0000000C // DES Key 2 MSW for 128-Bit Key
  50. #define DES_O_KEY1_L 0x00000010 // DES Key 1 LSW for 64-Bit Key
  51. #define DES_O_KEY1_H 0x00000014 // DES Key 1 MSW for 64-Bit Key
  52. #define DES_O_IV_L 0x00000018 // DES Initialization Vector
  53. #define DES_O_IV_H 0x0000001C // DES Initialization Vector
  54. #define DES_O_CTRL 0x00000020 // DES Control
  55. #define DES_O_LENGTH 0x00000024 // DES Cryptographic Data Length
  56. #define DES_O_DATA_L 0x00000028 // DES LSW Data RW
  57. #define DES_O_DATA_H 0x0000002C // DES MSW Data RW
  58. #define DES_O_REVISION 0x00000030 // DES Revision Number
  59. #define DES_O_SYSCONFIG 0x00000034 // DES System Configuration
  60. #define DES_O_SYSSTATUS 0x00000038 // DES System Status
  61. #define DES_O_IRQSTATUS 0x0000003C // DES Interrupt Status
  62. #define DES_O_IRQENABLE 0x00000040 // DES Interrupt Enable
  63. #define DES_O_DIRTYBITS 0x00000044 // DES Dirty Bits
  64. #define DES_O_DMAIM 0xFFFF8030 // DES DMA Interrupt Mask
  65. #define DES_O_DMARIS 0xFFFF8034 // DES DMA Raw Interrupt Status
  66. #define DES_O_DMAMIS 0xFFFF8038 // DES DMA Masked Interrupt Status
  67. #define DES_O_DMAIC 0xFFFF803C // DES DMA Interrupt Clear
  68. //*****************************************************************************
  69. //
  70. // The following are defines for the bit fields in the DES_O_KEY3_L register.
  71. //
  72. //*****************************************************************************
  73. #define DES_KEY3_L_KEY_M 0xFFFFFFFF // Key Data
  74. #define DES_KEY3_L_KEY_S 0
  75. //*****************************************************************************
  76. //
  77. // The following are defines for the bit fields in the DES_O_KEY3_H register.
  78. //
  79. //*****************************************************************************
  80. #define DES_KEY3_H_KEY_M 0xFFFFFFFF // Key Data
  81. #define DES_KEY3_H_KEY_S 0
  82. //*****************************************************************************
  83. //
  84. // The following are defines for the bit fields in the DES_O_KEY2_L register.
  85. //
  86. //*****************************************************************************
  87. #define DES_KEY2_L_KEY_M 0xFFFFFFFF // Key Data
  88. #define DES_KEY2_L_KEY_S 0
  89. //*****************************************************************************
  90. //
  91. // The following are defines for the bit fields in the DES_O_KEY2_H register.
  92. //
  93. //*****************************************************************************
  94. #define DES_KEY2_H_KEY_M 0xFFFFFFFF // Key Data
  95. #define DES_KEY2_H_KEY_S 0
  96. //*****************************************************************************
  97. //
  98. // The following are defines for the bit fields in the DES_O_KEY1_L register.
  99. //
  100. //*****************************************************************************
  101. #define DES_KEY1_L_KEY_M 0xFFFFFFFF // Key Data
  102. #define DES_KEY1_L_KEY_S 0
  103. //*****************************************************************************
  104. //
  105. // The following are defines for the bit fields in the DES_O_KEY1_H register.
  106. //
  107. //*****************************************************************************
  108. #define DES_KEY1_H_KEY_M 0xFFFFFFFF // Key Data
  109. #define DES_KEY1_H_KEY_S 0
  110. //*****************************************************************************
  111. //
  112. // The following are defines for the bit fields in the DES_O_IV_L register.
  113. //
  114. //*****************************************************************************
  115. #define DES_IV_L_M 0xFFFFFFFF // Initialization vector for CBC,
  116. // CFB modes (LSW)
  117. #define DES_IV_L_S 0
  118. //*****************************************************************************
  119. //
  120. // The following are defines for the bit fields in the DES_O_IV_H register.
  121. //
  122. //*****************************************************************************
  123. #define DES_IV_H_M 0xFFFFFFFF // Initialization vector for CBC,
  124. // CFB modes (MSW)
  125. #define DES_IV_H_S 0
  126. //*****************************************************************************
  127. //
  128. // The following are defines for the bit fields in the DES_O_CTRL register.
  129. //
  130. //*****************************************************************************
  131. #define DES_CTRL_CONTEXT 0x80000000 // If 1, this read-only status bit
  132. // indicates that the context data
  133. // registers can be overwritten and
  134. // the host is permitted to write
  135. // the next context
  136. #define DES_CTRL_MODE_M 0x00000030 // Select CBC, ECB or CFB mode0x0:
  137. // ECB mode0x1: CBC mode0x2: CFB
  138. // mode0x3: reserved
  139. #define DES_CTRL_TDES 0x00000008 // Select DES or triple DES
  140. // encryption/decryption
  141. #define DES_CTRL_DIRECTION 0x00000004 // Select encryption/decryption
  142. // 0x0: decryption is selected0x1:
  143. // Encryption is selected
  144. #define DES_CTRL_INPUT_READY 0x00000002 // When 1, ready to encrypt/decrypt
  145. // data
  146. #define DES_CTRL_OUTPUT_READY 0x00000001 // When 1, Data decrypted/encrypted
  147. // ready
  148. #define DES_CTRL_MODE_S 4
  149. //*****************************************************************************
  150. //
  151. // The following are defines for the bit fields in the DES_O_LENGTH register.
  152. //
  153. //*****************************************************************************
  154. #define DES_LENGTH_M 0xFFFFFFFF // Cryptographic data length in
  155. // bytes for all modes
  156. #define DES_LENGTH_S 0
  157. //*****************************************************************************
  158. //
  159. // The following are defines for the bit fields in the DES_O_DATA_L register.
  160. //
  161. //*****************************************************************************
  162. #define DES_DATA_L_M 0xFFFFFFFF // Data for encryption/decryption,
  163. // LSW
  164. #define DES_DATA_L_S 0
  165. //*****************************************************************************
  166. //
  167. // The following are defines for the bit fields in the DES_O_DATA_H register.
  168. //
  169. //*****************************************************************************
  170. #define DES_DATA_H_M 0xFFFFFFFF // Data for encryption/decryption,
  171. // MSW
  172. #define DES_DATA_H_S 0
  173. //*****************************************************************************
  174. //
  175. // The following are defines for the bit fields in the DES_O_REVISION register.
  176. //
  177. //*****************************************************************************
  178. #define DES_REVISION_M 0xFFFFFFFF // Revision number
  179. #define DES_REVISION_S 0
  180. //*****************************************************************************
  181. //
  182. // The following are defines for the bit fields in the DES_O_SYSCONFIG
  183. // register.
  184. //
  185. //*****************************************************************************
  186. #define DES_SYSCONFIG_DMA_REQ_CONTEXT_IN_EN \
  187. 0x00000080 // DMA Request Context In Enable
  188. #define DES_SYSCONFIG_DMA_REQ_DATA_OUT_EN \
  189. 0x00000040 // DMA Request Data Out Enable
  190. #define DES_SYSCONFIG_DMA_REQ_DATA_IN_EN \
  191. 0x00000020 // DMA Request Data In Enable
  192. #define DES_SYSCONFIG_SIDLE_M 0x0000000C // Sidle mode
  193. #define DES_SYSCONFIG_SIDLE_FORCE \
  194. 0x00000000 // Force-idle mode
  195. #define DES_SYSCONFIG_SOFTRESET 0x00000002 // Soft reset
  196. //*****************************************************************************
  197. //
  198. // The following are defines for the bit fields in the DES_O_SYSSTATUS
  199. // register.
  200. //
  201. //*****************************************************************************
  202. #define DES_SYSSTATUS_RESETDONE 0x00000001 // Reset Done
  203. //*****************************************************************************
  204. //
  205. // The following are defines for the bit fields in the DES_O_IRQSTATUS
  206. // register.
  207. //
  208. //*****************************************************************************
  209. #define DES_IRQSTATUS_DATA_OUT 0x00000004 // This bit indicates data output
  210. // interrupt is active and triggers
  211. // the interrupt output
  212. #define DES_IRQSTATUS_DATA_IN 0x00000002 // This bit indicates data input
  213. // interrupt is active and triggers
  214. // the interrupt output
  215. #define DES_IRQSTATUS_CONTEX_IN 0x00000001 // This bit indicates context
  216. // interrupt is active and triggers
  217. // the interrupt output
  218. //*****************************************************************************
  219. //
  220. // The following are defines for the bit fields in the DES_O_IRQENABLE
  221. // register.
  222. //
  223. //*****************************************************************************
  224. #define DES_IRQENABLE_M_DATA_OUT \
  225. 0x00000004 // If this bit is set to 1 the data
  226. // output interrupt is enabled
  227. #define DES_IRQENABLE_M_DATA_IN 0x00000002 // If this bit is set to 1 the data
  228. // input interrupt is enabled
  229. #define DES_IRQENABLE_M_CONTEX_IN \
  230. 0x00000001 // If this bit is set to 1 the
  231. // context interrupt is enabled
  232. //*****************************************************************************
  233. //
  234. // The following are defines for the bit fields in the DES_O_DIRTYBITS
  235. // register.
  236. //
  237. //*****************************************************************************
  238. #define DES_DIRTYBITS_S_DIRTY 0x00000002 // This bit is set to 1 by the
  239. // module if any of the DES_*
  240. // registers is written
  241. #define DES_DIRTYBITS_S_ACCESS 0x00000001 // This bit is set to 1 by the
  242. // module if any of the DES_*
  243. // registers is read
  244. //*****************************************************************************
  245. //
  246. // The following are defines for the bit fields in the DES_O_DMAIM register.
  247. //
  248. //*****************************************************************************
  249. #define DES_DMAIM_DOUT 0x00000004 // Data Out DMA Done Interrupt Mask
  250. #define DES_DMAIM_DIN 0x00000002 // Data In DMA Done Interrupt Mask
  251. #define DES_DMAIM_CIN 0x00000001 // Context In DMA Done Interrupt
  252. // Mask
  253. //*****************************************************************************
  254. //
  255. // The following are defines for the bit fields in the DES_O_DMARIS register.
  256. //
  257. //*****************************************************************************
  258. #define DES_DMARIS_DOUT 0x00000004 // Data Out DMA Done Raw Interrupt
  259. // Status
  260. #define DES_DMARIS_DIN 0x00000002 // Data In DMA Done Raw Interrupt
  261. // Status
  262. #define DES_DMARIS_CIN 0x00000001 // Context In DMA Done Raw
  263. // Interrupt Status
  264. //*****************************************************************************
  265. //
  266. // The following are defines for the bit fields in the DES_O_DMAMIS register.
  267. //
  268. //*****************************************************************************
  269. #define DES_DMAMIS_DOUT 0x00000004 // Data Out DMA Done Masked
  270. // Interrupt Status
  271. #define DES_DMAMIS_DIN 0x00000002 // Data In DMA Done Masked
  272. // Interrupt Status
  273. #define DES_DMAMIS_CIN 0x00000001 // Context In DMA Done Raw
  274. // Interrupt Status
  275. //*****************************************************************************
  276. //
  277. // The following are defines for the bit fields in the DES_O_DMAIC register.
  278. //
  279. //*****************************************************************************
  280. #define DES_DMAIC_DOUT 0x00000004 // Data Out DMA Done Interrupt
  281. // Clear
  282. #define DES_DMAIC_DIN 0x00000002 // Data In DMA Done Interrupt Clear
  283. #define DES_DMAIC_CIN 0x00000001 // Context In DMA Done Raw
  284. // Interrupt Status
  285. #endif // __HW_DES_H__