36 lines
959 B
C
36 lines
959 B
C
#ifndef __FLASH_H__
|
|
#define __FLASH_H__
|
|
|
|
#include "stdint.h"
|
|
|
|
#define FLASHCMD_PAGE_PROGRAM (0x02)
|
|
#define FLASHCMD_READ_DATA (0x03)
|
|
#define FLASHCMD_WRITE_STATUS (0x01)
|
|
#define FLASHCMD_READ_STATUS (0x05)
|
|
#define FLASHCMD_READ_STATUS2 (0x35)
|
|
#define FLASHCMD_WRITE_ENABLE (0x06)
|
|
#define FLASHCMD_SECTOR_ERASE (0x20)
|
|
#define FLASHCMD_READ_SFDP (0x5A)
|
|
#define FLASHCMD_READ_JEDEC_ID (0x9F)
|
|
|
|
#define SREG_DATA (0x02) // Enable quad-SPI mode
|
|
#define MODE_CONTINUOUS_READ (0xA0)
|
|
|
|
#define FLASH_WRITE_SIZE (256)
|
|
#define FLASH_READ_SIZE (256)
|
|
#define FLASH_ERASE_SIZE (4096)
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void flash_erase(uint32_t addr);
|
|
void flash_write(uint32_t addr, uint8_t *data, uint32_t length);
|
|
void flash_read(uint32_t addr, uint8_t *data, uint32_t length);
|
|
void flash_enter_quad_xip(uint16_t div);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __FLASH_H__ */ |