spi_flash.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. /*
  2. * SPDX-FileCopyrightText: 2010-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #ifndef CONFIG_IDF_TARGET_ESP32S2
  8. #error This file should only be included for ESP32-S2 target
  9. #endif
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. #include "esp_attr.h"
  13. #include "soc/spi_mem_reg.h"
  14. #include "esp_rom_spiflash.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /*************************************************************
  19. * Note
  20. *************************************************************
  21. * 1. ESP32 chip have 4 SPI slave/master, however, SPI0 is
  22. * used as an SPI master to access Flash and ext-SRAM by
  23. * Cache module. It will support Decryto read for Flash,
  24. * read/write for ext-SRAM. And SPI1 is also used as an
  25. * SPI master for Flash read/write and ext-SRAM read/write.
  26. * It will support Encrypto write for Flash.
  27. * 2. As an SPI master, SPI support Highest clock to 80M,
  28. * however, Flash with 80M Clock should be configured
  29. * for different Flash chips. If you want to use 80M
  30. * clock We should use the SPI that is certified by
  31. * Espressif. However, the certification is not started
  32. * at the time, so please use 40M clock at the moment.
  33. * 3. SPI Flash can use 2 lines or 4 lines mode. If you
  34. * use 2 lines mode, you can save two pad SPIHD and
  35. * SPIWP for gpio. ESP32 support configured SPI pad for
  36. * Flash, the configuration is stored in efuse and flash.
  37. * However, the configurations of pads should be certified
  38. * by Espressif. If you use this function, please use 40M
  39. * clock at the moment.
  40. * 4. ESP32 support to use Common SPI command to configure
  41. * Flash to QIO mode, if you failed to configure with fix
  42. * command. With Common SPI Command, ESP32 can also provide
  43. * a way to use same Common SPI command groups on different
  44. * Flash chips.
  45. * 5. This functions are not protected by packeting, Please use the
  46. *************************************************************
  47. */
  48. #define PERIPHS_SPI_FLASH_CMD SPI_MEM_CMD_REG(1)
  49. #define PERIPHS_SPI_FLASH_ADDR SPI_MEM_ADDR_REG(1)
  50. #define PERIPHS_SPI_FLASH_CTRL SPI_MEM_CTRL_REG(1)
  51. #define PERIPHS_SPI_FLASH_CTRL1 SPI_MEM_CTRL1_REG(1)
  52. #define PERIPHS_SPI_FLASH_STATUS SPI_MEM_RD_STATUS_REG(1)
  53. #define PERIPHS_SPI_FLASH_USRREG SPI_MEM_USER_REG(1)
  54. #define PERIPHS_SPI_FLASH_USRREG1 SPI_MEM_USER1_REG(1)
  55. #define PERIPHS_SPI_FLASH_USRREG2 SPI_MEM_USER2_REG(1)
  56. #define PERIPHS_SPI_FLASH_C0 SPI_MEM_W0_REG(1)
  57. #define PERIPHS_SPI_FLASH_C1 SPI_MEM_W1_REG(1)
  58. #define PERIPHS_SPI_FLASH_C2 SPI_MEM_W2_REG(1)
  59. #define PERIPHS_SPI_FLASH_C3 SPI_MEM_W3_REG(1)
  60. #define PERIPHS_SPI_FLASH_C4 SPI_MEM_W4_REG(1)
  61. #define PERIPHS_SPI_FLASH_C5 SPI_MEM_W5_REG(1)
  62. #define PERIPHS_SPI_FLASH_C6 SPI_MEM_W6_REG(1)
  63. #define PERIPHS_SPI_FLASH_C7 SPI_MEM_W7_REG(1)
  64. #define PERIPHS_SPI_FLASH_TX_CRC SPI_MEM_TX_CRC_REG(1)
  65. #define SPI0_R_QIO_DUMMY_CYCLELEN 5
  66. #define SPI0_R_QIO_ADDR_BITSLEN 23
  67. #define SPI0_R_FAST_DUMMY_CYCLELEN 7
  68. #define SPI0_R_DIO_DUMMY_CYCLELEN 3
  69. #define SPI0_R_FAST_ADDR_BITSLEN 23
  70. #define SPI0_R_SIO_ADDR_BITSLEN 23
  71. #define SPI1_R_QIO_DUMMY_CYCLELEN 5
  72. #define SPI1_R_QIO_ADDR_BITSLEN 23
  73. #define SPI1_R_FAST_DUMMY_CYCLELEN 7
  74. #define SPI1_R_DIO_DUMMY_CYCLELEN 3
  75. #define SPI1_R_DIO_ADDR_BITSLEN 23
  76. #define SPI1_R_FAST_ADDR_BITSLEN 23
  77. #define SPI1_R_SIO_ADDR_BITSLEN 23
  78. #define ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN 23
  79. #define ESP_ROM_SPIFLASH_TWO_BYTE_STATUS_EN SPI_MEM_WRSR_2B
  80. //SPI address register
  81. #define ESP_ROM_SPIFLASH_BYTES_LEN 24
  82. #define ESP_ROM_SPIFLASH_BUFF_BYTE_WRITE_NUM 32
  83. #define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM 16
  84. #define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_BITS 0xf
  85. typedef struct {
  86. uint8_t data_length;
  87. uint8_t read_cmd0;
  88. uint8_t read_cmd1;
  89. uint8_t write_cmd;
  90. uint16_t data_mask;
  91. uint16_t data;
  92. } esp_rom_spiflash_common_cmd_t;
  93. /**
  94. * @brief SPI Flash init, clock divisor is 4, use 1 line Slow read mode.
  95. * Please do not call this function in SDK.
  96. *
  97. * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping
  98. * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd
  99. *
  100. * @param uint8_t legacy: always keeping false.
  101. *
  102. * @return None
  103. */
  104. void esp_rom_spiflash_attach(uint32_t ishspi, bool legacy);
  105. /**
  106. * @brief SPI Read Flash status register. We use CMD 0x05 (RDSR).
  107. * Please do not call this function in SDK.
  108. *
  109. * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file.
  110. *
  111. * @param uint32_t *status : The pointer to which to return the Flash status value.
  112. *
  113. * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK.
  114. * ESP_ROM_SPIFLASH_RESULT_ERR : read error.
  115. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout.
  116. */
  117. esp_rom_spiflash_result_t esp_rom_spiflash_read_status(esp_rom_spiflash_chip_t *spi, uint32_t *status);
  118. /**
  119. * @brief SPI Read Flash status register bits 8-15. We use CMD 0x35 (RDSR2).
  120. * Please do not call this function in SDK.
  121. *
  122. * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file.
  123. *
  124. * @param uint32_t *status : The pointer to which to return the Flash status value.
  125. *
  126. * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK.
  127. * ESP_ROM_SPIFLASH_RESULT_ERR : read error.
  128. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout.
  129. */
  130. esp_rom_spiflash_result_t esp_rom_spiflash_read_statushigh(esp_rom_spiflash_chip_t *spi, uint32_t *status);
  131. /**
  132. * @brief Write status to Flash status register.
  133. * Please do not call this function in SDK.
  134. *
  135. * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file.
  136. *
  137. * @param uint32_t status_value : Value to .
  138. *
  139. * @return ESP_ROM_SPIFLASH_RESULT_OK : write OK.
  140. * ESP_ROM_SPIFLASH_RESULT_ERR : write error.
  141. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : write timeout.
  142. */
  143. esp_rom_spiflash_result_t esp_rom_spiflash_write_status(esp_rom_spiflash_chip_t *spi, uint32_t status_value);
  144. /**
  145. * @brief Use a command to Read Flash status register.
  146. * Please do not call this function in SDK.
  147. *
  148. * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file.
  149. *
  150. * @param uint32_t*status : The pointer to which to return the Flash status value.
  151. *
  152. * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK.
  153. * ESP_ROM_SPIFLASH_RESULT_ERR : read error.
  154. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout.
  155. */
  156. esp_rom_spiflash_result_t esp_rom_spiflash_read_user_cmd(uint32_t *status, uint8_t cmd);
  157. /**
  158. * @brief Config SPI Flash read mode when init.
  159. * Please do not call this function in SDK.
  160. *
  161. * @param esp_rom_spiflash_read_mode_t mode : QIO/QOUT/DIO/DOUT/FastRD/SlowRD.
  162. *
  163. * This function does not try to set the QIO Enable bit in the status register, caller is responsible for this.
  164. *
  165. * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK.
  166. * ESP_ROM_SPIFLASH_RESULT_ERR : config error.
  167. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout.
  168. */
  169. esp_rom_spiflash_result_t esp_rom_spiflash_config_readmode(esp_rom_spiflash_read_mode_t mode);
  170. /**
  171. * @brief Config SPI Flash clock divisor.
  172. * Please do not call this function in SDK.
  173. *
  174. * @param uint8_t freqdiv: clock divisor.
  175. *
  176. * @param uint8_t spi: 0 for SPI0, 1 for SPI1.
  177. *
  178. * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK.
  179. * ESP_ROM_SPIFLASH_RESULT_ERR : config error.
  180. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout.
  181. */
  182. esp_rom_spiflash_result_t esp_rom_spiflash_config_clk(uint8_t freqdiv, uint8_t spi);
  183. /**
  184. * @brief Clear all SR bits except QE bit.
  185. * Please do not call this function in SDK.
  186. *
  187. * @param None.
  188. *
  189. * @return ESP_ROM_SPIFLASH_RESULT_OK : Unlock OK.
  190. * ESP_ROM_SPIFLASH_RESULT_ERR : Unlock error.
  191. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Unlock timeout.
  192. */
  193. esp_rom_spiflash_result_t esp_rom_spiflash_clear_bp(void);
  194. /**
  195. * @brief Clear all SR bits except QE bit.
  196. * Please do not call this function in SDK.
  197. *
  198. * @param None.
  199. *
  200. * @return ESP_ROM_SPIFLASH_RESULT_OK : Unlock OK.
  201. * ESP_ROM_SPIFLASH_RESULT_ERR : Unlock error.
  202. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Unlock timeout.
  203. */
  204. esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void);
  205. /**
  206. * @brief Update SPI Flash parameter.
  207. * Please do not call this function in SDK.
  208. *
  209. * @param uint32_t deviceId : Device ID read from SPI, the low 32 bit.
  210. *
  211. * @param uint32_t chip_size : The Flash size.
  212. *
  213. * @param uint32_t block_size : The Flash block size.
  214. *
  215. * @param uint32_t sector_size : The Flash sector size.
  216. *
  217. * @param uint32_t page_size : The Flash page size.
  218. *
  219. * @param uint32_t status_mask : The Mask used when read status from Flash(use single CMD).
  220. *
  221. * @return ESP_ROM_SPIFLASH_RESULT_OK : Update OK.
  222. * ESP_ROM_SPIFLASH_RESULT_ERR : Update error.
  223. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Update timeout.
  224. */
  225. esp_rom_spiflash_result_t esp_rom_spiflash_config_param(uint32_t deviceId, uint32_t chip_size, uint32_t block_size,
  226. uint32_t sector_size, uint32_t page_size, uint32_t status_mask);
  227. /**
  228. * @brief Erase whole flash chip.
  229. * Please do not call this function in SDK.
  230. *
  231. * @param None
  232. *
  233. * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK.
  234. * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error.
  235. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout.
  236. */
  237. esp_rom_spiflash_result_t esp_rom_spiflash_erase_chip(void);
  238. /**
  239. * @brief Erase a 64KB block of flash
  240. * Uses SPI flash command D8H.
  241. * Please do not call this function in SDK.
  242. *
  243. * @param uint32_t block_num : Which block to erase.
  244. *
  245. * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK.
  246. * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error.
  247. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout.
  248. */
  249. esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block_num);
  250. /**
  251. * @brief Erase a sector of flash.
  252. * Uses SPI flash command 20H.
  253. * Please do not call this function in SDK.
  254. *
  255. * @param uint32_t sector_num : Which sector to erase.
  256. *
  257. * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK.
  258. * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error.
  259. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout.
  260. */
  261. esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector(uint32_t sector_num);
  262. /**
  263. * @brief Erase some sectors.
  264. * Please do not call this function in SDK.
  265. *
  266. * @param uint32_t start_addr : Start addr to erase, should be sector aligned.
  267. *
  268. * @param uint32_t area_len : Length to erase, should be sector aligned.
  269. *
  270. * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK.
  271. * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error.
  272. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout.
  273. */
  274. esp_rom_spiflash_result_t esp_rom_spiflash_erase_area(uint32_t start_addr, uint32_t area_len);
  275. /**
  276. * @brief Write Data to Flash, you should Erase it yourself if need.
  277. * Please do not call this function in SDK.
  278. *
  279. * @param uint32_t dest_addr : Address to write, should be 4 bytes aligned.
  280. *
  281. * @param const uint32_t *src : The pointer to data which is to write.
  282. *
  283. * @param uint32_t len : Length to write, should be 4 bytes aligned.
  284. *
  285. * @return ESP_ROM_SPIFLASH_RESULT_OK : Write OK.
  286. * ESP_ROM_SPIFLASH_RESULT_ERR : Write error.
  287. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Write timeout.
  288. */
  289. esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t dest_addr, const uint32_t *src, int32_t len);
  290. /**
  291. * @brief Read Data from Flash, you should Erase it yourself if need.
  292. * Please do not call this function in SDK.
  293. *
  294. * @param uint32_t src_addr : Address to read, should be 4 bytes aligned.
  295. *
  296. * @param uint32_t *dest : The buf to read the data.
  297. *
  298. * @param uint32_t len : Length to read, should be 4 bytes aligned.
  299. *
  300. * @return ESP_ROM_SPIFLASH_RESULT_OK : Read OK.
  301. * ESP_ROM_SPIFLASH_RESULT_ERR : Read error.
  302. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Read timeout.
  303. */
  304. esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t src_addr, uint32_t *dest, int32_t len);
  305. /**
  306. * @brief SPI1 go into encrypto mode.
  307. * Please do not call this function in SDK.
  308. *
  309. * @param None
  310. *
  311. * @return None
  312. */
  313. void esp_rom_spiflash_write_encrypted_enable(void);
  314. /**
  315. * @brief Prepare 32 Bytes data to encrpto writing, you should Erase it yourself if need.
  316. * Please do not call this function in SDK.
  317. *
  318. * @param uint32_t flash_addr : Address to write, should be 32 bytes aligned.
  319. *
  320. * @param uint32_t *data : The pointer to data which is to write.
  321. *
  322. * @return ESP_ROM_SPIFLASH_RESULT_OK : Prepare OK.
  323. * ESP_ROM_SPIFLASH_RESULT_ERR : Prepare error.
  324. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Prepare timeout.
  325. */
  326. esp_rom_spiflash_result_t esp_rom_spiflash_prepare_encrypted_data(uint32_t flash_addr, uint32_t *data);
  327. /**
  328. * @brief SPI1 go out of encrypto mode.
  329. * Please do not call this function in SDK.
  330. *
  331. * @param None
  332. *
  333. * @return None
  334. */
  335. void esp_rom_spiflash_write_encrypted_disable(void);
  336. /**
  337. * @brief Write data to flash with transparent encryption.
  338. * @note Sectors to be written should already be erased.
  339. *
  340. * @note Please do not call this function in SDK.
  341. *
  342. * @param uint32_t flash_addr : Address to write, should be 32 byte aligned.
  343. *
  344. * @param uint32_t *data : The pointer to data to write. Note, this pointer must
  345. * be 32 bit aligned and the content of the data will be
  346. * modified by the encryption function.
  347. *
  348. * @param uint32_t len : Length to write, should be 32 bytes aligned.
  349. *
  350. * @return ESP_ROM_SPIFLASH_RESULT_OK : Data written successfully.
  351. * ESP_ROM_SPIFLASH_RESULT_ERR : Encryption write error.
  352. * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Encrypto write timeout.
  353. */
  354. esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, uint32_t *data, uint32_t len);
  355. /** @brief Wait until SPI flash write operation is complete
  356. *
  357. * @note Please do not call this function in SDK.
  358. *
  359. * Reads the Write In Progress bit of the SPI flash status register,
  360. * repeats until this bit is zero (indicating write complete).
  361. *
  362. * @return ESP_ROM_SPIFLASH_RESULT_OK : Write is complete
  363. * ESP_ROM_SPIFLASH_RESULT_ERR : Error while reading status.
  364. */
  365. esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *spi);
  366. /** @brief Enable Quad I/O pin functions
  367. *
  368. * @note Please do not call this function in SDK.
  369. *
  370. * Sets the HD & WP pin functions for Quad I/O modes, based on the
  371. * efuse SPI pin configuration.
  372. *
  373. * @param wp_gpio_num - Number of the WP pin to reconfigure for quad I/O.
  374. *
  375. * @param spiconfig - Pin configuration, as returned from ets_efuse_get_spiconfig().
  376. * - If this parameter is 0, default SPI pins are used and wp_gpio_num parameter is ignored.
  377. * - If this parameter is 1, default HSPI pins are used and wp_gpio_num parameter is ignored.
  378. * - For other values, this parameter encodes the HD pin number and also the CLK pin number. CLK pin selection is used
  379. * to determine if HSPI or SPI peripheral will be used (use HSPI if CLK pin is the HSPI clock pin, otherwise use SPI).
  380. * Both HD & WP pins are configured via GPIO matrix to map to the selected peripheral.
  381. */
  382. void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig);
  383. /**
  384. * @brief Clear WEL bit unconditionally.
  385. *
  386. * @return always ESP_ROM_SPIFLASH_RESULT_OK
  387. */
  388. esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void);
  389. /**
  390. * @brief Set WREN bit.
  391. *
  392. * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file.
  393. *
  394. * @return always ESP_ROM_SPIFLASH_RESULT_OK
  395. */
  396. esp_rom_spiflash_result_t esp_rom_spiflash_write_enable(esp_rom_spiflash_chip_t *spi);
  397. /**
  398. * @brief Fix the bug in SPI hardware communication with Flash/Ext-SRAM in High Speed.
  399. * Please do not call this function in SDK.
  400. *
  401. * @param uint8_t spi: 0 for SPI0(Cache Access), 1 for SPI1(Flash read/write).
  402. *
  403. * @param uint8_t freqdiv: Pll is 80M, 4 for 20M, 3 for 26.7M, 2 for 40M, 1 for 80M.
  404. *
  405. * @return None
  406. */
  407. void esp_rom_spiflash_fix_dummylen(uint8_t spi, uint8_t freqdiv);
  408. /**
  409. * @brief Set SPI Flash pad drivers.
  410. * Please do not call this function in SDK.
  411. *
  412. * @param uint8_t wp_gpio_num: WP gpio number.
  413. *
  414. * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping
  415. * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd
  416. *
  417. * @param uint8_t *drvs: drvs[0]-bit[3:0] for cpiclk, bit[7:4] for spiq, drvs[1]-bit[3:0] for spid, drvs[1]-bit[7:4] for spid
  418. * drvs[2]-bit[3:0] for spihd, drvs[2]-bit[7:4] for spiwp.
  419. * Values usually read from falsh by rom code, function usually callde by rom code.
  420. * if value with bit(3) set, the value is valid, bit[2:0] is the real value.
  421. *
  422. * @return None
  423. */
  424. void esp_rom_spiflash_set_drvs(uint8_t wp_gpio_num, uint32_t ishspi, uint8_t *drvs);
  425. /**
  426. * @brief Select SPI Flash function for pads.
  427. * Please do not call this function in SDK.
  428. *
  429. * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping
  430. * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd
  431. *
  432. * @return None
  433. */
  434. void esp_rom_spiflash_select_padsfunc(uint32_t ishspi);
  435. /**
  436. * @brief Send CommonCmd to Flash so that is can go into QIO mode, some Flash use different CMD.
  437. * Please do not call this function in SDK.
  438. *
  439. * @param esp_rom_spiflash_common_cmd_t *cmd : A struct to show the action of a command.
  440. *
  441. * @return uint16_t 0 : do not send command any more.
  442. * 1 : go to the next command.
  443. * n > 1 : skip (n - 1) commands.
  444. */
  445. uint16_t esp_rom_spiflash_common_cmd(esp_rom_spiflash_common_cmd_t *cmd);
  446. #ifdef __cplusplus
  447. }
  448. #endif