Initial commit: CCU621_M firmware project with BLE debug link support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#ifndef EXFLASH_SPI4_GD25QXX_H
|
||||
#define EXFLASH_SPI4_GD25QXX_H
|
||||
|
||||
#include "gd32h7xx.h"
|
||||
|
||||
/* GD25QXX 页大小:每页 256 字节 */
|
||||
#define SPI_FLASH_PAGE_SIZE (0x100u)
|
||||
|
||||
/* 片选脚由 PJ9 软件控制 */
|
||||
#define SPI_FLASH_CS_LOW() gpio_bit_reset(GPIOJ, GPIO_PIN_9)
|
||||
#define SPI_FLASH_CS_HIGH() gpio_bit_set(GPIOJ, GPIO_PIN_9)
|
||||
|
||||
/* 初始化 SPI4 与片选 GPIO */
|
||||
void spi_flash_init(void);
|
||||
/* 擦除 4KB 扇区 */
|
||||
void spi_flash_sector_erase(uint32_t sector_addr);
|
||||
/* 全片擦除(耗时较长) */
|
||||
void spi_flash_bulk_erase(void);
|
||||
/* 页内写(不处理跨页) */
|
||||
void spi_flash_page_write(uint8_t *pbuffer, uint32_t write_addr, uint16_t num_byte_to_write);
|
||||
/* 连续写(自动处理跨页) */
|
||||
void spi_flash_buffer_write(uint8_t *pbuffer, uint32_t write_addr, uint16_t num_byte_to_write);
|
||||
/* 连续读 */
|
||||
void spi_flash_buffer_read(uint8_t *pbuffer, uint32_t read_addr, uint16_t num_byte_to_read);
|
||||
/* 读取 JEDEC ID */
|
||||
uint32_t spi_flash_read_id(void);
|
||||
/* 发起连续读命令序列(随后可重复 spi_flash_read_byte) */
|
||||
void spi_flash_start_read_sequence(uint32_t read_addr);
|
||||
/* 连续读阶段读取 1 字节 */
|
||||
uint8_t spi_flash_read_byte(void);
|
||||
/* SPI 收发 1 字节 */
|
||||
uint8_t spi_flash_send_byte(uint8_t byte);
|
||||
/* SPI 收发 1 半字 */
|
||||
uint16_t spi_flash_send_halfword(uint16_t half_word);
|
||||
/* 置写使能(WREN) */
|
||||
void spi_flash_write_enable(void);
|
||||
/* 轮询 WIP 位,等待写/擦完成 */
|
||||
void spi_flash_wait_for_write_end(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user