hw_dthe.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. //*****************************************************************************
  2. //
  3. // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  4. //
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions
  8. // are met:
  9. //
  10. // Redistributions of source code must retain the above copyright
  11. // notice, this list of conditions and the following disclaimer.
  12. //
  13. // Redistributions in binary form must reproduce the above copyright
  14. // notice, this list of conditions and the following disclaimer in the
  15. // documentation and/or other materials provided with the
  16. // distribution.
  17. //
  18. // Neither the name of Texas Instruments Incorporated nor the names of
  19. // its contributors may be used to endorse or promote products derived
  20. // from this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. //
  34. //*****************************************************************************
  35. //*****************************************************************************
  36. #ifndef __HW_DTHE_H__
  37. #define __HW_DTHE_H__
  38. //*****************************************************************************
  39. //
  40. // The following are defines for the DTHE register offsets.
  41. //
  42. //*****************************************************************************
  43. #define DTHE_O_SHA_IM 0x00000810
  44. #define DTHE_O_SHA_RIS 0x00000814
  45. #define DTHE_O_SHA_MIS 0x00000818
  46. #define DTHE_O_SHA_IC 0x0000081C
  47. #define DTHE_O_AES_IM 0x00000820
  48. #define DTHE_O_AES_RIS 0x00000824
  49. #define DTHE_O_AES_MIS 0x00000828
  50. #define DTHE_O_AES_IC 0x0000082C
  51. #define DTHE_O_DES_IM 0x00000830
  52. #define DTHE_O_DES_RIS 0x00000834
  53. #define DTHE_O_DES_MIS 0x00000838
  54. #define DTHE_O_DES_IC 0x0000083C
  55. #define DTHE_O_EIP_CGCFG 0x00000A00
  56. #define DTHE_O_EIP_CGREQ 0x00000A04
  57. #define DTHE_O_CRC_CTRL 0x00000C00
  58. #define DTHE_O_CRC_SEED 0x00000C10
  59. #define DTHE_O_CRC_DIN 0x00000C14
  60. #define DTHE_O_CRC_RSLT_PP 0x00000C18
  61. #define DTHE_O_RAND_KEY0 0x00000F00
  62. #define DTHE_O_RAND_KEY1 0x00000F04
  63. #define DTHE_O_RAND_KEY2 0x00000F08
  64. #define DTHE_O_RAND_KEY3 0x00000F0C
  65. //******************************************************************************
  66. //
  67. // The following are defines for the bit fields in the
  68. // DTHE_O_SHAMD5_IMST register.
  69. //
  70. //******************************************************************************
  71. #define DTHE_SHAMD5_IMST_DIN 0x00000004 // Data in: this interrupt is
  72. // raised when DMA writes last word
  73. // of input data to internal FIFO of
  74. // the engine
  75. #define DTHE_SHAMD5_IMST_COUT 0x00000002 // Context out: this interrupt is
  76. // raised when DMA complets the
  77. // output context movement from
  78. // internal register
  79. #define DTHE_SHAMD5_IMST_CIN 0x00000001 // context in: this interrupt is
  80. // raised when DMA complets Context
  81. // write to internal register
  82. //******************************************************************************
  83. //
  84. // The following are defines for the bit fields in the
  85. // DTHE_O_SHAMD5_IRIS register.
  86. //
  87. //******************************************************************************
  88. #define DTHE_SHAMD5_IRIS_DIN 0x00000004 // input Data movement is done
  89. #define DTHE_SHAMD5_IRIS_COUT 0x00000002 // Context output is done
  90. #define DTHE_SHAMD5_IRIS_CIN 0x00000001 // context input is done
  91. //******************************************************************************
  92. //
  93. // The following are defines for the bit fields in the
  94. // DTHE_O_SHAMD5_IMIS register.
  95. //
  96. //******************************************************************************
  97. #define DTHE_SHAMD5_IMIS_DIN 0x00000004 // input Data movement is done
  98. #define DTHE_SHAMD5_IMIS_COUT 0x00000002 // Context output is done
  99. #define DTHE_SHAMD5_IMIS_CIN 0x00000001 // context input is done
  100. //******************************************************************************
  101. //
  102. // The following are defines for the bit fields in the
  103. // DTHE_O_SHAMD5_ICIS register.
  104. //
  105. //******************************************************************************
  106. #define DTHE_SHAMD5_ICIS_DIN 0x00000004 // Clear “input Data movement done”
  107. // flag
  108. #define DTHE_SHAMD5_ICIS_COUT 0x00000002 // Clear “Context output done” flag
  109. #define DTHE_SHAMD5_ICIS_CIN 0x00000001 // Clear “context input done” flag
  110. //******************************************************************************
  111. //
  112. // The following are defines for the bit fields in the
  113. // DTHE_O_AES_IMST register.
  114. //
  115. //******************************************************************************
  116. #define DTHE_AES_IMST_DOUT 0x00000008 // Data out: this interrupt is
  117. // raised when DMA finishes writing
  118. // last word of the process result
  119. #define DTHE_AES_IMST_DIN 0x00000004 // Data in: this interrupt is
  120. // raised when DMA writes last word
  121. // of input data to internal FIFO of
  122. // the engine
  123. #define DTHE_AES_IMST_COUT 0x00000002 // Context out: this interrupt is
  124. // raised when DMA complets the
  125. // output context movement from
  126. // internal register
  127. #define DTHE_AES_IMST_CIN 0x00000001 // context in: this interrupt is
  128. // raised when DMA complets Context
  129. // write to internal register
  130. //******************************************************************************
  131. //
  132. // The following are defines for the bit fields in the
  133. // DTHE_O_AES_IRIS register.
  134. //
  135. //******************************************************************************
  136. #define DTHE_AES_IRIS_DOUT 0x00000008 // Output Data movement is done
  137. #define DTHE_AES_IRIS_DIN 0x00000004 // input Data movement is done
  138. #define DTHE_AES_IRIS_COUT 0x00000002 // Context output is done
  139. #define DTHE_AES_IRIS_CIN 0x00000001 // context input is done
  140. //******************************************************************************
  141. //
  142. // The following are defines for the bit fields in the
  143. // DTHE_O_AES_IMIS register.
  144. //
  145. //******************************************************************************
  146. #define DTHE_AES_IMIS_DOUT 0x00000008 // Output Data movement is done
  147. #define DTHE_AES_IMIS_DIN 0x00000004 // input Data movement is done
  148. #define DTHE_AES_IMIS_COUT 0x00000002 // Context output is done
  149. #define DTHE_AES_IMIS_CIN 0x00000001 // context input is done
  150. //******************************************************************************
  151. //
  152. // The following are defines for the bit fields in the
  153. // DTHE_O_AES_ICIS register.
  154. //
  155. //******************************************************************************
  156. #define DTHE_AES_ICIS_DOUT 0x00000008 // Clear “output Data movement
  157. // done” flag
  158. #define DTHE_AES_ICIS_DIN 0x00000004 // Clear “input Data movement done”
  159. // flag
  160. #define DTHE_AES_ICIS_COUT 0x00000002 // Clear “Context output done” flag
  161. #define DTHE_AES_ICIS_CIN 0x00000001 // Clear “context input done” flag
  162. //******************************************************************************
  163. //
  164. // The following are defines for the bit fields in the
  165. // DTHE_O_DES_IMST register.
  166. //
  167. //******************************************************************************
  168. #define DTHE_DES_IMST_DOUT 0x00000008 // Data out: this interrupt is
  169. // raised when DMA finishes writing
  170. // last word of the process result
  171. #define DTHE_DES_IMST_DIN 0x00000004 // Data in: this interrupt is
  172. // raised when DMA writes last word
  173. // of input data to internal FIFO of
  174. // the engine
  175. #define DTHE_DES_IMST_CIN 0x00000001 // context in: this interrupt is
  176. // raised when DMA complets Context
  177. // write to internal register
  178. //******************************************************************************
  179. //
  180. // The following are defines for the bit fields in the
  181. // DTHE_O_DES_IRIS register.
  182. //
  183. //******************************************************************************
  184. #define DTHE_DES_IRIS_DOUT 0x00000008 // Output Data movement is done
  185. #define DTHE_DES_IRIS_DIN 0x00000004 // input Data movement is done
  186. #define DTHE_DES_IRIS_CIN 0x00000001 // context input is done
  187. //******************************************************************************
  188. //
  189. // The following are defines for the bit fields in the
  190. // DTHE_O_DES_IMIS register.
  191. //
  192. //******************************************************************************
  193. #define DTHE_DES_IMIS_DOUT 0x00000008 // Output Data movement is done
  194. #define DTHE_DES_IMIS_DIN 0x00000004 // input Data movement is done
  195. #define DTHE_DES_IMIS_CIN 0x00000001 // context input is done
  196. //******************************************************************************
  197. //
  198. // The following are defines for the bit fields in the
  199. // DTHE_O_DES_ICIS register.
  200. //
  201. //******************************************************************************
  202. #define DTHE_DES_ICIS_DOUT 0x00000008 // Clear “output Data movement
  203. // done” flag
  204. #define DTHE_DES_ICIS_DIN 0x00000004 // Clear “input Data movement done”
  205. // flag
  206. #define DTHE_DES_ICIS_CIN 0x00000001 // Clear "context input done” flag
  207. //******************************************************************************
  208. //
  209. // The following are defines for the bit fields in the
  210. // DTHE_O_EIP_CGCFG register.
  211. //
  212. //******************************************************************************
  213. #define DTHE_EIP_CGCFG_EIP29_CFG \
  214. 0x00000010 // Clock gating protocol setting
  215. // for EIP29T. 0 – Follow direct
  216. // protocol 1 – Follow idle_req/ack
  217. // protocol.
  218. #define DTHE_EIP_CGCFG_EIP75_CFG \
  219. 0x00000008 // Clock gating protocol setting
  220. // for EIP75T. 0 – Follow direct
  221. // protocol 1 – Follow idle_req/ack
  222. // protocol.
  223. #define DTHE_EIP_CGCFG_EIP16_CFG \
  224. 0x00000004 // Clock gating protocol setting
  225. // for DES. 0 – Follow direct
  226. // protocol 1 – Follow idle_req/ack
  227. // protocol.
  228. #define DTHE_EIP_CGCFG_EIP36_CFG \
  229. 0x00000002 // Clock gating protocol setting
  230. // for AES. 0 – Follow direct
  231. // protocol 1 – Follow idle_req/ack
  232. // protocol.
  233. #define DTHE_EIP_CGCFG_EIP57_CFG \
  234. 0x00000001 // Clock gating protocol setting
  235. // for SHAMD5. 0 – Follow direct
  236. // protocol 1 – Follow idle_req/ack
  237. // protocol.
  238. //******************************************************************************
  239. //
  240. // The following are defines for the bit fields in the
  241. // DTHE_O_EIP_CGREQ register.
  242. //
  243. //******************************************************************************
  244. #define DTHE_EIP_CGREQ_Key_M 0xF0000000 // When “0x5” write “1” to lower
  245. // bits [4:0] will set the bit.
  246. // Write “0” will be ignored When
  247. // “0x2” write “1” to lower bit
  248. // [4:0] will clear the bit. Write
  249. // “0” will be ignored for other key
  250. // value, regular read write
  251. // operation
  252. #define DTHE_EIP_CGREQ_Key_S 28
  253. #define DTHE_EIP_CGREQ_EIP29_REQ \
  254. 0x00000010 // 0 – request clock gating 1 –
  255. // request to un-gate the clock.
  256. #define DTHE_EIP_CGREQ_EIP75_REQ \
  257. 0x00000008 // 0 – request clock gating 1 –
  258. // request to un-gate the clock.
  259. #define DTHE_EIP_CGREQ_EIP16_REQ \
  260. 0x00000004 // 0 – request clock gating 1 –
  261. // request to un-gate the clock.
  262. #define DTHE_EIP_CGREQ_EIP36_REQ \
  263. 0x00000002 // 0 – request clock gating 1 –
  264. // request to un-gate the clock.
  265. #define DTHE_EIP_CGREQ_EIP57_REQ \
  266. 0x00000001 // 0 – request clock gating 1 –
  267. // request to un-gate the clock.
  268. //******************************************************************************
  269. //
  270. // The following are defines for the bit fields in the DTHE_O_CRC_CTRL register.
  271. //
  272. //******************************************************************************
  273. #define DTHE_CRC_CTRL_INIT_M 0x00006000 // Initialize the CRC 00 – use SEED
  274. // register context as starting
  275. // value 10 – all “zero” 11 – all
  276. // “one” This is self clearing. With
  277. // first write to data register this
  278. // value clears to zero and remain
  279. // zero for rest of the operation
  280. // unless written again
  281. #define DTHE_CRC_CTRL_INIT_S 13
  282. #define DTHE_CRC_CTRL_SIZE 0x00001000 // Input data size 0 – 32 bit 1 – 8
  283. // bit
  284. #define DTHE_CRC_CTRL_OINV 0x00000200 // Inverse the bits of result
  285. // before storing to CRC_RSLT_PP0
  286. #define DTHE_CRC_CTRL_OBR 0x00000100 // Bit reverse the output result
  287. // byte before storing to
  288. // CRC_RSLT_PP0. applicable for all
  289. // bytes in word
  290. #define DTHE_CRC_CTRL_IBR 0x00000080 // Bit reverse the input byte. For
  291. // all bytes in word
  292. #define DTHE_CRC_CTRL_ENDIAN_M \
  293. 0x00000030 // Endian control [0] – swap byte
  294. // in half-word [1] – swap half word
  295. #define DTHE_CRC_CTRL_ENDIAN_S 4
  296. #define DTHE_CRC_CTRL_TYPE_M 0x0000000F // Type of operation 0000 –
  297. // polynomial 0x8005 0001 –
  298. // polynomial 0x1021 0010 –
  299. // polynomial 0x4C11DB7 0011 –
  300. // polynomial 0x1EDC6F41 1000 – TCP
  301. // checksum TYPE in DTHE_S_CRC_CTRL
  302. // & DTHE_S_CRC_CTRL should be
  303. // exclusive
  304. #define DTHE_CRC_CTRL_TYPE_S 0
  305. //******************************************************************************
  306. //
  307. // The following are defines for the bit fields in the DTHE_O_CRC_SEED register.
  308. //
  309. //******************************************************************************
  310. #define DTHE_CRC_SEED_SEED_M 0xFFFFFFFF // Starting seed of CRC and
  311. // checksum operation. Please see
  312. // CTRL register for more detail.
  313. // This resister also holds the
  314. // latest result of CRC or checksum
  315. // operation
  316. #define DTHE_CRC_SEED_SEED_S 0
  317. //******************************************************************************
  318. //
  319. // The following are defines for the bit fields in the DTHE_O_CRC_DIN register.
  320. //
  321. //******************************************************************************
  322. #define DTHE_CRC_DIN_DATA_IN_M \
  323. 0xFFFFFFFF // Input data for CRC or checksum
  324. // operation
  325. #define DTHE_CRC_DIN_DATA_IN_S 0
  326. //******************************************************************************
  327. //
  328. // The following are defines for the bit fields in the
  329. // DTHE_O_CRC_RSLT_PP register.
  330. //
  331. //******************************************************************************
  332. #define DTHE_CRC_RSLT_PP_RSLT_PP_M \
  333. 0xFFFFFFFF // Input data for CRC or checksum
  334. // operation
  335. #define DTHE_CRC_RSLT_PP_RSLT_PP_S 0
  336. //******************************************************************************
  337. //
  338. // The following are defines for the bit fields in the
  339. // DTHE_O_RAND_KEY0 register.
  340. //
  341. //******************************************************************************
  342. #define DTHE_RAND_KEY0_KEY_M 0xFFFFFFFF // Device Specific Randon key
  343. // [31:0]
  344. #define DTHE_RAND_KEY0_KEY_S 0
  345. //******************************************************************************
  346. //
  347. // The following are defines for the bit fields in the
  348. // DTHE_O_RAND_KEY1 register.
  349. //
  350. //******************************************************************************
  351. #define DTHE_RAND_KEY1_KEY_M 0xFFFFFFFF // Device Specific Randon key
  352. // [63:32]
  353. #define DTHE_RAND_KEY1_KEY_S 0
  354. //******************************************************************************
  355. //
  356. // The following are defines for the bit fields in the
  357. // DTHE_O_RAND_KEY2 register.
  358. //
  359. //******************************************************************************
  360. #define DTHE_RAND_KEY2_KEY_M 0xFFFFFFFF // Device Specific Randon key
  361. // [95:34]
  362. #define DTHE_RAND_KEY2_KEY_S 0
  363. //******************************************************************************
  364. //
  365. // The following are defines for the bit fields in the
  366. // DTHE_O_RAND_KEY3 register.
  367. //
  368. //******************************************************************************
  369. #define DTHE_RAND_KEY3_KEY_M 0xFFFFFFFF // Device Specific Randon key
  370. // [127:96]
  371. #define DTHE_RAND_KEY3_KEY_S 0
  372. #endif // __HW_DTHE_H__