blob: c28e818b11d8d7e263a9482b4d035aadc8b7abff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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__ */
|