esp_efuse_table.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. // Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at",
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License
  14. #include "sdkconfig.h"
  15. #include "esp_efuse.h"
  16. #include <assert.h>
  17. #include "esp_efuse_table.h"
  18. // md5_digest_table 2e23344575b3d07f01ecb695294e9770
  19. // This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
  20. // If you want to change some fields, you need to change esp_efuse_table.csv file
  21. // then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
  22. // To show efuse_table run the command 'show_efuse_table'.
  23. #define MAX_BLK_LEN CONFIG_EFUSE_MAX_BLK_LEN
  24. // The last free bit in the block is counted over the entire file.
  25. #define LAST_FREE_BIT_BLK1 MAX_BLK_LEN
  26. #define LAST_FREE_BIT_BLK2 MAX_BLK_LEN
  27. #define LAST_FREE_BIT_BLK3 192
  28. _Static_assert(LAST_FREE_BIT_BLK1 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");
  29. _Static_assert(LAST_FREE_BIT_BLK2 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");
  30. _Static_assert(LAST_FREE_BIT_BLK3 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");
  31. static const esp_efuse_desc_t MAC_FACTORY[] = {
  32. {EFUSE_BLK0, 72, 8}, // Factory MAC addr [0],
  33. {EFUSE_BLK0, 64, 8}, // Factory MAC addr [1],
  34. {EFUSE_BLK0, 56, 8}, // Factory MAC addr [2],
  35. {EFUSE_BLK0, 48, 8}, // Factory MAC addr [3],
  36. {EFUSE_BLK0, 40, 8}, // Factory MAC addr [4],
  37. {EFUSE_BLK0, 32, 8}, // Factory MAC addr [5],
  38. };
  39. static const esp_efuse_desc_t MAC_FACTORY_CRC[] = {
  40. {EFUSE_BLK0, 80, 8}, // CRC8 for factory MAC address,
  41. };
  42. static const esp_efuse_desc_t MAC_CUSTOM_CRC[] = {
  43. {EFUSE_BLK3, 0, 8}, // CRC8 for custom MAC address.,
  44. };
  45. static const esp_efuse_desc_t MAC_CUSTOM[] = {
  46. {EFUSE_BLK3, 8, 48}, // Custom MAC,
  47. };
  48. static const esp_efuse_desc_t MAC_CUSTOM_VER[] = {
  49. {EFUSE_BLK3, 184, 8}, // Custom MAC version,
  50. };
  51. static const esp_efuse_desc_t SECURE_BOOT_KEY[] = {
  52. {EFUSE_BLK2, 0, MAX_BLK_LEN}, // Security boot. Key. (length = "None" - 256. "3/4" - 192. "REPEAT" - 128),
  53. };
  54. static const esp_efuse_desc_t ABS_DONE_0[] = {
  55. {EFUSE_BLK0, 196, 1}, // Secure boot is enabled for bootloader image. EFUSE_RD_ABS_DONE_0,
  56. };
  57. static const esp_efuse_desc_t ENCRYPT_FLASH_KEY[] = {
  58. {EFUSE_BLK1, 0, MAX_BLK_LEN}, // Flash encrypt. Key. (length = "None" - 256. "3/4" - 192. "REPEAT" - 128),
  59. };
  60. static const esp_efuse_desc_t ENCRYPT_CONFIG[] = {
  61. {EFUSE_BLK0, 188, 4}, // Flash encrypt. EFUSE_FLASH_CRYPT_CONFIG_M,
  62. };
  63. static const esp_efuse_desc_t DISABLE_DL_ENCRYPT[] = {
  64. {EFUSE_BLK0, 199, 1}, // Flash encrypt. Disable UART bootloader encryption. EFUSE_DISABLE_DL_ENCRYPT.,
  65. };
  66. static const esp_efuse_desc_t DISABLE_DL_DECRYPT[] = {
  67. {EFUSE_BLK0, 200, 1}, // Flash encrypt. Disable UART bootloader decryption. EFUSE_DISABLE_DL_DECRYPT.,
  68. };
  69. static const esp_efuse_desc_t DISABLE_DL_CACHE[] = {
  70. {EFUSE_BLK0, 201, 1}, // Flash encrypt. Disable UART bootloader MMU cache. EFUSE_DISABLE_DL_CACHE.,
  71. };
  72. static const esp_efuse_desc_t DISABLE_JTAG[] = {
  73. {EFUSE_BLK0, 198, 1}, // Flash encrypt. Disable JTAG. EFUSE_RD_DISABLE_JTAG.,
  74. };
  75. static const esp_efuse_desc_t CONSOLE_DEBUG_DISABLE[] = {
  76. {EFUSE_BLK0, 194, 1}, // Flash encrypt. Disable ROM BASIC interpreter fallback. EFUSE_RD_CONSOLE_DEBUG_DISABLE.,
  77. };
  78. static const esp_efuse_desc_t FLASH_CRYPT_CNT[] = {
  79. {EFUSE_BLK0, 20, 7}, // Flash encrypt. Flash encryption is enabled if this field has an odd number of bits set. EFUSE_FLASH_CRYPT_CNT.,
  80. };
  81. static const esp_efuse_desc_t WR_DIS_FLASH_CRYPT_CNT[] = {
  82. {EFUSE_BLK0, 2, 1}, // Flash encrypt. Write protection FLASH_CRYPT_CNT. EFUSE_WR_DIS_FLASH_CRYPT_CNT,
  83. };
  84. static const esp_efuse_desc_t WR_DIS_BLK1[] = {
  85. {EFUSE_BLK0, 7, 1}, // Flash encrypt. Write protection encryption key. EFUSE_WR_DIS_BLK1,
  86. };
  87. static const esp_efuse_desc_t WR_DIS_BLK2[] = {
  88. {EFUSE_BLK0, 8, 1}, // Security boot. Write protection security key. EFUSE_WR_DIS_BLK2,
  89. };
  90. static const esp_efuse_desc_t WR_DIS_BLK3[] = {
  91. {EFUSE_BLK0, 9, 1}, // Write protection for EFUSE_BLK3. EFUSE_WR_DIS_BLK3,
  92. };
  93. static const esp_efuse_desc_t RD_DIS_BLK1[] = {
  94. {EFUSE_BLK0, 16, 1}, // Flash encrypt. efuse_key_read_protected. EFUSE_RD_DIS_BLK1,
  95. };
  96. static const esp_efuse_desc_t RD_DIS_BLK2[] = {
  97. {EFUSE_BLK0, 17, 1}, // Security boot. efuse_key_read_protected. EFUSE_RD_DIS_BLK2,
  98. };
  99. static const esp_efuse_desc_t RD_DIS_BLK3[] = {
  100. {EFUSE_BLK0, 18, 1}, // Read protection for EFUSE_BLK3. EFUSE_RD_DIS_BLK3,
  101. };
  102. static const esp_efuse_desc_t CHIP_VER_DIS_APP_CPU[] = {
  103. {EFUSE_BLK0, 96, 1}, // EFUSE_RD_CHIP_VER_DIS_APP_CPU,
  104. };
  105. static const esp_efuse_desc_t CHIP_VER_DIS_BT[] = {
  106. {EFUSE_BLK0, 97, 1}, // EFUSE_RD_CHIP_VER_DIS_BT,
  107. };
  108. static const esp_efuse_desc_t CHIP_VER_PKG[] = {
  109. {EFUSE_BLK0, 105, 3}, // EFUSE_RD_CHIP_VER_PKG,
  110. };
  111. static const esp_efuse_desc_t CHIP_CPU_FREQ_LOW[] = {
  112. {EFUSE_BLK0, 108, 1}, // EFUSE_RD_CHIP_CPU_FREQ_LOW,
  113. };
  114. static const esp_efuse_desc_t CHIP_CPU_FREQ_RATED[] = {
  115. {EFUSE_BLK0, 109, 1}, // EFUSE_RD_CHIP_CPU_FREQ_RATED,
  116. };
  117. static const esp_efuse_desc_t CHIP_VER_REV1[] = {
  118. {EFUSE_BLK0, 111, 1}, // EFUSE_RD_CHIP_VER_REV1,
  119. };
  120. static const esp_efuse_desc_t CHIP_VER_REV2[] = {
  121. {EFUSE_BLK0, 180, 1}, // EFUSE_RD_CHIP_VER_REV2,
  122. };
  123. static const esp_efuse_desc_t XPD_SDIO_REG[] = {
  124. {EFUSE_BLK0, 142, 1}, // EFUSE_RD_XPD_SDIO_REG,
  125. };
  126. static const esp_efuse_desc_t SDIO_TIEH[] = {
  127. {EFUSE_BLK0, 143, 1}, // EFUSE_RD_SDIO_TIEH,
  128. };
  129. static const esp_efuse_desc_t SDIO_FORCE[] = {
  130. {EFUSE_BLK0, 144, 1}, // EFUSE_RD_SDIO_FORCE,
  131. };
  132. static const esp_efuse_desc_t ADC_VREF_AND_SDIO_DREF[] = {
  133. {EFUSE_BLK0, 136, 6}, // EFUSE_RD_ADC_VREF[0..4] or ( SDIO_DREFH[0 1],
  134. };
  135. static const esp_efuse_desc_t ADC1_TP_LOW[] = {
  136. {EFUSE_BLK3, 96, 7}, // TP_REG EFUSE_RD_ADC1_TP_LOW,
  137. };
  138. static const esp_efuse_desc_t ADC2_TP_LOW[] = {
  139. {EFUSE_BLK3, 112, 7}, // TP_REG EFUSE_RD_ADC2_TP_LOW,
  140. };
  141. static const esp_efuse_desc_t ADC1_TP_HIGH[] = {
  142. {EFUSE_BLK3, 103, 9}, // TP_REG EFUSE_RD_ADC1_TP_HIGH,
  143. };
  144. static const esp_efuse_desc_t ADC2_TP_HIGH[] = {
  145. {EFUSE_BLK3, 119, 9}, // TP_REG EFUSE_RD_ADC2_TP_HIGH,
  146. };
  147. static const esp_efuse_desc_t SECURE_VERSION[] = {
  148. {EFUSE_BLK3, 128, 32}, // Secure version for anti-rollback,
  149. };
  150. const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[] = {
  151. &MAC_FACTORY[0], // Factory MAC addr [0]
  152. &MAC_FACTORY[1], // Factory MAC addr [1]
  153. &MAC_FACTORY[2], // Factory MAC addr [2]
  154. &MAC_FACTORY[3], // Factory MAC addr [3]
  155. &MAC_FACTORY[4], // Factory MAC addr [4]
  156. &MAC_FACTORY[5], // Factory MAC addr [5]
  157. NULL
  158. };
  159. const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY_CRC[] = {
  160. &MAC_FACTORY_CRC[0], // CRC8 for factory MAC address
  161. NULL
  162. };
  163. const esp_efuse_desc_t* ESP_EFUSE_MAC_CUSTOM_CRC[] = {
  164. &MAC_CUSTOM_CRC[0], // CRC8 for custom MAC address.
  165. NULL
  166. };
  167. const esp_efuse_desc_t* ESP_EFUSE_MAC_CUSTOM[] = {
  168. &MAC_CUSTOM[0], // Custom MAC
  169. NULL
  170. };
  171. const esp_efuse_desc_t* ESP_EFUSE_MAC_CUSTOM_VER[] = {
  172. &MAC_CUSTOM_VER[0], // Custom MAC version
  173. NULL
  174. };
  175. const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY[] = {
  176. &SECURE_BOOT_KEY[0], // Security boot. Key. (length = "None" - 256. "3/4" - 192. "REPEAT" - 128)
  177. NULL
  178. };
  179. const esp_efuse_desc_t* ESP_EFUSE_ABS_DONE_0[] = {
  180. &ABS_DONE_0[0], // Secure boot is enabled for bootloader image. EFUSE_RD_ABS_DONE_0
  181. NULL
  182. };
  183. const esp_efuse_desc_t* ESP_EFUSE_ENCRYPT_FLASH_KEY[] = {
  184. &ENCRYPT_FLASH_KEY[0], // Flash encrypt. Key. (length = "None" - 256. "3/4" - 192. "REPEAT" - 128)
  185. NULL
  186. };
  187. const esp_efuse_desc_t* ESP_EFUSE_ENCRYPT_CONFIG[] = {
  188. &ENCRYPT_CONFIG[0], // Flash encrypt. EFUSE_FLASH_CRYPT_CONFIG_M
  189. NULL
  190. };
  191. const esp_efuse_desc_t* ESP_EFUSE_DISABLE_DL_ENCRYPT[] = {
  192. &DISABLE_DL_ENCRYPT[0], // Flash encrypt. Disable UART bootloader encryption. EFUSE_DISABLE_DL_ENCRYPT.
  193. NULL
  194. };
  195. const esp_efuse_desc_t* ESP_EFUSE_DISABLE_DL_DECRYPT[] = {
  196. &DISABLE_DL_DECRYPT[0], // Flash encrypt. Disable UART bootloader decryption. EFUSE_DISABLE_DL_DECRYPT.
  197. NULL
  198. };
  199. const esp_efuse_desc_t* ESP_EFUSE_DISABLE_DL_CACHE[] = {
  200. &DISABLE_DL_CACHE[0], // Flash encrypt. Disable UART bootloader MMU cache. EFUSE_DISABLE_DL_CACHE.
  201. NULL
  202. };
  203. const esp_efuse_desc_t* ESP_EFUSE_DISABLE_JTAG[] = {
  204. &DISABLE_JTAG[0], // Flash encrypt. Disable JTAG. EFUSE_RD_DISABLE_JTAG.
  205. NULL
  206. };
  207. const esp_efuse_desc_t* ESP_EFUSE_CONSOLE_DEBUG_DISABLE[] = {
  208. &CONSOLE_DEBUG_DISABLE[0], // Flash encrypt. Disable ROM BASIC interpreter fallback. EFUSE_RD_CONSOLE_DEBUG_DISABLE.
  209. NULL
  210. };
  211. const esp_efuse_desc_t* ESP_EFUSE_FLASH_CRYPT_CNT[] = {
  212. &FLASH_CRYPT_CNT[0], // Flash encrypt. Flash encryption is enabled if this field has an odd number of bits set. EFUSE_FLASH_CRYPT_CNT.
  213. NULL
  214. };
  215. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_FLASH_CRYPT_CNT[] = {
  216. &WR_DIS_FLASH_CRYPT_CNT[0], // Flash encrypt. Write protection FLASH_CRYPT_CNT. EFUSE_WR_DIS_FLASH_CRYPT_CNT
  217. NULL
  218. };
  219. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK1[] = {
  220. &WR_DIS_BLK1[0], // Flash encrypt. Write protection encryption key. EFUSE_WR_DIS_BLK1
  221. NULL
  222. };
  223. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK2[] = {
  224. &WR_DIS_BLK2[0], // Security boot. Write protection security key. EFUSE_WR_DIS_BLK2
  225. NULL
  226. };
  227. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK3[] = {
  228. &WR_DIS_BLK3[0], // Write protection for EFUSE_BLK3. EFUSE_WR_DIS_BLK3
  229. NULL
  230. };
  231. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_BLK1[] = {
  232. &RD_DIS_BLK1[0], // Flash encrypt. efuse_key_read_protected. EFUSE_RD_DIS_BLK1
  233. NULL
  234. };
  235. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_BLK2[] = {
  236. &RD_DIS_BLK2[0], // Security boot. efuse_key_read_protected. EFUSE_RD_DIS_BLK2
  237. NULL
  238. };
  239. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_BLK3[] = {
  240. &RD_DIS_BLK3[0], // Read protection for EFUSE_BLK3. EFUSE_RD_DIS_BLK3
  241. NULL
  242. };
  243. const esp_efuse_desc_t* ESP_EFUSE_CHIP_VER_DIS_APP_CPU[] = {
  244. &CHIP_VER_DIS_APP_CPU[0], // EFUSE_RD_CHIP_VER_DIS_APP_CPU
  245. NULL
  246. };
  247. const esp_efuse_desc_t* ESP_EFUSE_CHIP_VER_DIS_BT[] = {
  248. &CHIP_VER_DIS_BT[0], // EFUSE_RD_CHIP_VER_DIS_BT
  249. NULL
  250. };
  251. const esp_efuse_desc_t* ESP_EFUSE_CHIP_VER_PKG[] = {
  252. &CHIP_VER_PKG[0], // EFUSE_RD_CHIP_VER_PKG
  253. NULL
  254. };
  255. const esp_efuse_desc_t* ESP_EFUSE_CHIP_CPU_FREQ_LOW[] = {
  256. &CHIP_CPU_FREQ_LOW[0], // EFUSE_RD_CHIP_CPU_FREQ_LOW
  257. NULL
  258. };
  259. const esp_efuse_desc_t* ESP_EFUSE_CHIP_CPU_FREQ_RATED[] = {
  260. &CHIP_CPU_FREQ_RATED[0], // EFUSE_RD_CHIP_CPU_FREQ_RATED
  261. NULL
  262. };
  263. const esp_efuse_desc_t* ESP_EFUSE_CHIP_VER_REV1[] = {
  264. &CHIP_VER_REV1[0], // EFUSE_RD_CHIP_VER_REV1
  265. NULL
  266. };
  267. const esp_efuse_desc_t* ESP_EFUSE_CHIP_VER_REV2[] = {
  268. &CHIP_VER_REV2[0], // EFUSE_RD_CHIP_VER_REV2
  269. NULL
  270. };
  271. const esp_efuse_desc_t* ESP_EFUSE_XPD_SDIO_REG[] = {
  272. &XPD_SDIO_REG[0], // EFUSE_RD_XPD_SDIO_REG
  273. NULL
  274. };
  275. const esp_efuse_desc_t* ESP_EFUSE_SDIO_TIEH[] = {
  276. &SDIO_TIEH[0], // EFUSE_RD_SDIO_TIEH
  277. NULL
  278. };
  279. const esp_efuse_desc_t* ESP_EFUSE_SDIO_FORCE[] = {
  280. &SDIO_FORCE[0], // EFUSE_RD_SDIO_FORCE
  281. NULL
  282. };
  283. const esp_efuse_desc_t* ESP_EFUSE_ADC_VREF_AND_SDIO_DREF[] = {
  284. &ADC_VREF_AND_SDIO_DREF[0], // EFUSE_RD_ADC_VREF[0..4] or ( SDIO_DREFH[0 1]
  285. NULL
  286. };
  287. const esp_efuse_desc_t* ESP_EFUSE_ADC1_TP_LOW[] = {
  288. &ADC1_TP_LOW[0], // TP_REG EFUSE_RD_ADC1_TP_LOW
  289. NULL
  290. };
  291. const esp_efuse_desc_t* ESP_EFUSE_ADC2_TP_LOW[] = {
  292. &ADC2_TP_LOW[0], // TP_REG EFUSE_RD_ADC2_TP_LOW
  293. NULL
  294. };
  295. const esp_efuse_desc_t* ESP_EFUSE_ADC1_TP_HIGH[] = {
  296. &ADC1_TP_HIGH[0], // TP_REG EFUSE_RD_ADC1_TP_HIGH
  297. NULL
  298. };
  299. const esp_efuse_desc_t* ESP_EFUSE_ADC2_TP_HIGH[] = {
  300. &ADC2_TP_HIGH[0], // TP_REG EFUSE_RD_ADC2_TP_HIGH
  301. NULL
  302. };
  303. const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[] = {
  304. &SECURE_VERSION[0], // Secure version for anti-rollback
  305. NULL
  306. };