11 #define XFLASH_STATUS_BUSY 0x01
12 #define XFLASH_STATUS_WEL 0x02
13 #define XFLASH_STATUS_BP0 0x04
14 #define XFLASH_STATUS_BP1 0x08
15 #define XFLASH_STATUS_TB 0x20
16 #define XFLASH_STATUS_SRP 0x80
18 #define XFLASH_SPI_RATE 0
19 #define XFLASH_SPCR SPI_SPCR(XFLASH_SPI_RATE, 1, 1, 1, 0)
20 #define XFLASH_SPSR SPI_SPSR(XFLASH_SPI_RATE)
22 #define XFLASH_SPI_ENTER() spi_setup(XFLASH_SPCR, XFLASH_SPSR)
24 #if defined(__cplusplus)
29 extern int8_t xflash_init(
void);
30 extern void xflash_enable_wr(
void);
31 extern void xflash_disable_wr(
void);
32 extern uint8_t xflash_rd_status_reg(
void);
34 extern void w25x20cl_wr_status_reg(uint8_t val);
36 extern void xflash_rd_data(uint32_t addr, uint8_t* data, uint16_t cnt);
38 extern void xflash_sector_erase(uint32_t addr);
39 extern void xflash_block32_erase(uint32_t addr);
40 extern void xflash_block64_erase(uint32_t addr);
41 extern void xflash_chip_erase(
void);
42 extern void xflash_rd_uid(uint8_t* uid);
43 extern void xflash_wait_busy(
void);
46 extern void xflash_page_program(uint32_t addr, uint8_t* data, uint16_t cnt);
49 extern void xflash_page_program_P(uint32_t addr, uint8_t* data, uint16_t cnt);
54 extern void xflash_multipage_program(uint32_t addr, uint8_t* data, uint16_t cnt);
56 #if defined(__cplusplus)