| LibDriver W25QXX 1.0.0 W25QXX full function driver

driver_w25qxx_register_test.c
Go to the documentation of this file.
1
37 #include "driver_w25qxx_register_test.h"
38
39 static w25qxx_handle_t gs_handle;
51 uint8_t w25qxx_register_test(w25qxx_type_t type, w25qxx_interface_t interface, w25qxx_bool_t dual_quad_spi_enable)
52 {
53 uint8_t res;
54 uint8_t status;
55 uint8_t manufacturer;
56 uint8_t device_id[2];
57 uint8_t id[8];
58 w25qxx_info_t info;
59 w25qxx_type_t type_check;
60 w25qxx_interface_t interface_check;
61
62 /* link interface function */
63 DRIVER_W25QXX_LINK_INIT(&gs_handle, w25qxx_handle_t);
64 DRIVER_W25QXX_LINK_SPI_QSPI_INIT(&gs_handle, w25qxx_interface_spi_qspi_init);
65 DRIVER_W25QXX_LINK_SPI_QSPI_DEINIT(&gs_handle, w25qxx_interface_spi_qspi_deinit);
66 DRIVER_W25QXX_LINK_SPI_QSPI_WRITE_READ(&gs_handle, w25qxx_interface_spi_qspi_write_read);
67 DRIVER_W25QXX_LINK_DELAY_MS(&gs_handle, w25qxx_interface_delay_ms);
68 DRIVER_W25QXX_LINK_DELAY_US(&gs_handle, w25qxx_interface_delay_us);
69 DRIVER_W25QXX_LINK_DEBUG_PRINT(&gs_handle, w25qxx_interface_debug_print);
70
71 /* get information */
72 res = w25qxx_info(&info);
73 if (res != 0)
74 {
75 w25qxx_interface_debug_print("w25qxx: get info failed.\n");
76
77 return 1;
78 }
79 else
80 {
81 /* print chip information */
82 w25qxx_interface_debug_print("w25qxx: chip is %s.\n", info.chip_name);
83 w25qxx_interface_debug_print("w25qxx: manufacturer is %s.\n", info.manufacturer_name);
84 w25qxx_interface_debug_print("w25qxx: interface is %s.\n", info.interface);
85 w25qxx_interface_debug_print("w25qxx: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
86 w25qxx_interface_debug_print("w25qxx: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
87 w25qxx_interface_debug_print("w25qxx: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
88 w25qxx_interface_debug_print("w25qxx: max current is %0.2fmA.\n", info.max_current_ma);
89 w25qxx_interface_debug_print("w25qxx: max temperature is %0.1fC.\n", info.temperature_max);
90 w25qxx_interface_debug_print("w25qxx: min temperature is %0.1fC.\n", info.temperature_min);
91 }
92
93 /* start read test */
94 w25qxx_interface_debug_print("w25qxx: start register test.\n");
95
96 /* w25qxx_set_type/w25qxx_get_type test */
97 w25qxx_interface_debug_print("w25qxx: w25qxx_set_type/w25qxx_get_type test.\n");
98
99 /* set type w25q80 */
100 res = w25qxx_set_type(&gs_handle, W25Q80);
101 if (res != 0)
102 {
103 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
104
105 return 1;
106 }
107 w25qxx_interface_debug_print("w25qxx: set type W25Q80.\n");
108
109 /* get type */
110 res = w25qxx_get_type(&gs_handle, &type_check);
111 if (res != 0)
112 {
113 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
114
115 return 1;
116 }
117 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q80 ? "ok" : "error");
118
119 /* set type w25q16 */
120 res = w25qxx_set_type(&gs_handle, W25Q16);
121 if (res != 0)
122 {
123 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
124
125 return 1;
126 }
127 w25qxx_interface_debug_print("w25qxx: set type W25Q16.\n");
128
129 /* get type */
130 res = w25qxx_get_type(&gs_handle, &type_check);
131 if (res != 0)
132 {
133 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
134
135 return 1;
136 }
137 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q16 ? "ok" : "error");
138
139 /* set type w25q32 */
140 res = w25qxx_set_type(&gs_handle, W25Q32);
141 if (res != 0)
142 {
143 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
144
145 return 1;
146 }
147 w25qxx_interface_debug_print("w25qxx: set type W25Q32.\n");
148
149 /* get type */
150 res = w25qxx_get_type(&gs_handle, &type_check);
151 if (res != 0)
152 {
153 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
154
155 return 1;
156 }
157 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q32 ? "ok" : "error");
158
159 /* set type w25q64 */
160 res = w25qxx_set_type(&gs_handle, W25Q64);
161 if (res != 0)
162 {
163 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
164
165 return 1;
166 }
167 w25qxx_interface_debug_print("w25qxx: set type W25Q64.\n");
168
169 /* get type */
170 res = w25qxx_get_type(&gs_handle, &type_check);
171 if (res != 0)
172 {
173 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
174
175 return 1;
176 }
177 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q64 ? "ok" : "error");
178
179 /* set type w25q128 */
180 res = w25qxx_set_type(&gs_handle, W25Q128);
181 if (res != 0)
182 {
183 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
184
185 return 1;
186 }
187 w25qxx_interface_debug_print("w25qxx: set type W25Q128.\n");
188
189 /* get type */
190 res = w25qxx_get_type(&gs_handle, &type_check);
191 if (res != 0)
192 {
193 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
194
195 return 1;
196 }
197 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q128 ? "ok" : "error");
198
199 /* set type w25q256 */
200 res = w25qxx_set_type(&gs_handle, W25Q256);
201 if (res != 0)
202 {
203 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
204
205 return 1;
206 }
207 w25qxx_interface_debug_print("w25qxx: set type W25Q256.\n");
208
209 /* get type */
210 res = w25qxx_get_type(&gs_handle, &type_check);
211 if (res != 0)
212 {
213 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
214
215 return 1;
216 }
217 w25qxx_interface_debug_print("w25qxx: check chip type %s.\n", type_check == W25Q256 ? "ok" : "error");
218
219 /* w25qxx_set_interface/w25qxx_get_interface test */
220 w25qxx_interface_debug_print("w25qxx: w25qxx_set_interface/w25qxx_get_interface test.\n");
221
222 /* set chip interface spi */
223 res = w25qxx_set_interface(&gs_handle, W25QXX_INTERFACE_SPI);
224 if (res != 0)
225 {
226 w25qxx_interface_debug_print("w25qxx: set interface failed.\n");
227
228 return 1;
229 }
230 w25qxx_interface_debug_print("w25qxx: set interface SPI.\n");
231
232 /* get interface */
233 res = w25qxx_get_interface(&gs_handle, &interface_check);
234 if (res != 0)
235 {
236 w25qxx_interface_debug_print("w25qxx: get interface failed.\n");
237
238 return 1;
239 }
240 w25qxx_interface_debug_print("w25qxx: check chip interface %s.\n", interface_check == W25QXX_INTERFACE_SPI ? "ok" : "error");
241
242 /* set chip interface qspi */
243 res = w25qxx_set_interface(&gs_handle, W25QXX_INTERFACE_QSPI);
244 if (res != 0)
245 {
246 w25qxx_interface_debug_print("w25qxx: set interface failed.\n");
247
248 return 1;
249 }
250 w25qxx_interface_debug_print("w25qxx: set interface QSPI.\n");
251
252 /* get interface */
253 res = w25qxx_get_interface(&gs_handle, &interface_check);
254 if (res != 0)
255 {
256 w25qxx_interface_debug_print("w25qxx: get interface failed.\n");
257
258 return 1;
259 }
260 w25qxx_interface_debug_print("w25qxx: check chip interface %s.\n", interface_check == W25QXX_INTERFACE_QSPI ? "ok" : "error");
261
262 /* set chip type */
263 res = w25qxx_set_type(&gs_handle, type);
264 if (res != 0)
265 {
266 w25qxx_interface_debug_print("w25qxx: set type failed.\n");
267
268 return 1;
269 }
270
271 /* set chip interface */
272 res = w25qxx_set_interface(&gs_handle, interface);
273 if (res != 0)
274 {
275 w25qxx_interface_debug_print("w25qxx: set interface failed.\n");
276
277 return 1;
278 }
279
280 /* set dual quad spi */
281 res = w25qxx_set_dual_quad_spi(&gs_handle, dual_quad_spi_enable);
282 if (res != 0)
283 {
284 w25qxx_interface_debug_print("w25qxx: set dual quad spi failed.\n");
285 (void)w25qxx_deinit(&gs_handle);
286
287 return 1;
288 }
289
290 /* chip init */
291 res = w25qxx_init(&gs_handle);
292 if (res != 0)
293 {
294 w25qxx_interface_debug_print("w25qxx: init failed.\n");
295
296 return 1;
297 }
298
299 if (interface == W25QXX_INTERFACE_SPI)
300 {
301 /* w25qxx_get_manufacturer_device_id test */
302 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id test.\n");
303
304 /* get manufacturer device id */
305 res = w25qxx_get_manufacturer_device_id(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
306 if (res != 0)
307 {
308 w25qxx_interface_debug_print("w25qxx: get manufacturer device id failed.\n");
309 (void)w25qxx_deinit(&gs_handle);
310
311 return 1;
312 }
313 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
314
315 /* w25qxx_get_jedec_id test */
316 w25qxx_interface_debug_print("w25qxx: w25qxx_get_jedec_id test.\n");
317
318 /* get jedec id */
319 res = w25qxx_get_jedec_id(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
320 if (res != 0)
321 {
322 w25qxx_interface_debug_print("w25qxx: get jedec id failed.\n");
323 (void)w25qxx_deinit(&gs_handle);
324
325 return 1;
326 }
327 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X 0x%02X.\n", manufacturer,
328 device_id[0], device_id[1]);
329
330 /* w25qxx_get_unique_id test */
331 w25qxx_interface_debug_print("w25qxx: w25qxx_get_unique_id test.\n");
332
333 /* get unique id */
334 res = w25qxx_get_unique_id(&gs_handle, (uint8_t *)id);
335 if (res != 0)
336 {
337 w25qxx_interface_debug_print("w25qxx: get unique id failed.\n");
338 (void)w25qxx_deinit(&gs_handle);
339
340 return 1;
341 }
342 w25qxx_interface_debug_print("w25qxx: unique id 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\n",
343 id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
344
345 /* w25qxx_set_status1/w25qxx_get_status1 test */
346 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status1/w25qxx_get_status1 test.\n");
347
348 /* set status1 */
349 res = w25qxx_set_status1(&gs_handle, 0x00);
350 if (res != 0)
351 {
352 w25qxx_interface_debug_print("w25qxx: set status1 failed.\n");
353 (void)w25qxx_deinit(&gs_handle);
354
355 return 1;
356 }
357
358 /* get status1 */
359 res = w25qxx_get_status1(&gs_handle, (uint8_t *)&status);
360 if (res != 0)
361 {
362 w25qxx_interface_debug_print("w25qxx: get status1 failed.\n");
363 (void)w25qxx_deinit(&gs_handle);
364
365 return 1;
366 }
367 w25qxx_interface_debug_print("w25qxx: status1 is 0x%02X.\n", status);
368
369 /* w25qxx_set_status2/w25qxx_get_status2 test */
370 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status2/w25qxx_get_status2 test.\n");
371
372 /* set status2 */
373 res = w25qxx_set_status2(&gs_handle, 0x02);
374 if (res != 0)
375 {
376 w25qxx_interface_debug_print("w25qxx: set status2 failed.\n");
377 (void)w25qxx_deinit(&gs_handle);
378
379 return 1;
380 }
381
382 /* get status2 */
383 res = w25qxx_get_status2(&gs_handle, (uint8_t *)&status);
384 if (res != 0)
385 {
386 w25qxx_interface_debug_print("w25qxx: get status2 failed.\n");
387 (void)w25qxx_deinit(&gs_handle);
388
389 return 1;
390 }
391 w25qxx_interface_debug_print("w25qxx: status2 is 0x%02X.\n", status);
392
393 /* w25qxx_set_status3/w25qxx_get_status3 test */
394 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status3/w25qxx_get_status3 test.\n");
395
396 /* set status3 */
397 res = w25qxx_set_status3(&gs_handle, 0x60);
398 if (res != 0)
399 {
400 w25qxx_interface_debug_print("w25qxx: set status3 failed.\n");
401 (void)w25qxx_deinit(&gs_handle);
402
403 return 1;
404 }
405
406 /* get status3 */
407 res = w25qxx_get_status3(&gs_handle, (uint8_t *)&status);
408 if (res != 0)
409 {
410 w25qxx_interface_debug_print("w25qxx: get status3 failed.\n");
411 (void)w25qxx_deinit(&gs_handle);
412
413 return 1;
414 }
415 w25qxx_interface_debug_print("w25qxx: status3 is 0x%02X.\n", status);
416
417 /* w25qxx_enable_write test */
418 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_write test.\n");
419
420 /* enable write */
421 res = w25qxx_enable_write(&gs_handle);
422 if (res != 0)
423 {
424 w25qxx_interface_debug_print("w25qxx: enable write failed.\n");
425 (void)w25qxx_deinit(&gs_handle);
426
427 return 1;
428 }
429 w25qxx_interface_debug_print("w25qxx: check enable write %s.\n", res == 0 ? "ok" : "error");
430
431 /* w25qxx_disable_write test */
432 w25qxx_interface_debug_print("w25qxx: w25qxx_disable_write test.\n");
433
434 /* disable write */
435 res = w25qxx_disable_write(&gs_handle);
436 if (res != 0)
437 {
438 w25qxx_interface_debug_print("w25qxx: disable write failed.\n");
439 (void)w25qxx_deinit(&gs_handle);
440
441 return 1;
442 }
443 w25qxx_interface_debug_print("w25qxx: check disable write %s.\n", res == 0 ? "ok" : "error");
444
445 /* w25qxx_enable_write test */
446 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_write test.\n");
447
448 /* enable sr write */
449 res = w25qxx_enable_volatile_sr_write(&gs_handle);
450 if (res != 0)
451 {
452 w25qxx_interface_debug_print("w25qxx: enable sr write failed.\n");
453 (void)w25qxx_deinit(&gs_handle);
454
455 return 1;
456 }
457 w25qxx_interface_debug_print("w25qxx: check enable sr write %s.\n", res == 0 ? "ok" : "error");
458
459 /* w25qxx_erase_program_suspend test */
460 w25qxx_interface_debug_print("w25qxx: w25qxx_erase_program_suspend test.\n");
461
462 /* erase program suspend */
463 res = w25qxx_erase_program_suspend(&gs_handle);
464 if (res != 0)
465 {
466 w25qxx_interface_debug_print("w25qxx: erase program suspend failed.\n");
467 (void)w25qxx_deinit(&gs_handle);
468
469 return 1;
470 }
471 w25qxx_interface_debug_print("w25qxx: check erase program suspend %s.\n", res == 0 ? "ok" : "error");
472
473 /* w25qxx_erase_program_suspend test */
474 w25qxx_interface_debug_print("w25qxx: w25qxx_erase_program_suspend test.\n");
475
476 /* erase program resume */
477 res = w25qxx_erase_program_resume(&gs_handle);
478 if (res != 0)
479 {
480 w25qxx_interface_debug_print("w25qxx: erase program resume failed.\n");
481 (void)w25qxx_deinit(&gs_handle);
482
483 return 1;
484 }
485 w25qxx_interface_debug_print("w25qxx: check erase program resume %s.\n", res == 0 ? "ok" : "error");
486
487 /* w25qxx_global_block_lock test */
488 w25qxx_interface_debug_print("w25qxx: w25qxx_global_block_lock test.\n");
489
490 /* global block lock */
491 res = w25qxx_global_block_lock(&gs_handle);
492 if (res != 0)
493 {
494 w25qxx_interface_debug_print("w25qxx: global block lock failed.\n");
495 (void)w25qxx_deinit(&gs_handle);
496
497 return 1;
498 }
499 w25qxx_interface_debug_print("w25qxx: check global block lock %s.\n", res == 0 ? "ok" : "error");
500
501 /* w25qxx_global_block_unlock test */
502 w25qxx_interface_debug_print("w25qxx: w25qxx_global_block_unlock test.\n");
503
504 /* global block unlock */
505 res = w25qxx_global_block_unlock(&gs_handle);
506 if (res != 0)
507 {
508 w25qxx_interface_debug_print("w25qxx: global block unlock failed.\n");
509 (void)w25qxx_deinit(&gs_handle);
510
511 return 1;
512 }
513 w25qxx_interface_debug_print("w25qxx: check global block unlock %s.\n", res == 0 ? "ok" : "error");
514
515 /* w25qxx_individual_block_lock test */
516 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_lock test.\n");
517
518 /* individual block lock */
519 res = w25qxx_individual_block_lock(&gs_handle, 0x00000000);
520 if (res != 0)
521 {
522 w25qxx_interface_debug_print("w25qxx: individual block lock failed.\n");
523 (void)w25qxx_deinit(&gs_handle);
524
525 return 1;
526 }
527 w25qxx_interface_debug_print("w25qxx: check individual block lock %s.\n", res == 0 ? "ok" : "error");
528
529 /* w25qxx_read_block_lock test */
530 w25qxx_interface_debug_print("w25qxx: w25qxx_read_block_lock test.\n");
531
532 res = w25qxx_read_block_lock(&gs_handle, 0x00000000, (uint8_t *)&status);
533 if (res != 0)
534 {
535 w25qxx_interface_debug_print("w25qxx: read block lock failed.\n");
536 (void)w25qxx_deinit(&gs_handle);
537
538 return 1;
539 }
540 w25qxx_interface_debug_print("w25qxx: check read block lock %s with %d.\n", res == 0 ? "ok" : "error", status);
541
542 /* w25qxx_individual_block_unlock test */
543 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_unlock test.\n");
544
545 /* individual block unlock */
546 res = w25qxx_individual_block_unlock(&gs_handle, 0x00000000);
547 if (res != 0)
548 {
549 w25qxx_interface_debug_print("w25qxx: individual block unlock failed.\n");
550 (void)w25qxx_deinit(&gs_handle);
551
552 return 1;
553 }
554 w25qxx_interface_debug_print("w25qxx: check individual block unlock %s.\n", res == 0 ? "ok" : "error");
555
556 /* w25qxx_set_burst_with_wrap test */
557 w25qxx_interface_debug_print("w25qxx: w25qxx_set_burst_with_wrap test.\n");
558
559 /* set burst with wrap */
560 res = w25qxx_set_burst_with_wrap(&gs_handle, W25QXX_BURST_WRAP_NONE);
561 if (res != 0)
562 {
563 w25qxx_interface_debug_print("w25qxx: set burst with wrap failed.\n");
564 (void)w25qxx_deinit(&gs_handle);
565
566 return 1;
567 }
568 w25qxx_interface_debug_print("w25qxx: check set burst with wrap %s.\n", res == 0 ? "ok" : "error");
569
570 /* w25qxx_power_down test */
571 w25qxx_interface_debug_print("w25qxx: w25qxx_power_down test.\n");
572
573 /* power down */
574 res = w25qxx_power_down(&gs_handle);
575 if (res != 0)
576 {
577 w25qxx_interface_debug_print("w25qxx: power down failed.\n");
578 (void)w25qxx_deinit(&gs_handle);
579
580 return 1;
581 }
582 w25qxx_interface_delay_ms(10);
583
584 /* w25qxx_release_power_down test */
585 w25qxx_interface_debug_print("w25qxx: w25qxx_release_power_down test.\n");
586
587 /* release power down */
588 res = w25qxx_release_power_down(&gs_handle);
589 if (res != 0)
590 {
591 w25qxx_interface_debug_print("w25qxx: release power down failed.\n");
592 (void)w25qxx_deinit(&gs_handle);
593
594 return 1;
595 }
596 w25qxx_interface_delay_ms(10);
597
598 /* w25qxx_enable_reset test */
599 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_reset test.\n");
600
601 /* enable reset */
602 res = w25qxx_enable_reset(&gs_handle);
603 if (res != 0)
604 {
605 w25qxx_interface_debug_print("w25qxx: enable reset failed.\n");
606 (void)w25qxx_deinit(&gs_handle);
607
608 return 1;
609 }
610
611 /* w25qxx_reset_device test */
612 w25qxx_interface_debug_print("w25qxx: w25qxx_reset_device test.\n");
613
614 /* reset device */
615 res = w25qxx_reset_device(&gs_handle);
616 if (res != 0)
617 {
618 w25qxx_interface_debug_print("w25qxx: reset device failed.\n");
619 (void)w25qxx_deinit(&gs_handle);
620
621 return 1;
622 }
623 w25qxx_interface_delay_ms(10);
624
625 if (type >= W25Q256)
626 {
627 /* set address mode 4 byte */
628 w25qxx_interface_debug_print("w25qxx: set address mode 4 byte.\n");
629
630 /* set address mode 4 byte */
631 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_4_BYTE);
632 if (res != 0)
633 {
634 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
635 (void)w25qxx_deinit(&gs_handle);
636
637 return 1;
638 }
639
640 /* w25qxx_get_unique_id test */
641 w25qxx_interface_debug_print("w25qxx: w25qxx_get_unique_id test.\n");
642
643 /* get unique id */
644 res = w25qxx_get_unique_id(&gs_handle, (uint8_t *)id);
645 if (res != 0)
646 {
647 w25qxx_interface_debug_print("w25qxx: get unique id failed.\n");
648 (void)w25qxx_deinit(&gs_handle);
649
650 return 1;
651 }
652 w25qxx_interface_debug_print("w25qxx: unique id 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\n",
653 id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
654
655 /* w25qxx_individual_block_lock test */
656 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_lock test.\n");
657
658 /* individual block lock */
659 res = w25qxx_individual_block_lock(&gs_handle, 0x00000000);
660 if (res != 0)
661 {
662 w25qxx_interface_debug_print("w25qxx: individual block lock failed.\n");
663 (void)w25qxx_deinit(&gs_handle);
664
665 return 1;
666 }
667 w25qxx_interface_debug_print("w25qxx: check individual block lock %s.\n", res == 0 ? "ok" : "error");
668
669 /* w25qxx_read_block_lock test */
670 w25qxx_interface_debug_print("w25qxx: w25qxx_read_block_lock test.\n");
671
672 res = w25qxx_read_block_lock(&gs_handle, 0x00000000, (uint8_t *)&status);
673 if (res != 0)
674 {
675 w25qxx_interface_debug_print("w25qxx: read block lock failed.\n");
676 (void)w25qxx_deinit(&gs_handle);
677
678 return 1;
679 }
680 w25qxx_interface_debug_print("w25qxx: check read block lock %s with %d.\n", res == 0 ? "ok" : "error", status);
681
682 /* w25qxx_individual_block_unlock test */
683 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_unlock test.\n");
684
685 /* individual block unlock */
686 res = w25qxx_individual_block_unlock(&gs_handle, 0x00000000);
687 if (res != 0)
688 {
689 w25qxx_interface_debug_print("w25qxx: individual block unlock failed.\n");
690 (void)w25qxx_deinit(&gs_handle);
691
692 return 1;
693 }
694 w25qxx_interface_debug_print("w25qxx: check individual block unlock %s.\n", res == 0 ? "ok" : "error");
695
696 /* set address mode 3 byte */
697 w25qxx_interface_debug_print("w25qxx: set address mode 3 byte.\n");
698
699 /* set address mode 3 byte */
700 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_3_BYTE);
701 if (res != 0)
702 {
703 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
704 (void)w25qxx_deinit(&gs_handle);
705
706 return 1;
707 }
708 }
709 }
710 else
711 {
712 /* w25qxx_get_manufacturer_device_id test */
713 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id test.\n");
714
715 /* get manufacturer device id */
716 res = w25qxx_get_manufacturer_device_id(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
717 if (res != 0)
718 {
719 w25qxx_interface_debug_print("w25qxx: get manufacturer device id failed.\n");
720 (void)w25qxx_deinit(&gs_handle);
721
722 return 1;
723 }
724 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
725
726 /* w25qxx_get_jedec_id test */
727 w25qxx_interface_debug_print("w25qxx: w25qxx_get_jedec_id test.\n");
728
729 /* get jedec id */
730 res = w25qxx_get_jedec_id(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
731 if (res != 0)
732 {
733 w25qxx_interface_debug_print("w25qxx: get jedec id failed.\n");
734 (void)w25qxx_deinit(&gs_handle);
735
736 return 1;
737 }
738 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X 0x%02X.\n", manufacturer,
739 device_id[0], device_id[1]);
740
741 /* w25qxx_set_status1/w25qxx_get_status1 test */
742 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status1/w25qxx_get_status1 test.\n");
743
744 /* set status1 */
745 res = w25qxx_set_status1(&gs_handle, 0x00);
746 if (res != 0)
747 {
748 w25qxx_interface_debug_print("w25qxx: set status1 failed.\n");
749 (void)w25qxx_deinit(&gs_handle);
750
751 return 1;
752 }
753
754 /* get status1 */
755 res = w25qxx_get_status1(&gs_handle, (uint8_t *)&status);
756 if (res != 0)
757 {
758 w25qxx_interface_debug_print("w25qxx: get status1 failed.\n");
759 (void)w25qxx_deinit(&gs_handle);
760
761 return 1;
762 }
763 w25qxx_interface_debug_print("w25qxx: status1 is 0x%02X.\n", status);
764
765 /* w25qxx_set_status2/w25qxx_get_status2 test */
766 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status2/w25qxx_get_status2 test.\n");
767
768 /* set status2 */
769 res = w25qxx_set_status2(&gs_handle, 0x02);
770 if (res != 0)
771 {
772 w25qxx_interface_debug_print("w25qxx: set status2 failed.\n");
773 (void)w25qxx_deinit(&gs_handle);
774
775 return 1;
776 }
777
778 /* get status2 */
779 res = w25qxx_get_status2(&gs_handle, (uint8_t *)&status);
780 if (res != 0)
781 {
782 w25qxx_interface_debug_print("w25qxx: get status2 failed.\n");
783 (void)w25qxx_deinit(&gs_handle);
784
785 return 1;
786 }
787 w25qxx_interface_debug_print("w25qxx: status2 is 0x%02X.\n", status);
788
789 /* w25qxx_set_status3/w25qxx_get_status3 test */
790 w25qxx_interface_debug_print("w25qxx: w25qxx_set_status3/w25qxx_get_status3 test.\n");
791
792 /* set status3 */
793 res = w25qxx_set_status3(&gs_handle, 0x60);
794 if (res != 0)
795 {
796 w25qxx_interface_debug_print("w25qxx: set status3 failed.\n");
797 (void)w25qxx_deinit(&gs_handle);
798
799 return 1;
800 }
801
802 /* get status3 */
803 res = w25qxx_get_status3(&gs_handle, (uint8_t *)&status);
804 if (res != 0)
805 {
806 w25qxx_interface_debug_print("w25qxx: get status3 failed.\n");
807 (void)w25qxx_deinit(&gs_handle);
808
809 return 1;
810 }
811 w25qxx_interface_debug_print("w25qxx: status3 is 0x%02X.\n", status);
812
813 /* w25qxx_enable_write test */
814 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_write test.\n");
815
816 /* enable write */
817 res = w25qxx_enable_write(&gs_handle);
818 if (res != 0)
819 {
820 w25qxx_interface_debug_print("w25qxx: enable write failed.\n");
821 (void)w25qxx_deinit(&gs_handle);
822
823 return 1;
824 }
825 w25qxx_interface_debug_print("w25qxx: check enable write %s.\n", res == 0 ? "ok" : "error");
826
827 /* w25qxx_disable_write test */
828 w25qxx_interface_debug_print("w25qxx: w25qxx_disable_write test.\n");
829
830 /* disable write */
831 res = w25qxx_disable_write(&gs_handle);
832 if (res != 0)
833 {
834 w25qxx_interface_debug_print("w25qxx: disable write failed.\n");
835 (void)w25qxx_deinit(&gs_handle);
836
837 return 1;
838 }
839 w25qxx_interface_debug_print("w25qxx: check disable write %s.\n", res == 0 ? "ok" : "error");
840
841 /* w25qxx_enable_write test */
842 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_write test.\n");
843
844 /* enable sr write */
845 res = w25qxx_enable_volatile_sr_write(&gs_handle);
846 if (res != 0)
847 {
848 w25qxx_interface_debug_print("w25qxx: enable sr write failed.\n");
849 (void)w25qxx_deinit(&gs_handle);
850
851 return 1;
852 }
853 w25qxx_interface_debug_print("w25qxx: check enable sr write %s.\n", res == 0 ? "ok" : "error");
854
855 /* w25qxx_erase_program_suspend test */
856 w25qxx_interface_debug_print("w25qxx: w25qxx_erase_program_suspend test.\n");
857
858 /* erase program suspend */
859 res = w25qxx_erase_program_suspend(&gs_handle);
860 if (res != 0)
861 {
862 w25qxx_interface_debug_print("w25qxx: erase program suspend failed.\n");
863 (void)w25qxx_deinit(&gs_handle);
864
865 return 1;
866 }
867 w25qxx_interface_debug_print("w25qxx: check erase program suspend %s.\n", res == 0 ? "ok" : "error");
868
869 /* w25qxx_erase_program_suspend test */
870 w25qxx_interface_debug_print("w25qxx: w25qxx_erase_program_suspend test.\n");
871
872 /* erase program resume */
873 res = w25qxx_erase_program_resume(&gs_handle);
874 if (res != 0)
875 {
876 w25qxx_interface_debug_print("w25qxx: erase program resume failed.\n");
877 (void)w25qxx_deinit(&gs_handle);
878
879 return 1;
880 }
881 w25qxx_interface_debug_print("w25qxx: check erase program resume %s.\n", res == 0 ? "ok" : "error");
882
883 /* w25qxx_global_block_lock test */
884 w25qxx_interface_debug_print("w25qxx: w25qxx_global_block_lock test.\n");
885
886 /* global block lock */
887 res = w25qxx_global_block_lock(&gs_handle);
888 if (res != 0)
889 {
890 w25qxx_interface_debug_print("w25qxx: global block lock failed.\n");
891 (void)w25qxx_deinit(&gs_handle);
892
893 return 1;
894 }
895 w25qxx_interface_debug_print("w25qxx: check global block lock %s.\n", res == 0 ? "ok" : "error");
896
897 /* w25qxx_global_block_unlock test */
898 w25qxx_interface_debug_print("w25qxx: w25qxx_global_block_unlock test.\n");
899
900 /* global block unlock */
901 res = w25qxx_global_block_unlock(&gs_handle);
902 if (res != 0)
903 {
904 w25qxx_interface_debug_print("w25qxx: global block unlock failed.\n");
905 (void)w25qxx_deinit(&gs_handle);
906
907 return 1;
908 }
909 w25qxx_interface_debug_print("w25qxx: check global block unlock %s.\n", res == 0 ? "ok" : "error");
910
911 /* w25qxx_individual_block_lock test */
912 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_lock test.\n");
913
914 /* individual block lock */
915 res = w25qxx_individual_block_lock(&gs_handle, 0x00000000);
916 if (res != 0)
917 {
918 w25qxx_interface_debug_print("w25qxx: individual block lock failed.\n");
919 (void)w25qxx_deinit(&gs_handle);
920
921 return 1;
922 }
923 w25qxx_interface_debug_print("w25qxx: check individual block lock %s.\n", res == 0 ? "ok" : "error");
924
925 /* w25qxx_read_block_lock test */
926 w25qxx_interface_debug_print("w25qxx: w25qxx_read_block_lock test.\n");
927
928 res = w25qxx_read_block_lock(&gs_handle, 0x00000000, (uint8_t *)&status);
929 if (res != 0)
930 {
931 w25qxx_interface_debug_print("w25qxx: read block lock failed.\n");
932 (void)w25qxx_deinit(&gs_handle);
933
934 return 1;
935 }
936 w25qxx_interface_debug_print("w25qxx: check read block lock %s with %d.\n", res == 0 ? "ok" : "error", status);
937
938 /* w25qxx_individual_block_unlock test */
939 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_unlock test.\n");
940
941 /* individual block unlock */
942 res = w25qxx_individual_block_unlock(&gs_handle, 0x00000000);
943 if (res != 0)
944 {
945 w25qxx_interface_debug_print("w25qxx: individual block unlock failed.\n");
946 (void)w25qxx_deinit(&gs_handle);
947
948 return 1;
949 }
950 w25qxx_interface_debug_print("w25qxx: check individual block unlock %s.\n", res == 0 ? "ok" : "error");
951
952 /* w25qxx_power_down test */
953 w25qxx_interface_debug_print("w25qxx: w25qxx_power_down test.\n");
954
955 /* power down */
956 res = w25qxx_power_down(&gs_handle);
957 if (res != 0)
958 {
959 w25qxx_interface_debug_print("w25qxx: power down failed.\n");
960 (void)w25qxx_deinit(&gs_handle);
961
962 return 1;
963 }
964 w25qxx_interface_delay_ms(10);
965
966 /* w25qxx_release_power_down test */
967 w25qxx_interface_debug_print("w25qxx: w25qxx_release_power_down test.\n");
968
969 /* release power down */
970 res = w25qxx_release_power_down(&gs_handle);
971 if (res != 0)
972 {
973 w25qxx_interface_debug_print("w25qxx: release power down failed.\n");
974 (void)w25qxx_deinit(&gs_handle);
975
976 return 1;
977 }
978 w25qxx_interface_delay_ms(10);
979
980 /* w25qxx_enable_reset test */
981 w25qxx_interface_debug_print("w25qxx: w25qxx_enable_reset test.\n");
982
983 /* enable reset */
984 res = w25qxx_enable_reset(&gs_handle);
985 if (res != 0)
986 {
987 w25qxx_interface_debug_print("w25qxx: enable reset failed.\n");
988 (void)w25qxx_deinit(&gs_handle);
989
990 return 1;
991 }
992
993 /* w25qxx_reset_device test */
994 w25qxx_interface_debug_print("w25qxx: w25qxx_reset_device test.\n");
995
996 /* reset device */
997 res = w25qxx_reset_device(&gs_handle);
998 if (res != 0)
999 {
1000 w25qxx_interface_debug_print("w25qxx: reset device failed.\n");
1001 (void)w25qxx_deinit(&gs_handle);
1002
1003 return 1;
1004 }
1005 w25qxx_interface_delay_ms(10);
1006
1007 if (type >= W25Q256)
1008 {
1009 /* set address mode 4 byte */
1010 w25qxx_interface_debug_print("w25qxx: set address mode 4 byte.\n");
1011
1012 /* set address mode 4 byte */
1013 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_4_BYTE);
1014 if (res != 0)
1015 {
1016 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
1017 (void)w25qxx_deinit(&gs_handle);
1018
1019 return 1;
1020 }
1021
1022 /* w25qxx_individual_block_lock test */
1023 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_lock test.\n");
1024
1025 /* individual block lock */
1026 res = w25qxx_individual_block_lock(&gs_handle, 0x00000000);
1027 if (res != 0)
1028 {
1029 w25qxx_interface_debug_print("w25qxx: individual block lock failed.\n");
1030 (void)w25qxx_deinit(&gs_handle);
1031
1032 return 1;
1033 }
1034 w25qxx_interface_debug_print("w25qxx: check individual block lock %s.\n", res == 0 ? "ok" : "error");
1035
1036 /* w25qxx_individual_block_unlock test */
1037 w25qxx_interface_debug_print("w25qxx: w25qxx_individual_block_unlock test.\n");
1038
1039 /* individual block unlock */
1040 res = w25qxx_individual_block_unlock(&gs_handle, 0x00000000);
1041 if (res != 0)
1042 {
1043 w25qxx_interface_debug_print("w25qxx: individual block unlock failed.\n");
1044 (void)w25qxx_deinit(&gs_handle);
1045
1046 return 1;
1047 }
1048 w25qxx_interface_debug_print("w25qxx: check individual block unlock %s.\n", res == 0 ? "ok" : "error");
1049
1050 /* w25qxx_read_block_lock test */
1051 w25qxx_interface_debug_print("w25qxx: w25qxx_read_block_lock test.\n");
1052
1053 res = w25qxx_read_block_lock(&gs_handle, 0x00000000, (uint8_t *)&status);
1054 if (res != 0)
1055 {
1056 w25qxx_interface_debug_print("w25qxx: read block lock failed.\n");
1057 (void)w25qxx_deinit(&gs_handle);
1058
1059 return 1;
1060 }
1061 w25qxx_interface_debug_print("w25qxx: check read block lock %s with %d.\n", res == 0 ? "ok" : "error", status);
1062
1063 /* set address mode 3 byte */
1064 w25qxx_interface_debug_print("w25qxx: set address mode 3 byte.\n");
1065
1066 /* set address mode 3 byte */
1067 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_3_BYTE);
1068 if (res != 0)
1069 {
1070 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
1071 (void)w25qxx_deinit(&gs_handle);
1072
1073 return 1;
1074 }
1075 }
1076
1077 if (dual_quad_spi_enable != 0)
1078 {
1079 /* enter to spi mode */
1080 w25qxx_interface_debug_print("w25qxx: enter to spi mode.\n");
1081
1082 /* exit qspi */
1083 res = w25qxx_exit_qspi_mode(&gs_handle);
1084 if (res != 0)
1085 {
1086 w25qxx_interface_debug_print("w25qxx: exit qspi mode failed.\n");
1087 (void)w25qxx_deinit(&gs_handle);
1088
1089 return 1;
1090 }
1091
1092 /* set chip interface spi */
1093 res = w25qxx_set_interface(&gs_handle, W25QXX_INTERFACE_SPI);
1094 if (res != 0)
1095 {
1096 w25qxx_interface_debug_print("w25qxx: set interface failed.\n");
1097
1098 return 1;
1099 }
1100
1101 /* w25qxx_get_manufacturer_device_id_dual_io test */
1102 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id_dual_io test.\n");
1103
1104 /* get manufacturer device id dual io */
1105 res = w25qxx_get_manufacturer_device_id_dual_io(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
1106 if (res != 0)
1107 {
1108 w25qxx_interface_debug_print("w25qxx: get manufacturer device id dual io failed.\n");
1109 (void)w25qxx_deinit(&gs_handle);
1110
1111 return 1;
1112 }
1113 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
1114
1115 /* w25qxx_get_manufacturer_device_id_quad_io test */
1116 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id_quad_io test.\n");
1117
1118 /* get manufacturer device id quad io */
1119 res = w25qxx_get_manufacturer_device_id_quad_io(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
1120 if (res != 0)
1121 {
1122 w25qxx_interface_debug_print("w25qxx: get manufacturer device id quad io failed.\n");
1123 (void)w25qxx_deinit(&gs_handle);
1124
1125 return 1;
1126 }
1127 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
1128
1129 if (type >= W25Q256)
1130 {
1131 /* set address mode 4 byte */
1132 w25qxx_interface_debug_print("w25qxx: set address mode 4 byte.\n");
1133
1134 /* set address mode 4 byte */
1135 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_4_BYTE);
1136 if (res != 0)
1137 {
1138 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
1139 (void)w25qxx_deinit(&gs_handle);
1140
1141 return 1;
1142 }
1143
1144 /* w25qxx_get_manufacturer_device_id_dual_io test */
1145 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id_dual_io test.\n");
1146
1147 /* get manufacturer device id dual io */
1148 res = w25qxx_get_manufacturer_device_id_dual_io(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
1149 if (res != 0)
1150 {
1151 w25qxx_interface_debug_print("w25qxx: get manufacturer device id dual io failed.\n");
1152 (void)w25qxx_deinit(&gs_handle);
1153
1154 return 1;
1155 }
1156 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
1157
1158 /* w25qxx_get_manufacturer_device_id_quad_io test */
1159 w25qxx_interface_debug_print("w25qxx: w25qxx_get_manufacturer_device_id_quad_io test.\n");
1160
1161 /* get manufacturer device id quad io */
1162 res = w25qxx_get_manufacturer_device_id_quad_io(&gs_handle, (uint8_t *)&manufacturer, (uint8_t *)device_id);
1163 if (res != 0)
1164 {
1165 w25qxx_interface_debug_print("w25qxx: get manufacturer device id quad io failed.\n");
1166 (void)w25qxx_deinit(&gs_handle);
1167
1168 return 1;
1169 }
1170 w25qxx_interface_debug_print("w25qxx: manufacturer is 0x%02X, device id is 0x%02X.\n", manufacturer, device_id[0]);
1171
1172 /* set address mode 3 byte */
1173 w25qxx_interface_debug_print("w25qxx: set address mode 3 byte.\n");
1174
1175 /* set address mode 3 byte */
1176 res = w25qxx_set_address_mode(&gs_handle, W25QXX_ADDRESS_MODE_3_BYTE);
1177 if (res != 0)
1178 {
1179 w25qxx_interface_debug_print("w25qxx: set address mode failed.\n");
1180 (void)w25qxx_deinit(&gs_handle);
1181
1182 return 1;
1183 }
1184 }
1185
1186 /* enter to qspi mode */
1187 w25qxx_interface_debug_print("w25qxx: enter to qspi mode.\n");
1188
1189 /* enter qspi */
1190 res = w25qxx_enter_qspi_mode(&gs_handle);
1191 if (res != 0)
1192 {
1193 w25qxx_interface_debug_print("w25qxx: enter qspi mode failed.\n");
1194 (void)w25qxx_deinit(&gs_handle);
1195
1196 return 1;
1197 }
1198
1199 /* set chip interface spi */
1200 res = w25qxx_set_interface(&gs_handle, W25QXX_INTERFACE_QSPI);
1201 if (res != 0)
1202 {
1203 w25qxx_interface_debug_print("w25qxx: set interface failed.\n");
1204
1205 return 1;
1206 }
1207 }
1208 }
1209
1210 /* finish read test */
1211 w25qxx_interface_debug_print("w25qxx: finish register test.\n");
1212 (void)w25qxx_deinit(&gs_handle);
1213
1214 return 0;
1215 }
driver_w25qxx_register_test.h
driver w25qxx register test header file
w25qxx_erase_program_resume
uint8_t w25qxx_erase_program_resume(w25qxx_handle_t *handle)
resume erase or program
Definition: driver_w25qxx.c:1722
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_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_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_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_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_get_status3
uint8_t w25qxx_get_status3(w25qxx_handle_t *handle, uint8_t *status)
get the status 3
Definition: driver_w25qxx.c:789
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_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_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_BURST_WRAP_NONE
@ W25QXX_BURST_WRAP_NONE
Definition: driver_w25qxx.h:146
w25qxx_release_power_down
uint8_t w25qxx_release_power_down(w25qxx_handle_t *handle)
release power down
Definition: driver_w25qxx.c:1875
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_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_deinit
uint8_t w25qxx_deinit(w25qxx_handle_t *handle)
close the chip
Definition: driver_w25qxx.c:7195
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_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_power_down
uint8_t w25qxx_power_down(w25qxx_handle_t *handle)
power down
Definition: driver_w25qxx.c:1792
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_interface_spi_qspi_deinit
uint8_t w25qxx_interface_spi_qspi_deinit(void)
interface spi qspi bus deinit
Definition: driver_w25qxx_interface_template.c:58
w25qxx_interface_spi_qspi_init
uint8_t w25qxx_interface_spi_qspi_init(void)
interface spi qspi bus init
Definition: driver_w25qxx_interface_template.c:46
w25qxx_interface_delay_us
void w25qxx_interface_delay_us(uint32_t us)
interface delay us
Definition: driver_w25qxx_interface_template.c:108
w25qxx_interface_spi_qspi_write_read
uint8_t w25qxx_interface_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)
interface spi qspi bus write read
Definition: driver_w25qxx_interface_template.c:84
w25qxx_interface_debug_print
void w25qxx_interface_debug_print(const char *const fmt,...)
interface print format data
Definition: driver_w25qxx_interface_template.c:118
w25qxx_interface_delay_ms
void w25qxx_interface_delay_ms(uint32_t ms)
interface delay ms
Definition: driver_w25qxx_interface_template.c:98
DRIVER_W25QXX_LINK_DELAY_MS
#define DRIVER_W25QXX_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
Definition: driver_w25qxx.h:297
DRIVER_W25QXX_LINK_INIT
#define DRIVER_W25QXX_LINK_INIT(HANDLE, STRUCTURE)
initialize w25qxx_handle_t structure
Definition: driver_w25qxx.h:265
DRIVER_W25QXX_LINK_SPI_QSPI_INIT
#define DRIVER_W25QXX_LINK_SPI_QSPI_INIT(HANDLE, FUC)
link spi_qspi_init function
Definition: driver_w25qxx.h:273
DRIVER_W25QXX_LINK_DEBUG_PRINT
#define DRIVER_W25QXX_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
Definition: driver_w25qxx.h:313
DRIVER_W25QXX_LINK_SPI_QSPI_WRITE_READ
#define DRIVER_W25QXX_LINK_SPI_QSPI_WRITE_READ(HANDLE, FUC)
link spi_qspi_write_read function
Definition: driver_w25qxx.h:289
DRIVER_W25QXX_LINK_SPI_QSPI_DEINIT
#define DRIVER_W25QXX_LINK_SPI_QSPI_DEINIT(HANDLE, FUC)
link spi_qspi_deinit function
Definition: driver_w25qxx.h:281
DRIVER_W25QXX_LINK_DELAY_US
#define DRIVER_W25QXX_LINK_DELAY_US(HANDLE, FUC)
link delay_us function
Definition: driver_w25qxx.h:305
w25qxx_register_test
uint8_t w25qxx_register_test(w25qxx_type_t type, w25qxx_interface_t interface, w25qxx_bool_t dual_quad_spi_enable)
register test
Definition: driver_w25qxx_register_test.c:51
w25qxx_handle_s
w25qxx handle structure definition
Definition: driver_w25qxx.h:210
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