func_spi_w25qxx.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*********************************************************
  2. //file :hd_dev_gpio.h
  3. //author :libo
  4. //date :2020/05/10
  5. //version :V1.0
  6. //brief :GSP HAL层GPIO接口H文件
  7. *********************************************************/
  8. #ifndef FUNC_SPI_W25QXX_H
  9. #define FUNC_SPI_W25QXX_H
  10. /* Includes----------------------------------------------------------------------------------*/
  11. #include <stdint.h>
  12. /* Public macro------------------------------------------------------------------------------*/
  13. //对于W25Q128
  14. //前25M字节给fatfs用,25M字节后,用于存放字库,字库占用6.01M. 剩余部分,给客户自己用
  15. #define SPI_FLASH_SECTOR_SIZE 512
  16. #define SPI_FLASH_SECTOR_COUNT 1024*16*2 //W25Q256,前25M字节给FATFS占用
  17. #define SPI_FLASH_BLOCK_SIZE 8 //每个BLOCK有8个扇区
  18. //128Mb == 16M byte == 1024*1024*16 == 1024*4*256*16 == 0x400*0x4*0x100*0x10 == 0x1000 BLOCK
  19. //sector size 256*16 == 4k == 4096
  20. //256*120*24 = 491520 = 0x78000 ==480k
  21. /* Public define-----------------------------------------------------------------------------*/
  22. /* Public typedef----------------------------------------------------------------------------*/
  23. typedef uint8_t BYTE;
  24. /* public function---------------------------------------------------------------------------*/
  25. void func_w25q_init(void);
  26. void func_w25q_test(void);
  27. void func_w25q_erase_ship(void);
  28. uint16_t func_w25q_stat(void);
  29. uint8_t func_w25q_bootcnt(void);
  30. //void func_w25q_spi_flash(void);
  31. int func_w25q_hal_main(void);
  32. uint8_t func_w25q_disk_ioctl (
  33. BYTE pdrv, /* Physical drive nmuber (0..) */
  34. BYTE cmd, /* Control code */
  35. void *buff /* Buffer to send/receive control data */
  36. );
  37. #endif /*********FUNC_SPI_W25QXX_H****************/
  38. /******************************the end of file************************************************/