#ifndef _SPI1_FLASH_H
#define _SPI1_FLASH_H
#include "include.h"
/*!                SPI_MODE
 * SPI_2WIRE_MODE:      CLK,DI/DO   (240Ω resistors between DI and DO) ;
 *
 * SPI_3WIRE_MODE:      CLK,DI,DO
 *
 * SPI_2BIT_BID_MODE:   CLK,2-DI/DO
 *
 * SPI_4BIT_BID_MODE:   CLK,4-DI/DO
 */
#define SPI_MODE                SPI_3WIRE_MODE//SPI_2WIRE_MODE
#define SPIFALSH_BAUD           (500000)    //SPI baud rate 500K

void spi1_init(u8 mode,u32 baud);
void spiflash_run(void);
void spiflash1_read(void *buf, u32 addr, u32 len);
void spiflash1_write(void *buf, u32 addr, u32 len);
u32 spiflash1_id_read(void);
void spiflash1_erase(u32 addr);
void spiflash1_erase_block(u32 addr);
bool is_exspiflash_online(void);

bool exspiflash_init(void);
void write_music_bin_to_spiflash(void);
extern void register_spi_read_function(void (* read_func)(void *buf, u32 addr, u32 len));
#endif
