w25q80bv.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Copyright (c) 2022 OpenLuat & AirM2M
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. * this software and associated documentation files (the "Software"), to deal in
  6. * the Software without restriction, including without limitation the rights to
  7. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. * the Software, and to permit persons to whom the Software is furnished to do so,
  9. * subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in all
  12. * copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __W25Q80BV_H
  23. #define __W25Q80BV_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. /** @addtogroup BSP
  29. * @{
  30. */
  31. /** @addtogroup Components
  32. * @{
  33. */
  34. /** @addtogroup W25Q80BV
  35. * @{
  36. */
  37. /** @defgroup W25Q80BV_Exported_Types
  38. * @{
  39. */
  40. /**
  41. * @}
  42. */
  43. /** @defgroup W25Q80BV_Exported_Constants
  44. * @{
  45. */
  46. /**
  47. * @brief W25Q80BV Configuration
  48. */
  49. #define W25Q80BV_FLASH_SIZE 0x100000 /* 8MBits => 1MBytes */
  50. #define W25Q80BV_SECTOR_SIZE 0x1000 /* 256 sectors of 4KBytes */
  51. #define W25Q80BV_SUBSECTOR_SIZE 0x100 /* 4096 subsectors of 4kBytes */
  52. #define W25Q80BV_PAGE_SIZE 0x100 /* 65536 pages of 256 bytes */
  53. #define W25Q80BV_DUMMY_CYCLES_READ 4
  54. #define W25Q80BV_DUMMY_CYCLES_READ_QUAD 10
  55. #define W25Q80BV_BULK_ERASE_MAX_TIME 250000
  56. #define W25Q80BV_SECTOR_ERASE_MAX_TIME 3000
  57. #define W25Q80BV_SUBSECTOR_ERASE_MAX_TIME 800
  58. /**
  59. * @brief W25Q80BV Commands
  60. */
  61. /* Reset Operations */
  62. #define RESET_ENABLE_CMD 0x66
  63. #define RESET_MEMORY_CMD 0x99
  64. #define ENTER_QPI_MODE_CMD 0x38
  65. #define EXIT_QPI_MODE_CMD 0xFF
  66. /* Identification Operations */
  67. #define READ_ID_CMD 0x90
  68. #define DUAL_READ_ID_CMD 0x92
  69. #define QUAD_READ_ID_CMD 0x94
  70. #define READ_JEDEC_ID_CMD 0x9F
  71. /* Read Operations */
  72. #define READ_CMD 0x03
  73. #define FAST_READ_CMD 0x0B
  74. #define DUAL_OUT_FAST_READ_CMD 0x3B
  75. #define DUAL_INOUT_FAST_READ_CMD 0xBB
  76. #define QUAD_OUT_FAST_READ_CMD 0x6B
  77. #define QUAD_INOUT_FAST_READ_CMD 0xEB
  78. /* Write Operations */
  79. #define WRITE_ENABLE_CMD 0x06
  80. #define WRITE_DISABLE_CMD 0x04
  81. /* Register Operations */
  82. #define READ_STATUS_REG1_CMD 0x05
  83. #define READ_STATUS_REG2_CMD 0x35
  84. #define READ_STATUS_REG3_CMD 0x15
  85. #define WRITE_STATUS_REG1_CMD 0x01
  86. #define WRITE_STATUS_REG2_CMD 0x31
  87. #define WRITE_STATUS_REG3_CMD 0x11
  88. /* Program Operations */
  89. #define PAGE_PROG_CMD 0x02
  90. #define QUAD_INPUT_PAGE_PROG_CMD 0x32
  91. /* Erase Operations */
  92. #define SECTOR_ERASE_CMD 0x20
  93. #define CHIP_ERASE_CMD 0xC7
  94. #define PROG_ERASE_RESUME_CMD 0x7A
  95. #define PROG_ERASE_SUSPEND_CMD 0x75
  96. #define SET_BURST_WITH_WRAP 0x77
  97. /* Flag Status Register */
  98. #define W25Q80BV_FSR_BUSY ((uint8_t)0x01) /*!< busy */
  99. #define W25Q80BV_FSR_WREN ((uint8_t)0x02) /*!< write enable */
  100. #define W25Q80BV_FSR_QE ((uint8_t)0x02) /*!< quad enable */
  101. /**
  102. * @}
  103. */
  104. /** @defgroup W25Q80BV_Exported_Functions
  105. * @{
  106. */
  107. /**
  108. * @}
  109. */
  110. /**
  111. * @}
  112. */
  113. /**
  114. * @}
  115. */
  116. /**
  117. * @}
  118. */
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122. #endif /* __W25Q80BV_H */