22 #ifndef __MEMORY_DRIVER_H
23 #define __MEMORY_DRIVER_H
28 #define MEMORY_DRIVER_RAM 1
29 #define MEMORY_DRIVER_ONE_WIRE 2
30 #define MEMORY_DRIVER_SPI 3
33 #define MEMORY_DRIVER MEMORY_DRIVER_SPI
35 #define MEMORY_DRIVER MEMORY_DRIVER_RAM
38 #ifndef MEMORY_EMPTY_VALUE
39 #define MEMORY_EMPTY_VALUE (uint8_t)0xFF
43 #if defined USE_HAL_DRIVER
49 #define MEMORY_PAGE_SIZE 256
51 #if MEMORY_DRIVER == MEMORY_DRIVER_RAM
52 #define MEMORY_MAX_ADDRESS 0x4000
53 #elif MEMORY_DRIVER == MEMORY_DRIVER_ONE_WIRE
54 #define MEMORY_MAX_ADDRESS 0x50000
55 #elif MEMORY_DRIVER == MEMORY_DRIVER_SPI
57 #define MEMORY_MAX_ADDRESS 0x1000000
62 #define FS_VARIANT_U 0x55
64 #define FS_VARIANT_X 0x58
66 #define FS_VARIANT_S 0x53
68 #define FS_VARIANT_L 0x4C
71 #define FS_SIZE_VARIANT FS_VARIANT_L
94 uint8_t (*Init)(
void *hw_object,
void* GPIOx, uint16_t GPIO_Pin);
102 uint16_t (*Read)(uint32_t addr,uint8_t *buf,uint16_t n);
110 uint16_t (*Write)(uint32_t addr,uint8_t *buf,int32_t n);
115 uint8_t (*IsBusy)(void);
120 uint8_t (*EraseAll)(void);
127 uint8_t (*EraseSector)(uint32_t addr_start);
132 uint8_t (*PowerUp)(void);
137 uint8_t (*PowerDown)(void);
162 uint8_t (*Capacity)(void);
170 uint8_t (*Manufacturer)(void);
174 uint8_t (*Type)(void);
179 uint64_t (*Id)(void);