28 #if (HAL_USE_QSPI == TRUE) || defined(__DOXYGEN__) 38 #define QSPI_CFG_CMD_MASK (0xFFLU << 0LU) 39 #define QSPI_CFG_CMD(n) ((n) << 0LU) 40 #define QSPI_CFG_CMD_MODE_MASK (3LU << 8LU) 41 #define QSPI_CFG_CMD_MODE_NONE (0LU << 8LU) 42 #define QSPI_CFG_CMD_MODE_ONE_LINE (1LU << 8LU) 43 #define QSPI_CFG_CMD_MODE_TWO_LINES (2LU << 8LU) 44 #define QSPI_CFG_CMD_MODE_FOUR_LINES (3LU << 8LU) 45 #define QSPI_CFG_ADDR_MODE_MASK (3LU << 10LU) 46 #define QSPI_CFG_ADDR_MODE_NONE (0LU << 10LU) 47 #define QSPI_CFG_ADDR_MODE_ONE_LINE (1LU << 10LU) 48 #define QSPI_CFG_ADDR_MODE_TWO_LINES (2LU << 10LU) 49 #define QSPI_CFG_ADDR_MODE_FOUR_LINES (3LU << 10LU) 50 #define QSPI_CFG_ADDR_SIZE_MASK (3LU << 12LU) 51 #define QSPI_CFG_ADDR_SIZE_8 (0LU << 12LU) 52 #define QSPI_CFG_ADDR_SIZE_16 (1LU << 12LU) 53 #define QSPI_CFG_ADDR_SIZE_24 (2LU << 12LU) 54 #define QSPI_CFG_ADDR_SIZE_32 (3LU << 12LU) 55 #define QSPI_CFG_ALT_MODE_MASK (3LU << 14LU) 56 #define QSPI_CFG_ALT_MODE_NONE (0LU << 14LU) 57 #define QSPI_CFG_ALT_MODE_ONE_LINE (1LU << 14LU) 58 #define QSPI_CFG_ALT_MODE_TWO_LINES (2LU << 14LU) 59 #define QSPI_CFG_ALT_MODE_FOUR_LINES (3LU << 14LU) 60 #define QSPI_CFG_ALT_SIZE_MASK (3LU << 16LU) 61 #define QSPI_CFG_ALT_SIZE_8 (0LU << 16LU) 63 #define QSPI_CFG_ALT_SIZE_16 (1LU << 16LU) 64 #define QSPI_CFG_ALT_SIZE_24 (2LU << 16LU) 65 #define QSPI_CFG_ALT_SIZE_32 (3LU << 16LU) 66 #define QSPI_CFG_DUMMY_CYCLES_MASK (0x1FLU << 18LU) 67 #define QSPI_CFG_DUMMY_CYCLES(n) ((n) << 18LU) 68 #define QSPI_CFG_DATA_MODE_MASK (3LU << 24LU) 69 #define QSPI_CFG_DATA_MODE_NONE (0LU << 24LU) 70 #define QSPI_CFG_DATA_MODE_ONE_LINE (1LU << 24LU) 71 #define QSPI_CFG_DATA_MODE_TWO_LINES (2LU << 24LU) 72 #define QSPI_CFG_DATA_MODE_FOUR_LINES (3LU << 24LU) 73 #define QSPI_CFG_SIOO (1LU << 28LU) 74 #define QSPI_CFG_DDRM (1LU << 31LU) 89 #if !defined(QSPI_USE_WAIT) || defined(__DOXYGEN__) 90 #define QSPI_USE_WAIT TRUE 97 #if !defined(QSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) 98 #define QSPI_USE_MUTUAL_EXCLUSION TRUE 133 #if !defined(QSPI_SUPPORTS_MEMMAP) 134 #error "low level does not define QSPI_SUPPORTS_MEMMAP" 154 #define qspiStartCommandI(qspip, cmdp) { \ 155 osalDbgAssert(((cmdp)->cfg & QSPI_CFG_DATA_MODE_MASK) == \ 156 QSPI_CFG_DATA_MODE_NONE, \ 157 "data mode specified"); \ 158 (qspip)->state = QSPI_ACTIVE; \ 159 qspi_lld_command(qspip, cmdp); \ 174 #define qspiStartSendI(qspip, cmdp, n, txbuf) { \ 175 osalDbgAssert(((cmdp)->cfg & QSPI_CFG_DATA_MODE_MASK) != \ 176 QSPI_CFG_DATA_MODE_NONE, \ 177 "data mode required"); \ 178 (qspip)->state = QSPI_ACTIVE; \ 179 qspi_lld_send(qspip, cmdp, n, txbuf); \ 194 #define qspiStartReceiveI(qspip, cmdp, n, rxbuf) { \ 195 osalDbgAssert(((cmdp)->cfg & QSPI_CFG_DATA_MODE_MASK) != \ 196 QSPI_CFG_DATA_MODE_NONE, \ 197 "data mode required"); \ 198 (qspip)->state = QSPI_ACTIVE; \ 199 qspi_lld_receive(qspip, cmdp, n, rxbuf); \ 202 #if (QSPI_SUPPORTS_MEMMAP == TRUE) || defined(__DOXYGEN__) 215 #define qspiMapFlashI(qspip, cmdp, addrp) \ 216 qspi_lld_map_flash(qspip, cmdp, addrp) 227 #define qspiUnmapFlashI(qspip) \ 228 qspi_lld_unmap_flash(qspip) 236 #if (QSPI_USE_WAIT == TRUE) || defined(__DOXYGEN__) 244 #define _qspi_wakeup_isr(qspip) { \ 245 osalSysLockFromISR(); \ 246 osalThreadResumeI(&(qspip)->thread, MSG_OK); \ 247 osalSysUnlockFromISR(); \ 250 #define _qspi_wakeup_isr(qspip) 267 #define _qspi_isr_code(qspip) { \ 268 if ((qspip)->config->end_cb) { \ 269 (qspip)->state = QSPI_COMPLETE; \ 270 (qspip)->config->end_cb(qspip); \ 271 if ((qspip)->state == QSPI_COMPLETE) \ 272 (qspip)->state = QSPI_READY; \ 275 (qspip)->state = QSPI_READY; \ 276 _qspi_wakeup_isr(qspip); \ 293 size_t n,
const uint8_t *txbuf);
295 size_t n, uint8_t *rxbuf);
296 #if QSPI_USE_WAIT == TRUE 299 size_t n,
const uint8_t *txbuf);
301 size_t n, uint8_t *rxbuf);
303 #if QSPI_SUPPORTS_MEMMAP == TRUE 309 #if QSPI_USE_MUTUAL_EXCLUSION == TRUE
void qspiStartSend(QSPIDriver *qspip, const qspi_command_t *cmdp, size_t n, const uint8_t *txbuf)
Sends a command with data over the QSPI bus.
void qspiUnmapFlash(QSPIDriver *qspip)
Unmaps from memory space a QSPI flash device.
void qspiObjectInit(QSPIDriver *qspip)
Initializes the standard part of a QSPIDriver structure.
void qspiReleaseBus(QSPIDriver *qspip)
Releases exclusive access to the QSPI bus.
Driver configuration structure.
void qspiStartCommand(QSPIDriver *qspip, const qspi_command_t *cmdp)
Sends a command without data phase.
void qspiStart(QSPIDriver *qspip, const QSPIConfig *config)
Configures and activates the QSPI peripheral.
void qspiReceive(QSPIDriver *qspip, const qspi_command_t *cmdp, size_t n, uint8_t *rxbuf)
Sends a command then receives data over the QSPI bus.
void qspiStartReceive(QSPIDriver *qspip, const qspi_command_t *cmdp, size_t n, uint8_t *rxbuf)
Sends a command then receives data over the QSPI bus.
PLATFORM QSPI subsystem low level driver header.
void qspiSend(QSPIDriver *qspip, const qspi_command_t *cmdp, size_t n, const uint8_t *txbuf)
Sends a command with data over the QSPI bus.
void qspiAcquireBus(QSPIDriver *qspip)
Gains exclusive access to the QSPI bus.
Structure representing an QSPI driver.
void qspiMapFlash(QSPIDriver *qspip, const qspi_command_t *cmdp, uint8_t **addrp)
Maps in memory space a QSPI flash device.
void qspiCommand(QSPIDriver *qspip, const qspi_command_t *cmdp)
Sends a command without data phase.
qspistate_t
Driver state machine possible states.
void qspiStop(QSPIDriver *qspip)
Deactivates the QSPI peripheral.
void qspiInit(void)
QSPI Driver initialization.
Type of a QSPI command descriptor.