update w5500 w25q

This commit is contained in:
2026-02-03 12:01:38 +08:00
parent f56744ad7a
commit 270141591e
12 changed files with 6823 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
#ifndef __BSP_W25Q_H__
#define __BSP_W25Q_H__
#include "main.h"
#ifdef __cplusplus
extern "C" {
#endif
/* w25q32jvssiq <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
#define W25Q32_FLASH_SIZE (0x400000UL) /* 4mb = 32mb */
#define W25Q32_PAGE_SIZE (256) /* ҳ<><D2B3>С */
#define W25Q32_SECTOR_SIZE (4096) /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С */
#define W25Q32_BLOCK_SIZE (65536) /* <20><><EFBFBD><EFBFBD>С */
/* w25q32jvssiq <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
#define W25Q32_WRITE_ENABLE 0x06
#define W25Q32_WRITE_DISABLE 0x04
#define W25Q32_READ_STATUS_REG1 0x05
#define W25Q32_WRITE_STATUS_REG 0x01
#define W25Q32_READ_DATA 0x03
#define W25Q32_FAST_READ 0x0B
#define W25Q32_PAGE_PROGRAM 0x02
#define W25Q32_SECTOR_ERASE 0x20
#define W25Q32_BLOCK_ERASE_32K 0x52
#define W25Q32_BLOCK_ERASE_64K 0xD8
#define W25Q32_CHIP_ERASE 0xC7
#define W25Q32_POWER_DOWN 0xB9
#define W25Q32_RELEASE_POWER_DOWN 0xAB
#define W25Q32_DEVICE_ID 0xAB
#define W25Q32_MANUFACTURER_ID 0x90
#define W25Q32_JEDEC_ID 0x9F
/* ״̬<D7B4>Ĵ<EFBFBD><C4B4><EFBFBD>λ */
#define W25Q32_STATUS_BUSY (1 << 0)
#define W25Q32_STATUS_WRITE_EN (1 << 1)
/* flash <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD> */
#define W25Q32_USER_DATA_ADDR 0x000000 /* <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ݴ洢<DDB4><E6B4A2>ʼ<EFBFBD><CABC>ַ */
#define W25Q32_USER_DATA_SIZE 0x100000 /* <20><>Լ1mb<6D>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> */
/* w25q32 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9> */
typedef struct {
void (*init)(void);
void (*read)(uint32_t addr, uint8_t *data, uint32_t len);
void (*write)(uint32_t addr, uint8_t *data, uint32_t len);
void (*chip_erase)(void);
} w25q32_t;
/* ȫ<>ֶ<EFBFBD><D6B6><EFBFBD> */
extern w25q32_t w25q32;
#ifdef __cplusplus
}
#endif
#endif /* __BSP_W25Q_H__ */