| LibDriver W25QXX 1.0.0 W25QXX full function driver

driver_w25qxx.h
Go to the documentation of this file.
1
37 #ifndef DRIVER_W25QXX_H
38 #define DRIVER_W25QXX_H
39
40 #include <stdint.h>
41 #include <stdio.h>
42 #include <string.h>
43
44 #ifdef __cplusplus
45 extern "C"{
46 #endif
47
62 typedef enum
63 {
64 W25Q80 = 0XEF13U,
65 W25Q16 = 0XEF14U,
66 W25Q32 = 0XEF15U,
67 W25Q64 = 0XEF16U,
68 W25Q128 = 0XEF17U,
69 W25Q256 = 0XEF18U,
70 } w25qxx_type_t;
71
75 typedef enum
76 {
77 W25QXX_INTERFACE_SPI = 0x00,
78 W25QXX_INTERFACE_QSPI = 0x01,
79 } w25qxx_interface_t;
80
84 typedef enum
85 {
86 W25QXX_BOOL_FALSE = 0x00,
87 W25QXX_BOOL_TRUE = 0x01,
88 } w25qxx_bool_t;
89
93 typedef enum
94 {
95 W25QXX_ADDRESS_MODE_3_BYTE = 0x00,
96 W25QXX_ADDRESS_MODE_4_BYTE = 0x01,
97 } w25qxx_address_mode_t;
98
111 typedef enum
112 {
113 W25QXX_QSPI_READ_DUMMY_2_33MHZ = 0x00,
114 W25QXX_QSPI_READ_DUMMY_4_55MHZ = 0x01,
115 W25QXX_QSPI_READ_DUMMY_6_80MHZ = 0x02,
116 W25QXX_QSPI_READ_DUMMY_8_80MHZ = 0x03,
117 } w25qxx_qspi_read_dummy_t;
118
122 typedef enum
123 {
124 W25QXX_QSPI_READ_WRAP_LENGTH_8_BYTE = 0x00,
125 W25QXX_QSPI_READ_WRAP_LENGTH_16_BYTE = 0x01,
126 W25QXX_QSPI_READ_WRAP_LENGTH_32_BYTE = 0x02,
127 W25QXX_QSPI_READ_WRAP_LENGTH_64_BYTE = 0x03,
128 } w25qxx_qspi_read_wrap_length_t;
129
130
134 typedef enum
135 {
136 W25QXX_SECURITY_REGISTER_1 = 0x10,
137 W25QXX_SECURITY_REGISTER_2 = 0x20,
138 W25QXX_SECURITY_REGISTER_3 = 0x30,
139 } w25qxx_security_register_t;
140
144 typedef enum
145 {
146 W25QXX_BURST_WRAP_NONE = 0x10,
147 W25QXX_BURST_WRAP_8_BYTE = 0x00,
148 W25QXX_BURST_WRAP_16_BYTE = 0x20,
149 W25QXX_BURST_WRAP_32_BYTE = 0x40,
150 W25QXX_BURST_WRAP_64_BYTE = 0x60,
151 } w25qxx_burst_wrap_t;
152
156 typedef enum
157 {
158 W25QXX_STATUS1_STATUS_REGISTER_PROTECT_0 = (1 << 7),
159 W25QXX_STATUS1_SECTOR_PROTECT_OR_TOP_BOTTOM_PROTECT = (1 << 6),
160 W25QXX_STATUS1_TOP_BOTTOM_PROTECT_OR_BLOCK_PROTECT_3 = (1 << 5),
161 W25QXX_STATUS1_BLOCK_PROTECT_2 = (1 << 4),
162 W25QXX_STATUS1_BLOCK_PROTECT_1 = (1 << 3),
163 W25QXX_STATUS1_BLOCK_PROTECT_0 = (1 << 2),
164 W25QXX_STATUS1_WRITE_ENABLE_LATCH = (1 << 1),
165 W25QXX_STATUS1_ERASE_WRITE_PROGRESS = (1 << 0),
166 } w25qxx_status1_t;
167
171 typedef enum
172 {
173 W25QXX_STATUS2_SUSPEND_STATUS = (1 << 7),
174 W25QXX_STATUS2_COMPLEMENT_PROTECT = (1 << 6),
175 W25QXX_STATUS2_SECURITY_REGISTER_3_LOCK_BITS = (1 << 5),
176 W25QXX_STATUS2_SECURITY_REGISTER_2_LOCK_BITS = (1 << 4),
177 W25QXX_STATUS2_SECURITY_REGISTER_1_LOCK_BITS = (1 << 3),
178 W25QXX_STATUS2_QUAD_ENABLE = (1 << 1),
179 W25QXX_STATUS2_STATUS_REGISTER_PROTECT_1 = (1 << 0),
180 } w25qxx_status2_t;
181
185 typedef enum
186 {
187 W25QXX_STATUS3_HOLD_RESET_FUNCTION = (1 << 7),
188 W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_100_PERCENTAGE = (0 << 5),
189 W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_75_PERCENTAGE = (1 << 5),
190 W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_50_PERCENTAGE = (2 << 5),
191 W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_25_PERCENTAGE = (3 << 5),
192 W25QXX_STATUS3_WRITE_PROTECT_SELECTION = (1 << 2),
193 W25QXX_STATUS3_POWER_UP_ADDRESS_MODE = (1 << 1),
194 W25QXX_STATUS3_CURRENT_ADDRESS_MODE = (1 << 0),
195 } w25qxx_status3_t;
196
209 typedef struct w25qxx_handle_s
210 {
211 uint8_t (*spi_qspi_init)(void);
212 uint8_t (*spi_qspi_deinit)(void);
213 uint8_t (*spi_qspi_write_read)(uint8_t instruction, uint8_t instruction_line,
214 uint32_t address, uint8_t address_line, uint8_t address_len,
215 uint32_t alternate, uint8_t alternate_line, uint8_t alternate_len,
216 uint8_t dummy, uint8_t *in_buf, uint32_t in_len,
217 uint8_t *out_buf, uint32_t out_len, uint8_t data_line);
218 void (*delay_ms)(uint32_t ms);
219 void (*delay_us)(uint32_t us);
220 void (*debug_print)(const char *const fmt, ...);
221 uint8_t inited;
222 uint16_t type;
223 uint8_t address_mode;
224 uint8_t param;
225 uint8_t dummy;
226 uint8_t dual_quad_spi_enable;
227 uint8_t spi_qspi;
228 uint8_t buf[256 + 6];
229 uint8_t buf_4k[4096 + 1];
230 } w25qxx_handle_t;
231
235 typedef struct w25qxx_info_s
236 {
237 char chip_name[32];
238 char manufacturer_name[32];
239 char interface[16];
240 float supply_voltage_min_v;
241 float supply_voltage_max_v;
242 float max_current_ma;
243 float temperature_min;
244 float temperature_max;
245 uint32_t driver_version;
246 } w25qxx_info_t;
247
265 #define DRIVER_W25QXX_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
266
273 #define DRIVER_W25QXX_LINK_SPI_QSPI_INIT(HANDLE, FUC) (HANDLE)->spi_qspi_init = FUC
274
281 #define DRIVER_W25QXX_LINK_SPI_QSPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_qspi_deinit = FUC
282
289 #define DRIVER_W25QXX_LINK_SPI_QSPI_WRITE_READ(HANDLE, FUC) (HANDLE)->spi_qspi_write_read = FUC
290
297 #define DRIVER_W25QXX_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
298
305 #define DRIVER_W25QXX_LINK_DELAY_US(HANDLE, FUC) (HANDLE)->delay_us = FUC
306
313 #define DRIVER_W25QXX_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
314
334 uint8_t w25qxx_info(w25qxx_info_t *info);
335
345 uint8_t w25qxx_set_dual_quad_spi(w25qxx_handle_t *handle, w25qxx_bool_t enable);
346
356 uint8_t w25qxx_get_dual_quad_spi(w25qxx_handle_t *handle, w25qxx_bool_t *enable);
357
367 uint8_t w25qxx_set_type(w25qxx_handle_t *handle, w25qxx_type_t type);
368
378 uint8_t w25qxx_get_type(w25qxx_handle_t *handle, w25qxx_type_t *type);
379
389 uint8_t w25qxx_set_interface(w25qxx_handle_t *handle, w25qxx_interface_t interface);
390
400 uint8_t w25qxx_get_interface(w25qxx_handle_t *handle, w25qxx_interface_t *interface);
401
414 uint8_t w25qxx_set_address_mode(w25qxx_handle_t *handle, w25qxx_address_mode_t mode);
415
426 uint8_t w25qxx_get_address_mode(w25qxx_handle_t *handle, w25qxx_address_mode_t *mode);
427
443 uint8_t w25qxx_init(w25qxx_handle_t *handle);
444
456 uint8_t w25qxx_deinit(w25qxx_handle_t *handle);
457
472 uint8_t w25qxx_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
473
489 uint8_t w25qxx_write(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
490
506 uint8_t w25qxx_only_spi_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
507
522 uint8_t w25qxx_fast_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
523
541 uint8_t w25qxx_page_program(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint16_t len);
542
557 uint8_t w25qxx_sector_erase_4k(w25qxx_handle_t *handle, uint32_t addr);
558
573 uint8_t w25qxx_block_erase_32k(w25qxx_handle_t *handle, uint32_t addr);
574
589 uint8_t w25qxx_block_erase_64k(w25qxx_handle_t *handle, uint32_t addr);
590
602 uint8_t w25qxx_chip_erase(w25qxx_handle_t *handle);
603
614 uint8_t w25qxx_power_down(w25qxx_handle_t *handle);
615
626 uint8_t w25qxx_release_power_down(w25qxx_handle_t *handle);
627
640 uint8_t w25qxx_get_manufacturer_device_id(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id);
641
669 uint8_t w25qxx_fast_read_dual_output(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
670
687 uint8_t w25qxx_fast_read_quad_output(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
688
705 uint8_t w25qxx_fast_read_dual_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
706
722 uint8_t w25qxx_fast_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
723
740 uint8_t w25qxx_word_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
741
758 uint8_t w25qxx_octal_word_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len);
759
778 uint8_t w25qxx_page_program_quad_input(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint16_t len);
779
790 uint8_t w25qxx_enable_write(w25qxx_handle_t *handle);
791
802 uint8_t w25qxx_enable_volatile_sr_write(w25qxx_handle_t *handle);
803
814 uint8_t w25qxx_disable_write(w25qxx_handle_t *handle);
815
827 uint8_t w25qxx_get_status1(w25qxx_handle_t *handle, uint8_t *status);
828
840 uint8_t w25qxx_get_status2(w25qxx_handle_t *handle, uint8_t *status);
841
853 uint8_t w25qxx_get_status3(w25qxx_handle_t *handle, uint8_t *status);
854
867 uint8_t w25qxx_set_status1(w25qxx_handle_t *handle, uint8_t status);
868
881 uint8_t w25qxx_set_status2(w25qxx_handle_t *handle, uint8_t status);
882
895 uint8_t w25qxx_set_status3(w25qxx_handle_t *handle, uint8_t status);
896
907 uint8_t w25qxx_erase_program_suspend(w25qxx_handle_t *handle);
908
919 uint8_t w25qxx_erase_program_resume(w25qxx_handle_t *handle);
920
936 uint8_t w25qxx_get_manufacturer_device_id_dual_io(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id);
937
953 uint8_t w25qxx_get_manufacturer_device_id_quad_io(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id);
954
967 uint8_t w25qxx_get_jedec_id(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t device_id[2]);
968
979 uint8_t w25qxx_global_block_lock(w25qxx_handle_t *handle);
980
991 uint8_t w25qxx_global_block_unlock(w25qxx_handle_t *handle);
992
1006 uint8_t w25qxx_set_read_parameters(w25qxx_handle_t *handle, w25qxx_qspi_read_dummy_t dummy, w25qxx_qspi_read_wrap_length_t length);
1007
1019 uint8_t w25qxx_enter_qspi_mode(w25qxx_handle_t *handle);
1020
1032 uint8_t w25qxx_exit_qspi_mode(w25qxx_handle_t *handle);
1033
1044 uint8_t w25qxx_enable_reset(w25qxx_handle_t *handle);
1045
1056 uint8_t w25qxx_reset_device(w25qxx_handle_t *handle);
1057
1071 uint8_t w25qxx_get_unique_id(w25qxx_handle_t *handle, uint8_t id[8]);
1072
1085 uint8_t w25qxx_get_sfdp(w25qxx_handle_t *handle, uint8_t sfdp[256]);
1086
1101 uint8_t w25qxx_erase_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num);
1102
1118 uint8_t w25qxx_program_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num, uint8_t data[256]);
1119
1135 uint8_t w25qxx_read_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num, uint8_t data[256]);
1136
1149 uint8_t w25qxx_individual_block_lock(w25qxx_handle_t *handle, uint32_t addr);
1150
1163 uint8_t w25qxx_individual_block_unlock(w25qxx_handle_t *handle, uint32_t addr);
1164
1178 uint8_t w25qxx_read_block_lock(w25qxx_handle_t *handle, uint32_t addr, uint8_t *value);
1179
1192 uint8_t w25qxx_set_burst_with_wrap(w25qxx_handle_t *handle, w25qxx_burst_wrap_t wrap);
1193
1229 uint8_t w25qxx_write_read_reg(w25qxx_handle_t *handle, uint8_t instruction, uint8_t instruction_line,
1230 uint32_t address, uint8_t address_line, uint8_t address_len,
1231 uint32_t alternate, uint8_t alternate_line, uint8_t alternate_len,
1232 uint8_t dummy, uint8_t *in_buf, uint32_t in_len,
1233 uint8_t *out_buf, uint32_t out_len, uint8_t data_line);
1234
1243 #ifdef __cplusplus
1244 }
1245 #endif
1246
1247 #endif
w25qxx_erase_program_resume
uint8_t w25qxx_erase_program_resume(w25qxx_handle_t *handle)
resume erase or program
Definition: driver_w25qxx.c:1722
w25qxx_status2_t
w25qxx_status2_t
w25qxx status 2 enumeration definition
Definition: driver_w25qxx.h:172
w25qxx_enable_volatile_sr_write
uint8_t w25qxx_enable_volatile_sr_write(w25qxx_handle_t *handle)
enable volatile sr writing
Definition: driver_w25qxx.c:501
w25qxx_get_unique_id
uint8_t w25qxx_get_unique_id(w25qxx_handle_t *handle, uint8_t id[8])
get the unique id
Definition: driver_w25qxx.c:2764
w25qxx_get_manufacturer_device_id_dual_io
uint8_t w25qxx_get_manufacturer_device_id_dual_io(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id)
get the manufacturer && device id information with dual io
Definition: driver_w25qxx.c:2038
w25qxx_page_program_quad_input
uint8_t w25qxx_page_program_quad_input(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint16_t len)
quad page program with quad input
Definition: driver_w25qxx.c:4920
w25qxx_get_sfdp
uint8_t w25qxx_get_sfdp(w25qxx_handle_t *handle, uint8_t sfdp[256])
get the sfdp
Definition: driver_w25qxx.c:2880
w25qxx_set_status1
uint8_t w25qxx_set_status1(w25qxx_handle_t *handle, uint8_t status)
set the status 1
Definition: driver_w25qxx.c:863
w25qxx_reset_device
uint8_t w25qxx_reset_device(w25qxx_handle_t *handle)
reset the device
Definition: driver_w25qxx.c:2690
w25qxx_qspi_read_wrap_length_t
w25qxx_qspi_read_wrap_length_t
w25qxx qspi read wrap length enumeration definition
Definition: driver_w25qxx.h:123
w25qxx_read_security_register
uint8_t w25qxx_read_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num, uint8_t data[256])
read the security register
Definition: driver_w25qxx.c:3344
w25qxx_program_security_register
uint8_t w25qxx_program_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num, uint8_t data[256])
program the security register
Definition: driver_w25qxx.c:3147
w25qxx_individual_block_lock
uint8_t w25qxx_individual_block_lock(w25qxx_handle_t *handle, uint32_t addr)
lock the individual block
Definition: driver_w25qxx.c:6094
w25qxx_read_block_lock
uint8_t w25qxx_read_block_lock(w25qxx_handle_t *handle, uint32_t addr, uint8_t *value)
read the block lock
Definition: driver_w25qxx.c:6529
w25qxx_get_manufacturer_device_id_quad_io
uint8_t w25qxx_get_manufacturer_device_id_quad_io(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id)
get the manufacturer && device id information with quad io
Definition: driver_w25qxx.c:2122
w25qxx_exit_qspi_mode
uint8_t w25qxx_exit_qspi_mode(w25qxx_handle_t *handle)
exit the qspi mode
Definition: driver_w25qxx.c:2572
w25qxx_global_block_unlock
uint8_t w25qxx_global_block_unlock(w25qxx_handle_t *handle)
unlock the whole block
Definition: driver_w25qxx.c:2354
w25qxx_qspi_read_dummy_t
w25qxx_qspi_read_dummy_t
w25qxx qspi read dummy enumeration definition
Definition: driver_w25qxx.h:112
w25qxx_fast_read_dual_output
uint8_t w25qxx_fast_read_dual_output(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read with dual output in the fast mode
Definition: driver_w25qxx.c:3858
w25qxx_individual_block_unlock
uint8_t w25qxx_individual_block_unlock(w25qxx_handle_t *handle, uint32_t addr)
unlock the individual block
Definition: driver_w25qxx.c:6311
w25qxx_security_register_t
w25qxx_security_register_t
w25qxx security register enumeration definition
Definition: driver_w25qxx.h:135
w25qxx_octal_word_read_quad_io
uint8_t w25qxx_octal_word_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
octal word read with quad io
Definition: driver_w25qxx.c:4459
w25qxx_get_jedec_id
uint8_t w25qxx_get_jedec_id(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t device_id[2])
get the jedec id information
Definition: driver_w25qxx.c:2203
w25qxx_burst_wrap_t
w25qxx_burst_wrap_t
w25qxx burst wrap enumeration definition
Definition: driver_w25qxx.h:145
w25qxx_get_status3
uint8_t w25qxx_get_status3(w25qxx_handle_t *handle, uint8_t *status)
get the status 3
Definition: driver_w25qxx.c:789
w25qxx_set_read_parameters
uint8_t w25qxx_set_read_parameters(w25qxx_handle_t *handle, w25qxx_qspi_read_dummy_t dummy, w25qxx_qspi_read_wrap_length_t length)
set the read parameters
Definition: driver_w25qxx.c:2427
w25qxx_status1_t
w25qxx_status1_t
w25qxx status 1 enumeration definition
Definition: driver_w25qxx.h:157
w25qxx_get_status2
uint8_t w25qxx_get_status2(w25qxx_handle_t *handle, uint8_t *status)
get the status 2
Definition: driver_w25qxx.c:716
w25qxx_enter_qspi_mode
uint8_t w25qxx_enter_qspi_mode(w25qxx_handle_t *handle)
enter the qspi mode
Definition: driver_w25qxx.c:2494
w25qxx_get_status1
uint8_t w25qxx_get_status1(w25qxx_handle_t *handle, uint8_t *status)
get the status 1
Definition: driver_w25qxx.c:643
w25qxx_set_status2
uint8_t w25qxx_set_status2(w25qxx_handle_t *handle, uint8_t status)
set the status 2
Definition: driver_w25qxx.c:1062
w25qxx_global_block_lock
uint8_t w25qxx_global_block_lock(w25qxx_handle_t *handle)
lock the whole block
Definition: driver_w25qxx.c:2284
w25qxx_enable_reset
uint8_t w25qxx_enable_reset(w25qxx_handle_t *handle)
enable the reset
Definition: driver_w25qxx.c:2619
w25qxx_fast_read_quad_io
uint8_t w25qxx_fast_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read with quad io in the fast mode
Definition: driver_w25qxx.c:4184
w25qxx_disable_write
uint8_t w25qxx_disable_write(w25qxx_handle_t *handle)
disable writing
Definition: driver_w25qxx.c:572
w25qxx_set_burst_with_wrap
uint8_t w25qxx_set_burst_with_wrap(w25qxx_handle_t *handle, w25qxx_burst_wrap_t wrap)
set the burst with wrap
Definition: driver_w25qxx.c:6746
w25qxx_erase_program_suspend
uint8_t w25qxx_erase_program_suspend(w25qxx_handle_t *handle)
suspend erase or program
Definition: driver_w25qxx.c:1650
w25qxx_fast_read_dual_io
uint8_t w25qxx_fast_read_dual_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read with dual io in the fast mode
Definition: driver_w25qxx.c:4076
w25qxx_status3_t
w25qxx_status3_t
w25qxx status 3 enumeration definition
Definition: driver_w25qxx.h:186
w25qxx_word_read_quad_io
uint8_t w25qxx_word_read_quad_io(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
word read with quad io
Definition: driver_w25qxx.c:4350
w25qxx_set_status3
uint8_t w25qxx_set_status3(w25qxx_handle_t *handle, uint8_t status)
set the status 3
Definition: driver_w25qxx.c:1261
w25qxx_enable_write
uint8_t w25qxx_enable_write(w25qxx_handle_t *handle)
enable writing
Definition: driver_w25qxx.c:431
w25qxx_erase_security_register
uint8_t w25qxx_erase_security_register(w25qxx_handle_t *handle, w25qxx_security_register_t num)
erase the security register
Definition: driver_w25qxx.c:2952
w25qxx_fast_read_quad_output
uint8_t w25qxx_fast_read_quad_output(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read with quad output in the fast mode
Definition: driver_w25qxx.c:3967
W25QXX_STATUS2_SECURITY_REGISTER_3_LOCK_BITS
@ W25QXX_STATUS2_SECURITY_REGISTER_3_LOCK_BITS
Definition: driver_w25qxx.h:175
W25QXX_STATUS2_SECURITY_REGISTER_2_LOCK_BITS
@ W25QXX_STATUS2_SECURITY_REGISTER_2_LOCK_BITS
Definition: driver_w25qxx.h:176
W25QXX_STATUS2_SUSPEND_STATUS
@ W25QXX_STATUS2_SUSPEND_STATUS
Definition: driver_w25qxx.h:173
W25QXX_STATUS2_COMPLEMENT_PROTECT
@ W25QXX_STATUS2_COMPLEMENT_PROTECT
Definition: driver_w25qxx.h:174
W25QXX_STATUS2_STATUS_REGISTER_PROTECT_1
@ W25QXX_STATUS2_STATUS_REGISTER_PROTECT_1
Definition: driver_w25qxx.h:179
W25QXX_STATUS2_SECURITY_REGISTER_1_LOCK_BITS
@ W25QXX_STATUS2_SECURITY_REGISTER_1_LOCK_BITS
Definition: driver_w25qxx.h:177
W25QXX_STATUS2_QUAD_ENABLE
@ W25QXX_STATUS2_QUAD_ENABLE
Definition: driver_w25qxx.h:178
W25QXX_QSPI_READ_WRAP_LENGTH_8_BYTE
@ W25QXX_QSPI_READ_WRAP_LENGTH_8_BYTE
Definition: driver_w25qxx.h:124
W25QXX_QSPI_READ_WRAP_LENGTH_64_BYTE
@ W25QXX_QSPI_READ_WRAP_LENGTH_64_BYTE
Definition: driver_w25qxx.h:127
W25QXX_QSPI_READ_WRAP_LENGTH_32_BYTE
@ W25QXX_QSPI_READ_WRAP_LENGTH_32_BYTE
Definition: driver_w25qxx.h:126
W25QXX_QSPI_READ_WRAP_LENGTH_16_BYTE
@ W25QXX_QSPI_READ_WRAP_LENGTH_16_BYTE
Definition: driver_w25qxx.h:125
W25QXX_QSPI_READ_DUMMY_4_55MHZ
@ W25QXX_QSPI_READ_DUMMY_4_55MHZ
Definition: driver_w25qxx.h:114
W25QXX_QSPI_READ_DUMMY_6_80MHZ
@ W25QXX_QSPI_READ_DUMMY_6_80MHZ
Definition: driver_w25qxx.h:115
W25QXX_QSPI_READ_DUMMY_2_33MHZ
@ W25QXX_QSPI_READ_DUMMY_2_33MHZ
Definition: driver_w25qxx.h:113
W25QXX_QSPI_READ_DUMMY_8_80MHZ
@ W25QXX_QSPI_READ_DUMMY_8_80MHZ
Definition: driver_w25qxx.h:116
W25QXX_SECURITY_REGISTER_2
@ W25QXX_SECURITY_REGISTER_2
Definition: driver_w25qxx.h:137
W25QXX_SECURITY_REGISTER_3
@ W25QXX_SECURITY_REGISTER_3
Definition: driver_w25qxx.h:138
W25QXX_SECURITY_REGISTER_1
@ W25QXX_SECURITY_REGISTER_1
Definition: driver_w25qxx.h:136
W25QXX_BURST_WRAP_64_BYTE
@ W25QXX_BURST_WRAP_64_BYTE
Definition: driver_w25qxx.h:150
W25QXX_BURST_WRAP_8_BYTE
@ W25QXX_BURST_WRAP_8_BYTE
Definition: driver_w25qxx.h:147
W25QXX_BURST_WRAP_32_BYTE
@ W25QXX_BURST_WRAP_32_BYTE
Definition: driver_w25qxx.h:149
W25QXX_BURST_WRAP_NONE
@ W25QXX_BURST_WRAP_NONE
Definition: driver_w25qxx.h:146
W25QXX_BURST_WRAP_16_BYTE
@ W25QXX_BURST_WRAP_16_BYTE
Definition: driver_w25qxx.h:148
W25QXX_STATUS1_STATUS_REGISTER_PROTECT_0
@ W25QXX_STATUS1_STATUS_REGISTER_PROTECT_0
Definition: driver_w25qxx.h:158
W25QXX_STATUS1_WRITE_ENABLE_LATCH
@ W25QXX_STATUS1_WRITE_ENABLE_LATCH
Definition: driver_w25qxx.h:164
W25QXX_STATUS1_BLOCK_PROTECT_1
@ W25QXX_STATUS1_BLOCK_PROTECT_1
Definition: driver_w25qxx.h:162
W25QXX_STATUS1_TOP_BOTTOM_PROTECT_OR_BLOCK_PROTECT_3
@ W25QXX_STATUS1_TOP_BOTTOM_PROTECT_OR_BLOCK_PROTECT_3
Definition: driver_w25qxx.h:160
W25QXX_STATUS1_BLOCK_PROTECT_0
@ W25QXX_STATUS1_BLOCK_PROTECT_0
Definition: driver_w25qxx.h:163
W25QXX_STATUS1_SECTOR_PROTECT_OR_TOP_BOTTOM_PROTECT
@ W25QXX_STATUS1_SECTOR_PROTECT_OR_TOP_BOTTOM_PROTECT
Definition: driver_w25qxx.h:159
W25QXX_STATUS1_BLOCK_PROTECT_2
@ W25QXX_STATUS1_BLOCK_PROTECT_2
Definition: driver_w25qxx.h:161
W25QXX_STATUS1_ERASE_WRITE_PROGRESS
@ W25QXX_STATUS1_ERASE_WRITE_PROGRESS
Definition: driver_w25qxx.h:165
W25QXX_STATUS3_CURRENT_ADDRESS_MODE
@ W25QXX_STATUS3_CURRENT_ADDRESS_MODE
Definition: driver_w25qxx.h:194
W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_75_PERCENTAGE
@ W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_75_PERCENTAGE
Definition: driver_w25qxx.h:189
W25QXX_STATUS3_WRITE_PROTECT_SELECTION
@ W25QXX_STATUS3_WRITE_PROTECT_SELECTION
Definition: driver_w25qxx.h:192
W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_50_PERCENTAGE
@ W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_50_PERCENTAGE
Definition: driver_w25qxx.h:190
W25QXX_STATUS3_HOLD_RESET_FUNCTION
@ W25QXX_STATUS3_HOLD_RESET_FUNCTION
Definition: driver_w25qxx.h:187
W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_100_PERCENTAGE
@ W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_100_PERCENTAGE
Definition: driver_w25qxx.h:188
W25QXX_STATUS3_POWER_UP_ADDRESS_MODE
@ W25QXX_STATUS3_POWER_UP_ADDRESS_MODE
Definition: driver_w25qxx.h:193
W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_25_PERCENTAGE
@ W25QXX_STATUS3_OUTPUT_DRIVER_STRENGTH_25_PERCENTAGE
Definition: driver_w25qxx.h:191
w25qxx_chip_erase
uint8_t w25qxx_chip_erase(w25qxx_handle_t *handle)
erase the chip
Definition: driver_w25qxx.c:1459
w25qxx_release_power_down
uint8_t w25qxx_release_power_down(w25qxx_handle_t *handle)
release power down
Definition: driver_w25qxx.c:1875
w25qxx_only_spi_read
uint8_t w25qxx_only_spi_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read only in the spi interface
Definition: driver_w25qxx.c:3465
w25qxx_block_erase_32k
uint8_t w25qxx_block_erase_32k(w25qxx_handle_t *handle, uint32_t addr)
erase the 32k block
Definition: driver_w25qxx.c:5419
w25qxx_get_address_mode
uint8_t w25qxx_get_address_mode(w25qxx_handle_t *handle, w25qxx_address_mode_t *mode)
get the chip address mode
Definition: driver_w25qxx.c:405
w25qxx_set_interface
uint8_t w25qxx_set_interface(w25qxx_handle_t *handle, w25qxx_interface_t interface)
set the chip interface
Definition: driver_w25qxx.c:259
w25qxx_handle_t
struct w25qxx_handle_s w25qxx_handle_t
w25qxx handle structure definition
w25qxx_info_t
struct w25qxx_info_s w25qxx_info_t
w25qxx information structure definition
w25qxx_page_program
uint8_t w25qxx_page_program(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint16_t len)
page program
Definition: driver_w25qxx.c:4569
w25qxx_set_dual_quad_spi
uint8_t w25qxx_set_dual_quad_spi(w25qxx_handle_t *handle, w25qxx_bool_t enable)
enable or disable the dual quad spi
Definition: driver_w25qxx.c:175
w25qxx_get_type
uint8_t w25qxx_get_type(w25qxx_handle_t *handle, w25qxx_type_t *type)
get the chip type
Definition: driver_w25qxx.c:238
w25qxx_type_t
w25qxx_type_t
w25qxx type enumeration definition
Definition: driver_w25qxx.h:63
w25qxx_get_interface
uint8_t w25qxx_get_interface(w25qxx_handle_t *handle, w25qxx_interface_t *interface)
get the chip interface
Definition: driver_w25qxx.c:280
w25qxx_init
uint8_t w25qxx_init(w25qxx_handle_t *handle)
initialize the chip
Definition: driver_w25qxx.c:6819
w25qxx_get_manufacturer_device_id
uint8_t w25qxx_get_manufacturer_device_id(w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id)
get the manufacturer && device id information
Definition: driver_w25qxx.c:1952
w25qxx_info
uint8_t w25qxx_info(w25qxx_info_t *info)
get chip's information
Definition: driver_w25qxx.c:8566
w25qxx_sector_erase_4k
uint8_t w25qxx_sector_erase_4k(w25qxx_handle_t *handle, uint32_t addr)
erase the 4k sector
Definition: driver_w25qxx.c:5080
w25qxx_deinit
uint8_t w25qxx_deinit(w25qxx_handle_t *handle)
close the chip
Definition: driver_w25qxx.c:7195
w25qxx_address_mode_t
w25qxx_address_mode_t
w25qxx address mode enumeration definition
Definition: driver_w25qxx.h:94
w25qxx_set_type
uint8_t w25qxx_set_type(w25qxx_handle_t *handle, w25qxx_type_t type)
set the chip type
Definition: driver_w25qxx.c:217
w25qxx_write
uint8_t w25qxx_write(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
write data
Definition: driver_w25qxx.c:8415
w25qxx_fast_read
uint8_t w25qxx_fast_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read in the fast mode
Definition: driver_w25qxx.c:3634
w25qxx_interface_t
w25qxx_interface_t
w25qxx interface enumeration definition
Definition: driver_w25qxx.h:76
w25qxx_set_address_mode
uint8_t w25qxx_set_address_mode(w25qxx_handle_t *handle, w25qxx_address_mode_t mode)
set the chip address mode
Definition: driver_w25qxx.c:304
w25qxx_get_dual_quad_spi
uint8_t w25qxx_get_dual_quad_spi(w25qxx_handle_t *handle, w25qxx_bool_t *enable)
get the dual quad spi status
Definition: driver_w25qxx.c:196
w25qxx_power_down
uint8_t w25qxx_power_down(w25qxx_handle_t *handle)
power down
Definition: driver_w25qxx.c:1792
w25qxx_read
uint8_t w25qxx_read(w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
read data
Definition: driver_w25qxx.c:7289
w25qxx_block_erase_64k
uint8_t w25qxx_block_erase_64k(w25qxx_handle_t *handle, uint32_t addr)
erase the 64k block
Definition: driver_w25qxx.c:5758
w25qxx_bool_t
w25qxx_bool_t
w25qxx bool enumeration definition
Definition: driver_w25qxx.h:85
W25Q80
@ W25Q80
Definition: driver_w25qxx.h:64
W25Q64
@ W25Q64
Definition: driver_w25qxx.h:67
W25Q32
@ W25Q32
Definition: driver_w25qxx.h:66
W25Q16
@ W25Q16
Definition: driver_w25qxx.h:65
W25Q128
@ W25Q128
Definition: driver_w25qxx.h:68
W25Q256
@ W25Q256
Definition: driver_w25qxx.h:69
W25QXX_ADDRESS_MODE_3_BYTE
@ W25QXX_ADDRESS_MODE_3_BYTE
Definition: driver_w25qxx.h:95
W25QXX_ADDRESS_MODE_4_BYTE
@ W25QXX_ADDRESS_MODE_4_BYTE
Definition: driver_w25qxx.h:96
W25QXX_INTERFACE_QSPI
@ W25QXX_INTERFACE_QSPI
Definition: driver_w25qxx.h:78
W25QXX_INTERFACE_SPI
@ W25QXX_INTERFACE_SPI
Definition: driver_w25qxx.h:77
W25QXX_BOOL_FALSE
@ W25QXX_BOOL_FALSE
Definition: driver_w25qxx.h:86
W25QXX_BOOL_TRUE
@ W25QXX_BOOL_TRUE
Definition: driver_w25qxx.h:87
w25qxx_write_read_reg
uint8_t w25qxx_write_read_reg(w25qxx_handle_t *handle, uint8_t instruction, uint8_t instruction_line, uint32_t address, uint8_t address_line, uint8_t address_len, uint32_t alternate, uint8_t alternate_line, uint8_t alternate_len, uint8_t dummy, uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len, uint8_t data_line)
write and read register
Definition: driver_w25qxx.c:8535
w25qxx_handle_s
w25qxx handle structure definition
Definition: driver_w25qxx.h:210
w25qxx_handle_s::inited
uint8_t inited
Definition: driver_w25qxx.h:221
w25qxx_handle_s::buf
uint8_t buf[256+6]
Definition: driver_w25qxx.h:228
w25qxx_handle_s::spi_qspi_write_read
uint8_t(* spi_qspi_write_read)(uint8_t instruction, uint8_t instruction_line, uint32_t address, uint8_t address_line, uint8_t address_len, uint32_t alternate, uint8_t alternate_line, uint8_t alternate_len, uint8_t dummy, uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len, uint8_t data_line)
Definition: driver_w25qxx.h:213
w25qxx_handle_s::param
uint8_t param
Definition: driver_w25qxx.h:224
w25qxx_handle_s::delay_ms
void(* delay_ms)(uint32_t ms)
Definition: driver_w25qxx.h:218
w25qxx_handle_s::spi_qspi_deinit
uint8_t(* spi_qspi_deinit)(void)
Definition: driver_w25qxx.h:212
w25qxx_handle_s::address_mode
uint8_t address_mode
Definition: driver_w25qxx.h:223
w25qxx_handle_s::debug_print
void(* debug_print)(const char *const fmt,...)
Definition: driver_w25qxx.h:220
w25qxx_handle_s::delay_us
void(* delay_us)(uint32_t us)
Definition: driver_w25qxx.h:219
w25qxx_handle_s::spi_qspi
uint8_t spi_qspi
Definition: driver_w25qxx.h:227
w25qxx_handle_s::dual_quad_spi_enable
uint8_t dual_quad_spi_enable
Definition: driver_w25qxx.h:226
w25qxx_handle_s::buf_4k
uint8_t buf_4k[4096+1]
Definition: driver_w25qxx.h:229
w25qxx_handle_s::type
uint16_t type
Definition: driver_w25qxx.h:222
w25qxx_handle_s::spi_qspi_init
uint8_t(* spi_qspi_init)(void)
Definition: driver_w25qxx.h:211
w25qxx_handle_s::dummy
uint8_t dummy
Definition: driver_w25qxx.h:225
w25qxx_info_s
w25qxx information structure definition
Definition: driver_w25qxx.h:236
w25qxx_info_s::temperature_max
float temperature_max
Definition: driver_w25qxx.h:244
w25qxx_info_s::supply_voltage_max_v
float supply_voltage_max_v
Definition: driver_w25qxx.h:241
w25qxx_info_s::driver_version
uint32_t driver_version
Definition: driver_w25qxx.h:245
w25qxx_info_s::interface
char interface[16]
Definition: driver_w25qxx.h:239
w25qxx_info_s::temperature_min
float temperature_min
Definition: driver_w25qxx.h:243
w25qxx_info_s::max_current_ma
float max_current_ma
Definition: driver_w25qxx.h:242
w25qxx_info_s::manufacturer_name
char manufacturer_name[32]
Definition: driver_w25qxx.h:238
w25qxx_info_s::supply_voltage_min_v
float supply_voltage_min_v
Definition: driver_w25qxx.h:240
w25qxx_info_s::chip_name
char chip_name[32]
Definition: driver_w25qxx.h:237