25 #ifndef HAL_JESD216_FLASH_H 26 #define HAL_JESD216_FLASH_H 38 #define JESD216_CMD_READ_ID 0x9FU 39 #define JESD216_CMD_READ 0x03U 40 #define JESD216_CMD_WRITE_ENABLE 0x06U 41 #define JESD216_CMD_WRITE_DISABLE 0x04U 42 #define JESD216_CMD_READ_STATUS_REGISTER 0x05U 43 #define JESD216_CMD_WRITE_STATUS_REGISTER 0x01U 44 #define JESD216_CMD_PAGE_PROGRAM 0x02U 45 #define JESD216_CMD_ERASE_4K 0x20U 46 #define JESD216_CMD_ERASE_BULK 0xC7U 47 #define JESD216_CMD_PROGRAM_ERASE_RESUME 0x7AU 48 #define JESD216_CMD_PROGRAM_ERASE_SUSPEND 0x75U 49 #define JESD216_CMD_READ_OTP_ARRAY 0x4BU 50 #define JESD216_CMD_PROGRAM_OTP_ARRAY 0x42U 57 #define JESD216_CMD_EXTENDED_ADDRESSING 0x80000000U 64 #define JESD216_BUS_MODE_SPI 0U 65 #define JESD216_BUS_MODE_QSPI1L 1U 66 #define JESD216_BUS_MODE_QSPI2L 2U 67 #define JESD216_BUS_MODE_QSPI4L 4U 81 #if !defined(JESD216_BUS_MODE) || defined(__DOXYGEN__) 82 #define JESD216_BUS_MODE JESD216_BUS_MODE_QSPI4L 92 #if !defined(JESD216_SHARED_BUS) || defined(__DOXYGEN__) 93 #define JESD216_SHARED_BUS TRUE 101 #if (JESD216_BUS_MODE == JESD216_BUS_MODE_SPI) && (HAL_USE_SPI == FALSE) 102 #error "JESD216_BUS_MODE_SPI requires HAL_USE_SPI" 105 #if (JESD216_BUS_MODE != JESD216_BUS_MODE_SPI) && (HAL_USE_QSPI == FALSE) 106 #error "JESD216_BUS_MODE_QSPIxL requires HAL_USE_QSPI" 109 #if (JESD216_BUS_MODE == JESD216_BUS_MODE_SPI) && \ 110 (JESD216_SHARED_BUS == TRUE) && \ 111 (SPI_USE_MUTUAL_EXCLUSION == FALSE) 112 #error "JESD216_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION" 115 #if (JESD216_BUS_MODE != JESD216_BUS_MODE_SPI) && \ 116 (JESD216_BUS_MODE != JESD216_BUS_MODE_QSPI1L) && \ 117 (JESD216_BUS_MODE != JESD216_BUS_MODE_QSPI2L) && \ 118 (JESD216_BUS_MODE != JESD216_BUS_MODE_QSPI4L) 119 #error "invalid JESD216_BUS_MODE selected" 126 #if (JESD216_BUS_MODE != JESD216_BUS_MODE_SPI) || defined(__DOXYGEN__) 127 #define BUSConfig QSPIConfig 128 #define BUSDriver QSPIDriver 130 #define BUSConfig SPIConfig 131 #define BUSDriver SPIDriver 134 #define _jesd216_config \ 136 const BUSConfig *buscfg; 141 #define _jesd216_flash_methods_alone \ 143 flash_error_t (*read_sfdp)(void *instance, \ 144 flash_offset_t offset, \ 151 #define _jesd216_flash_methods \ 152 _base_flash_methods \ 153 _jesd216_flash_methods_alone 165 #define _jesd216_flash_data \ 194 void jesd216_start(BUSDriver *busp,
const BUSConfig *config);
195 void jesd216_stop(BUSDriver *busp);
196 void jesd216_cmd(BUSDriver *busp, uint32_t cmd);
197 void jesd216_cmd_receive(BUSDriver *busp, uint32_t cmd,
198 size_t n, uint8_t *p);
199 void jesd216_cmd_send(BUSDriver *busp, uint32_t cmd,
200 size_t n,
const uint8_t *p);
201 void jesd216_cmd_addr(BUSDriver *busp, uint32_t cmd,
flash_offset_t offset);
202 void jesd216_cmd_addr_send(BUSDriver *busp, uint32_t cmd,
204 void jesd216_cmd_addr_receive(BUSDriver *busp, uint32_t cmd,
206 #if JESD216_BUS_MODE != JESD216_BUS_MODE_SPI 207 void jesd216_cmd_addr_dummy_receive(BUSDriver *busp, uint32_t cmd,
209 size_t n, uint8_t *p);
211 #if JESD216_SHARED_BUS == TRUE 212 void jesd216_bus_acquire(BUSDriver *busp,
const BUSConfig *config);
213 void jesd216_bus_release(BUSDriver *busp);
JESD215Flash virtual methods table.
#define _jesd216_flash_data
JESD215Flash specific data.
#define _jesd216_flash_methods
JESD215Flash specific methods with inherited ones.
uint32_t flash_offset_t
Type of a flash offset.
const struct JESD215FlashVMT * vmt
Virtual Methods Table.
Generic flash driver class header.