From df57dde06e3a781bbedd23da47134ade0758a73d Mon Sep 17 00:00:00 2001 From: ozpv <39195175+ozpv@users.noreply.github.com> Date: Sat, 15 Aug 2026 17:31:59 -0500 Subject: Add files via git push --- Core/Inc/quadspi.h | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 Core/Inc/quadspi.h (limited to 'Core/Inc/quadspi.h') diff --git a/Core/Inc/quadspi.h b/Core/Inc/quadspi.h new file mode 100755 index 0000000..c28e818 --- /dev/null +++ b/Core/Inc/quadspi.h @@ -0,0 +1,94 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file quadspi.h + * @brief This file contains all the function prototypes for + * the quadspi.c file + ****************************************************************************** + * @attention + * + * Copyright (c) 2026 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __QUADSPI_H__ +#define __QUADSPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +extern QSPI_HandleTypeDef hqspi; + +/* USER CODE BEGIN Private defines */ + +uint8_t CSP_QUADSPI_Init(void); +uint8_t CSP_QSPI_EraseSector(uint32_t EraseStartAddress ,uint32_t EraseEndAddress); +uint8_t CSP_QSPI_EraseBlock(uint32_t flash_address); +uint8_t CSP_QSPI_WriteMemory(uint8_t* buffer, uint32_t address, uint32_t buffer_size); +uint8_t CSP_QSPI_EnableMemoryMappedMode(void); +uint8_t CSP_QSPI_Erase_Chip (void); +uint8_t QSPI_AutoPollingMemReady(void); +uint8_t CSP_QSPI_Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size); + +/* USER CODE END Private defines */ + +void MX_QUADSPI_Init(void); + +/* USER CODE BEGIN Prototypes */ + +#define MEMORY_FLASH_SIZE 0x01000000UL /* 16 MBytes */ +#define MEMORY_PAGE_SIZE 256UL +#define MEMORY_SECTOR_SIZE 4096UL +#define MEMORY_BLOCK_SIZE 65536UL + +#define MEMORY_FLASH_LAST_ADDRESS (MEMORY_FLASH_SIZE - 1UL) + +#define W25Q128_SR1_BUSY 0x01U +#define W25Q128_SR1_WEL 0x02U +#define W25Q128_SR2_QE 0x02U + +#define WRITE_ENABLE_CMD 0x06U +#define VOLATILE_SR_WRITE_ENABLE 0x50U + +#define READ_STATUS_REG_CMD 0x05U +#define READ_STATUS_REG2_CMD 0x35U +#define READ_STATUS_REG3_CMD 0x15U + +#define WRITE_STATUS_REG2_CMD 0x31U +#define WRITE_STATUS_REG3_CMD 0x11U + +#define CHIP_ERASE_CMD 0xC7U +#define BLOCK_ERASE_CMD 0xD8U +#define SECTOR_ERASE_CMD 0x20U + +#define QUAD_IN_FAST_PROG_CMD 0x32U +#define QUAD_IN_OUT_FAST_READ_CMD 0xEBU + +#define RESET_ENABLE_CMD 0x66U +#define RESET_EXECUTE_CMD 0x99U + +#define READ_JEDEC_ID_CMD 0x9FU + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __QUADSPI_H__ */ + -- cgit v1.2.3