Sample SPI drivers for a number of the Adesto Technologies flash devices.
All Files Functions Variables Enumerations Enumerator Macros Modules Pages
dataflash.c
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2018 Adesto Technologies Corporation, Inc
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted (subject to the limitations in the disclaimer below) provided
8  * that the following conditions are met:
9  *
10  * o Redistributions of source code must retain the above copyright notice, this list
11  * of conditions and the following disclaimer.
12  *
13  * o Redistributions in binary form must reproduce the above copyright notice, this
14  * list of conditions and the following disclaimer in the documentation and/or
15  * other materials provided with the distribution.
16  *
17  * o Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
42 #include "dataflash.h"
43 
44 #if (PARTNO == AT45DB021E) || \
45  (PARTNO == AT45DB041E) || \
46  (PARTNO == AT45DB081E) || \
47  (PARTNO == AT45DB161E) || \
48  (PARTNO == AT45DB321E) || \
49  (PARTNO == AT45DB641E) || \
50  (PARTNO == AT45DQ161) || \
51  (PARTNO == AT45DQ321) || \
52  (PARTNO == AT25PE20) || \
53  (PARTNO == AT25PE40) || \
54  (PARTNO == AT25PE80) || \
55  (PARTNO == AT25PE16) || \
56  (ALL == 1)
57 
58 static bool DISPLAY_OUTPUT = 0;
59 
60 static void debugOn() {DISPLAY_OUTPUT = 1;};
61 static void debugOff() {DISPLAY_OUTPUT = 0;};
62 
64 
66 {
67  uint8_t SR[2];
68  do
69  {
70  dataflashReadSR(SR);
71  SPI_Delay(10);
72  }
73  while(!(SR[0] & (1<<7)));
74 }
75 
76 void dataflashReadMID(uint8_t *rxBuffer)
77 {
79  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, 5, 0);
80  if(DISPLAY_OUTPUT)
81  {
83  }
84 }
85 
86 void dataflashReadSR(uint8_t *rxBuffer)
87 {
89  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, 2, 0);
90  if(DISPLAY_OUTPUT)
91  {
93  }
94 }
95 
96 void dataflashMemoryPageRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
97 {
99  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 4);
100  if(DISPLAY_OUTPUT)
101  {
102  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
103  }
104 }
105 
106 void dataflashArrayReadLowPower(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
107 {
109  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
110  if(DISPLAY_OUTPUT)
111  {
112  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
113  }
114 }
115 
116 void dataflashArrayReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
117 {
119  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
120  if(DISPLAY_OUTPUT)
121  {
122  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
123  }
124 }
125 
126 void dataflashArrayReadHighFreq0(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
127 {
129  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 1);
130  if(DISPLAY_OUTPUT)
131  {
132  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
133  }
134 }
135 
136 void dataflashArrayReadHighFreq1(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
137 {
139  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 2);
140  if(DISPLAY_OUTPUT)
141  {
142  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
143  }
144 }
145 
146 void dataflashArrayReadLegacy(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
147 {
149  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 4);
150  if(DISPLAY_OUTPUT)
151  {
152  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
153  }
154 }
155 
156 void dataflashBuffer1ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
157 {
159  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
160  if(DISPLAY_OUTPUT)
161  {
162  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
163  }
164 }
165 
166 void dataflashBuffer1ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
167 {
169  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 1);
170  if(DISPLAY_OUTPUT)
171  {
172  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
173  }
174 }
175 
176 void dataflashBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
177 {
179  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
180  uint32_t totalBytes = txNumBytes + 4;
181 
182  for(uint32_t j = 0; j < txNumBytes; j++)
183  {
184  txDataflashInternalBuffer[j+4] = txBuffer[j];
185  }
186  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
187  if(DISPLAY_OUTPUT)
188  {
189  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
190  }
191 }
192 
194 {
196  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
197  if(DISPLAY_OUTPUT)
198  {
200  }
201 }
202 
204 {
206  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
207  if(DISPLAY_OUTPUT)
208  {
210  }
211 }
212 
213 void dataflashMemoryProgramThruBuffer1WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
214 {
216  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
217  uint32_t totalBytes = txNumBytes + 4;
218 
219  for(uint32_t j = 0; j < txNumBytes; j++)
220  {
221  txDataflashInternalBuffer[j+4] = txBuffer[j];
222  }
223  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
224  if(DISPLAY_OUTPUT)
225  {
226  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
227  }
228 }
229 
230 void dataflashMemoryProgramThruBuffer1WithoutErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
231 {
233  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
234  uint32_t totalBytes = txNumBytes + 4;
235 
236  for(uint32_t j = 0; j < txNumBytes; j++)
237  {
238  txDataflashInternalBuffer[j+4] = txBuffer[j];
239  }
240  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
241  if(DISPLAY_OUTPUT)
242  {
243  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
244  }
245 }
246 
247 void dataflashPageErase(uint32_t address)
248 {
250  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
251  if(DISPLAY_OUTPUT)
252  {
254  }
255 }
256 
257 void dataflashBlockErase(uint32_t address)
258 {
260  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
261  if(DISPLAY_OUTPUT)
262  {
264  }
265 }
266 
267 void dataflashSectorErase(uint32_t address)
268 {
270  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
271  if(DISPLAY_OUTPUT)
272  {
274  }
275 }
276 
278 {
283  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
284  if(DISPLAY_OUTPUT)
285  {
287  }
288 }
289 
290 void dataflashRMWThruBuffer1(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
291 {
293  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
294  uint32_t totalBytes = txNumBytes + 4;
295 
296  for(uint32_t j = 0; j < txNumBytes; j++)
297  {
298  txDataflashInternalBuffer[j+4] = txBuffer[j];
299  }
300  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
301  if(DISPLAY_OUTPUT)
302  {
303  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
304  }
305 }
306 
308 {
313  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
314  if(DISPLAY_OUTPUT)
315  {
317  }
318 }
319 
321 {
326  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
327  if(DISPLAY_OUTPUT)
328  {
330  }
331 }
332 
334 {
339  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
340  if(DISPLAY_OUTPUT)
341  {
343  }
344 }
345 
346 void dataflashProgSectorProtectionReg(uint8_t *txBuffer, uint32_t txNumBytes)
347 {
352  uint32_t totalBytes = txNumBytes + 4;
353 
354  for(uint32_t j = 0; j < txNumBytes; j++)
355  {
356  txDataflashInternalBuffer[j+4] = txBuffer[j];
357  }
358  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
359  if(DISPLAY_OUTPUT)
360  {
361  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
362  }
363 }
364 
365 void dataflashReadSectorProtectionReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
366 {
368  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes, 3);
369  if(DISPLAY_OUTPUT)
370  {
371  printSPIExchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes);
372  }
373 }
374 
375 void dataflashReadSecurityReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
376 {
378  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes, 3);
379  if(DISPLAY_OUTPUT)
380  {
381  printSPIExchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes);
382  }
383 }
384 
385 void dataflashMemtoBuffer1Transfer(uint32_t address)
386 {
388  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
389  if(DISPLAY_OUTPUT)
390  {
392  }
393 }
394 
395 void dataflashMemtoBuffer1Compare(uint32_t address)
396 {
398  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
399  if(DISPLAY_OUTPUT)
400  {
402  }
403 }
404 
405 void dataflashAutoPageRewrite1(uint32_t address)
406 {
408  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
409  if(DISPLAY_OUTPUT)
410  {
412  }
413 }
414 
416 {
418  SPI_Exchange(txDataflashInternalBuffer, 1, NULL, 0, 0);
419  if(DISPLAY_OUTPUT)
420  {
422  }
423 }
424 
426 {
428  SPI_Exchange(txDataflashInternalBuffer, 1, NULL, 0, 0);
429  if(DISPLAY_OUTPUT)
430  {
432  }
433 }
434 
436 {
437  SPI_JEDECReset();
438 }
439 
441 {
443  SPI_Exchange(txDataflashInternalBuffer, 1, NULL, 0, 0);
444  if(DISPLAY_OUTPUT)
445  {
447  }
448 }
449 
451 {
456  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
457  if(DISPLAY_OUTPUT)
458  {
460  }
461 }
462 
464 {
469  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
470  if(DISPLAY_OUTPUT)
471  {
473  }
474 }
475 
477 {
482  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
483  if(DISPLAY_OUTPUT)
484  {
486  }
487 }
488 
489 void dataflashBuffer1ReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
490 {
492  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
493  if(DISPLAY_OUTPUT)
494  {
495  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
496  }
497 }
498 
499 void dataflashMemPageReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
500 {
502  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
503  if(DISPLAY_OUTPUT)
504  {
505  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
506  }
507 }
508 
509 void dataflashContinuousArrayReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
510 {
512  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
513  if(DISPLAY_OUTPUT)
514  {
515  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
516  }
517 }
518 
519 void dataflashReadSRLegacy(uint8_t *rxBuffer)
520 {
522  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, 2, 0);
523  if(DISPLAY_OUTPUT)
524  {
526  }
527 }
528 #if (PARTNO == AT45DQ161) || \
529  (PARTNO == AT45DQ321) || \
530  (ALL == 1)
531 void dataflashDualOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
532 {
534  SPI_DualExchange(4, txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 1);
535  if(DISPLAY_OUTPUT)
536  {
537  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
538  }
539 }
540 
541 void dataflashQuadOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
542 {
544  SPI_QuadExchange(4, txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 1);
545  if(DISPLAY_OUTPUT)
546  {
547  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
548  }
549 }
550 
551 void dataflashDualInputBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
552 {
554  for(uint32_t j = 0; j < txNumBytes; j++)
555  {
556  txDataflashInternalBuffer[j+4] = txBuffer[j];
557  }
558 
559  SPI_DualExchange(4, txDataflashInternalBuffer, 4, NULL, 0, 0);
560  if(DISPLAY_OUTPUT)
561  {
562  printSPIExchange(txDataflashInternalBuffer, 4, NULL, txNumBytes);
563  }
564 }
565 
566 void dataflashDualInputBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
567 {
569  for(uint32_t j = 0; j < txNumBytes; j++)
570  {
571  txDataflashInternalBuffer[j+4] = txBuffer[j];
572  }
573 
574  SPI_DualExchange(4, txDataflashInternalBuffer, 4, NULL, 0, 0);
575  if(DISPLAY_OUTPUT)
576  {
577  printSPIExchange(txDataflashInternalBuffer, 4, NULL, txNumBytes);
578  }
579 }
580 
581 void dataflashQuadInputBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
582 {
584  for(uint32_t j = 0; j < txNumBytes; j++)
585  {
586  txDataflashInternalBuffer[j+4] = txBuffer[j];
587  }
588 
589  SPI_QuadExchange(4, txDataflashInternalBuffer, 4, NULL, 0, 0);
590  if(DISPLAY_OUTPUT)
591  {
592  printSPIExchange(txDataflashInternalBuffer, 4, NULL, txNumBytes);
593  }
594 }
595 
596 void dataflashQuadInputBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
597 {
599  for(uint32_t j = 0; j < txNumBytes; j++)
600  {
601  txDataflashInternalBuffer[j+4] = txBuffer[j];
602  }
603 
604  SPI_QuadExchange(4, txDataflashInternalBuffer, 4, NULL, 0, 0);
605  if(DISPLAY_OUTPUT)
606  {
607  printSPIExchange(txDataflashInternalBuffer, 4, NULL, txNumBytes);
608  }
609 }
610 
611 void dataflashReadConfigRegister(uint8_t *rxBuffer)
612 {
614  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, 1, 0);
615  if(DISPLAY_OUTPUT)
616  {
618  }
619 }
620 
622 {
627  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
628  if(DISPLAY_OUTPUT)
629  {
631  }
632 }
633 
635 {
640  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
641  if(DISPLAY_OUTPUT)
642  {
644  }
645 }
646 
647 #endif
648 #if (PARTNO == AT45DB021E) || \
649  (PARTNO == AT45DB041E) || \
650  (PARTNO == AT45DB081E) || \
651  (PARTNO == AT45DB161E) || \
652  (PARTNO == AT45DB321E) || \
653  (PARTNO == AT45DB641E) || \
654  (PARTNO == AT45DQ161) || \
655  (PARTNO == AT45DQ321) || \
656  (ALL == 1)
658 {
660  SPI_Exchange(txDataflashInternalBuffer, 1, NULL, 0, 0);
661  if(DISPLAY_OUTPUT)
662  {
664  }
665 }
666 
668 {
670  SPI_Exchange(txDataflashInternalBuffer, 1, NULL, 0, 0);
671  if(DISPLAY_OUTPUT)
672  {
674  }
675 }
676 
677 void dataflashSectorLockdown(uint32_t address)
678 {
683  txDataflashInternalBuffer[4] = address >> 16;
684  txDataflashInternalBuffer[5] = address >> 8;
685  txDataflashInternalBuffer[6] = address;
686  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
687  if(DISPLAY_OUTPUT)
688  {
690  }
691 }
692 
693 void dataflashReadSectorLockdownReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
694 {
696  SPI_Exchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes, 3);
697  if(DISPLAY_OUTPUT)
698  {
699  printSPIExchange(txDataflashInternalBuffer, 1, rxBuffer, rxNumBytes);
700  }
701 }
702 
704 {
709  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
710  if(DISPLAY_OUTPUT)
711  {
713  }
714 }
715 
716 void dataflashProgSecurityReg(uint8_t *txBuffer, uint32_t txNumBytes)
717 {
722  uint32_t totalBytes = txNumBytes + 4;
723 
724  for(uint32_t j = 0; j < txNumBytes; j++)
725  {
726  txDataflashInternalBuffer[j+4] = txBuffer[j];
727  }
728  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
729  if(DISPLAY_OUTPUT)
730  {
731  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
732  }
733 }
734 #endif
735 #if (PARTNO == AT45DB021E) || \
736  (PARTNO == AT45DB041E) || \
737  (PARTNO == AT45DB081E) || \
738  (PARTNO == AT45DB161E) || \
739  (PARTNO == AT45DB321E) || \
740  (PARTNO == AT45DB641E) || \
741  (PARTNO == AT45DQ161) || \
742  (PARTNO == AT45DQ321) || \
743  (PARTNO == AT25PE40) || \
744  (PARTNO == AT25PE80) || \
745  (PARTNO == AT25PE16) || \
746  (ALL == 1)
747 void dataflashBuffer2ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
748 {
750  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
751  if(DISPLAY_OUTPUT)
752  {
753  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
754  }
755 }
756 
757 void dataflashBuffer2ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
758 {
760  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 1);
761  if(DISPLAY_OUTPUT)
762  {
763  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
764  }
765 }
766 
767 void dataflashBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
768 {
770  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
771  uint32_t totalBytes = txNumBytes + 4;
772 
773  for(uint32_t j = 0; j < txNumBytes; j++)
774  {
775  txDataflashInternalBuffer[j+4] = txBuffer[j];
776  }
777  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
778  if(DISPLAY_OUTPUT)
779  {
780  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
781  }
782 }
783 
785 {
787  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
788  if(DISPLAY_OUTPUT)
789  {
791  }
792 }
793 
795 {
797  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
798  if(DISPLAY_OUTPUT)
799  {
801  }
802 }
803 
804 void dataflashMemoryProgramThruBuffer2WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
805 {
807  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
808  uint32_t totalBytes = txNumBytes + 4;
809 
810  for(uint32_t j = 0; j < txNumBytes; j++)
811  {
812  txDataflashInternalBuffer[j+4] = txBuffer[j];
813  }
814  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
815  if(DISPLAY_OUTPUT)
816  {
817  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
818  }
819 }
820 
821 void dataflashRMWThruBuffer2(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
822 {
824  // Offset the data bytes by 4; opcode+address takes up the first 4 bytes of a transmission.
825  uint32_t totalBytes = txNumBytes + 4;
826 
827  for(uint32_t j = 0; j < txNumBytes; j++)
828  {
829  txDataflashInternalBuffer[j+4] = txBuffer[j];
830  }
831  SPI_Exchange(txDataflashInternalBuffer, totalBytes, NULL, 0, 0);
832  if(DISPLAY_OUTPUT)
833  {
834  printSPIExchange(txDataflashInternalBuffer, totalBytes, NULL, 0);
835  }
836 }
837 
838 void dataflashMemtoBuffer2Transfer(uint32_t address)
839 {
841  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
842  if(DISPLAY_OUTPUT)
843  {
845  }
846 }
847 
848 void dataflashMemtoBuffer2Compare(uint32_t address)
849 {
851  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
852  if(DISPLAY_OUTPUT)
853  {
855  }
856 }
857 
858 void dataflashAutoPageRewrite2(uint32_t address)
859 {
861  SPI_Exchange(txDataflashInternalBuffer, 4, NULL, 0, 0);
862  if(DISPLAY_OUTPUT)
863  {
865  }
866 }
867 
868 void dataflashBuffer2ReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
869 {
871  SPI_Exchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes, 0);
872  if(DISPLAY_OUTPUT)
873  {
874  printSPIExchange(txDataflashInternalBuffer, 4, rxBuffer, rxNumBytes);
875  }
876 }
877 #endif
878 
879 #endif
void dataflashBuffer1ReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x54 LEGACY: Reads rxNumBytes starting from location &#39;address&#39; in buffer 2 and stores the dat...
Definition: dataflash.c:489
#define CMD_DATAFLASH_ARRAY_READ_LF
Definition: cmd_defs.h:209
#define CMD_DATAFLASH_QUAD_DISABLE
Definition: cmd_defs.h:258
void dataflashArrayReadLowPower(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x01 Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:106
#define CMD_DATAFLASH_BUFFER1_READ_HF
Definition: cmd_defs.h:214
void dataflashMemoryProgramThruBuffer1WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x82 Programs main memory through buffer 1 starting at the address indicated by &#39;address&#39; w...
Definition: dataflash.c:213
void SPI_JEDECReset()
Performs a JEDEC reset on the SPI device.
Definition: spi_driver.c:492
#define CMD_DATAFLASH_PROGRAM_ERASE_SUSPEND
Definition: cmd_defs.h:269
void dataflashBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x87 Programs &#39;txNumBytes&#39; bytes of data to buffer 2 starting at the address indicated by a...
Definition: dataflash.c:767
void dataflashBlockErase(uint32_t address)
OPCODE: 0x50 Erases a block of data (8 pages) starting from page address &#39;address.&#39;.
Definition: dataflash.c:257
#define CMD_DATAFLASH_READ_SR
Definition: cmd_defs.h:237
#define CMD_DATAFLASH_CONFIGURE_P2_PG_SIZE
Definition: cmd_defs.h:239
void dataflashDPD()
OPCODE: 0xB9 Put the device into deep power down mode. Call dataflashResumeFromDPD() to wake up...
Definition: dataflash.c:415
void dataflashContinuousArrayReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x68 LEGACY: Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the b...
Definition: dataflash.c:509
void SPI_QuadExchange(uint8_t standardSPINumBytes, uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MOSI can used for the opcode and address...
Definition: spi_driver.c:406
#define CMD_DATAFLASH_ENABLE_SECT_PROTECTION
Definition: cmd_defs.h:225
#define CMD_DATAFLASH_SECTOR_ERASE
Definition: cmd_defs.h:222
void printSPIExchange(uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes)
Prints the byte array in hexadecimal with a formatted output. Indicates what bytes were sent...
#define CMD_DATAFLASH_ARRAY_READ_LP
Definition: cmd_defs.h:208
#define CMD_DATAFLASH_READ_CONFIG_REGISTER
Definition: cmd_defs.h:256
#define CMD_DATAFLASH_MEM_BUF2_COMPARE
Definition: cmd_defs.h:296
uint8_t txDataflashInternalBuffer[MAXIMUM_TX_BYTES]
Definition: dataflash.c:61
#define CMD_DATAFLASH_DUAL_INPUT_BUFFER1_WRITE
Definition: cmd_defs.h:252
void dataflashArrayReadHighFreq0(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x0B Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:126
void dataflashBuffer2ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD3 Reads rxNumBytes starting from location &#39;address&#39; in buffer 2 and stores the data in t...
Definition: dataflash.c:747
Declarations of Dataflash functions.
void dataflashQuadInputBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x47 Programs &#39;txNumBytes&#39; bytes of data to buffer 2 starting at the address indicated by a...
Definition: dataflash.c:596
#define CMD_DATAFLASH_SOFTWARE_RESET
Definition: cmd_defs.h:241
#define CMD_DATAFLASH_MEM_BUF2_TRANSFER
Definition: cmd_defs.h:295
#define CMD_DATAFLASH_QUAD_ENABLE
Definition: cmd_defs.h:257
void dataflashProgSectorProtectionReg(uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x3D_2A_7F_FC Program the sector protection register with the data in txBuffer.
Definition: dataflash.c:346
void dataflashMemtoBuffer1Compare(uint32_t address)
OPCODE: 0x60 Compare the contents of a page in main memory to the contents of buffer 1...
Definition: dataflash.c:395
#define CMD_DATAFLASH_MEM_PAGE_READ_LEG
Definition: cmd_defs.h:243
#define CMD_DATAFLASH_SECTOR_LOCKDOWN
Definition: cmd_defs.h:271
void dataflashReadSectorLockdownReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x35 Reads &#39;rxNumBytes&#39; bytes of data in from the SL register.
Definition: dataflash.c:693
void dataflashProgramEraseSuspend()
OPCODE: 0xB0 Suspends a program or erase operation in progress to a particular 64KB sector of the m...
Definition: dataflash.c:657
void dataflashBuffer1ToMainMemoryWithoutErase(uint32_t address)
OPCODE: 0x88 Programs the entire buffer 1 page to main memory starting at the address indicated by ...
Definition: dataflash.c:203
#define CMD_DATAFLASH_DUAL_INPUT_BUFFER2_WRITE
Definition: cmd_defs.h:253
#define CMD_DATAFLASH_DEEP_POWER_DOWN
Definition: cmd_defs.h:234
void dataflashAutoPageRewrite2(uint32_t address)
OPCODE: 0x59 Rewrite the page in main memory at address &#39;address.&#39; This performs a refresh of stored ...
Definition: dataflash.c:858
#define CMD_DATAFLASH_CONTINUOUS_ARRAY_READ_LEG
Definition: cmd_defs.h:244
void dataflashBuffer2ToMainMemoryWithoutErase(uint32_t address)
OPCODE: 0x89 Programs the entire buffer 2 page to main memory starting at the address indicated by ...
Definition: dataflash.c:794
#define CMD_DATAFLASH_PAGE_ERASE
Definition: cmd_defs.h:220
#define CMD_DATAFLASH_ARRAY_READ_HF0
Definition: cmd_defs.h:210
void dataflashUDPDMode()
OPCODE: 0x79 Put the device into ultra deep power down mode. Wake the device with dataflashHardware...
Definition: dataflash.c:425
#define CMD_DATAFLASH_CHIP_ERASE
Definition: cmd_defs.h:223
#define CMD_DATAFLASH_MEM_PAGE_READ
Dataflash Devices and Opcodes AT45DB021E AT45DB041E AT45DB081E AT45DB161E AT45DB321E AT45DB641E AT45D...
Definition: cmd_defs.h:207
void dataflashSoftwareReset()
OPCODE: 0xF0_00_00_00 Perform a software reset on the device. This will terminate any read or write...
Definition: dataflash.c:476
void dataflashDisableSectorProtection()
OPCODE: 0x3D_2A_7F_9A Disables sector protection.
Definition: dataflash.c:320
#define CMD_DATAFLASH_READ_SECT_PROT_REG
Definition: cmd_defs.h:229
#define CMD_DATAFLASH_ARRAY_READ_HF1
Definition: cmd_defs.h:211
#define CMD_DATAFLASH_UDPD_MODE
Definition: cmd_defs.h:236
void dataflashArrayReadLegacy(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xE8 Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:146
void dataflashRMWThruBuffer1(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x58 Reads main memory to buffer 1, modifies it, then writes the data back to main memory w...
Definition: dataflash.c:290
void dataflashAutoPageRewrite1(uint32_t address)
OPCODE: 0x58 Rewrite the page in main memory at address &#39;address.&#39; This performs a refresh of stored ...
Definition: dataflash.c:405
#define CMD_DATAFLASH_ERASE_SECT_PROT_REG
Definition: cmd_defs.h:227
void dataflashQuadEnable()
OPCODE: 0x3D2A8166 Programs the NV-QE bit to a logical 1 to enable the Quad I/O commands...
Definition: dataflash.c:621
void dataflashBuffer2ReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x56 LEGACY: Reads rxNumBytes starting from location &#39;address&#39; in buffer 2 and stores the d...
Definition: dataflash.c:868
void dataflashHardwareReset()
Perform a JEDEC reset on the flash device.
Definition: dataflash.c:435
void dataflashMemPageReadLegacy(uint8_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x52 LEGACY: Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the b...
Definition: dataflash.c:499
#define CMD_DATAFLASH_QUAD_OUTPUT_READ_ARRAY
Definition: cmd_defs.h:251
void dataflashBuffer2ToMainMemoryWithErase(uint32_t address)
OPCODE: 0x86 Programs the entire buffer 2 page to main memory starting at the address indicated by ...
Definition: dataflash.c:784
#define CMD_DATAFLASH_BUF1_2MEM_WO_ERASE
Definition: cmd_defs.h:217
void dataflashDualOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x3B Reads &#39;txNumBytes&#39; bytes of data in Dual Output Mode starting at &#39;address&#39; using both ...
Definition: dataflash.c:531
void dataflashSectorLockdown(uint32_t address)
OPCODE: 0x3D_2A_7F_30 Permanently a sector to prevent erasing or programming the stored data...
Definition: dataflash.c:677
void dataflashBuffer1ReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD1 Reads rxNumBytes starting from location &#39;address&#39; in buffer 1 and stores the data in t...
Definition: dataflash.c:156
void dataflashReadSR(uint8_t *rxBuffer)
OPCODE: 0xD7 Reads the value in the device status register (bytes 1 and 2).
Definition: dataflash.c:86
#define CMD_DATAFLASH_QUAD_INPUT_BUFFER1_WRITE
Definition: cmd_defs.h:254
void dataflashReadSRLegacy(uint8_t *rxBuffer)
OPCODE: 0x57 LEGACY: Reads the value in the device status register (bytes 1 and 2)...
Definition: dataflash.c:519
#define CMD_DATAFLASH_BUFFER2_WRITE
Definition: cmd_defs.h:290
void dataflashEraseSectorProtectionReg()
OPCODE: 0x3D_2A_7F_CF Erases the sector protection register. Erasing is required for modification/s...
Definition: dataflash.c:333
#define CMD_DATAFLASH_BUFFER2_READ_HF
Definition: cmd_defs.h:289
#define CMD_DATAFLASH_BUF2_2MEM_W_ERASE
Definition: cmd_defs.h:291
void dataflashReadSectorProtectionReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x32 Reads &#39;txNumBytes&#39; bytes of data in from the SPR register.
Definition: dataflash.c:365
#define CMD_DATAFLASH_MEM_BUF1_TRANSFER
Definition: cmd_defs.h:231
#define MAXIMUM_TX_BYTES
Definition: cmd_defs.h:46
void dataflashReadConfigRegister(uint8_t *rxBuffer)
OPCODE: 0x3F Reads the configuration register and returns the 1-byte value in rxBuffer.
Definition: dataflash.c:611
void dataflashFreezeSectorLockdown()
OPCODE: 0x34_55_AA_40 Permanently freeze the sector lockdown register to prevent any future changes...
Definition: dataflash.c:703
#define CMD_DATAFLASH_DISABLE_SECT_PROTECTION
Definition: cmd_defs.h:226
#define CMD_DATAFLASH_MEM_PRGM_BUF2_W_ERASE
Definition: cmd_defs.h:293
void dataflashArrayReadLowFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x03 Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:116
#define CMD_DATAFLASH_MEM_PRGM_BUF1_W_ERASE
Definition: cmd_defs.h:218
#define CMD_DATAFLASH_BUF2_2MEM_WO_ERASE
Definition: cmd_defs.h:292
void load4BytesToTxBuffer(uint8_t *txBuffer, uint8_t opcode, uint32_t address)
Loads 1 byte of opcode followed by 3 address bytes into the txBuffer. The data is stored at the first...
void dataflashReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
Definition: dataflash.c:76
#define CMD_DATAFLASH_PROGRAM_SECT_PROT_REG
Definition: cmd_defs.h:228
void dataflashProgSecurityReg(uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x9B_00_00_00 Program the security register with the data in txBuffer.
Definition: dataflash.c:716
void dataflashDualInputBuffer2Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x24 Programs &#39;txNumBytes&#39; bytes of data to buffer 2 starting at the address indicated by a...
Definition: dataflash.c:566
void dataflashPageErase(uint32_t address)
OPCODE: 0x81 Erases a page of data (256/264 Bytes) starting from page address &#39;address.&#39;.
Definition: dataflash.c:247
#define CMD_DATAFLASH_QUAD_INPUT_BUFFER2_WRITE
Definition: cmd_defs.h:255
void dataflashQuadInputBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x44 Programs &#39;txNumBytes&#39; bytes of data to buffer 2 starting at the address indicated by a...
Definition: dataflash.c:581
void dataflashBuffer1ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD4
Definition: dataflash.c:166
#define CMD_DATAFLASH_READ_SECURITY_REG
Definition: cmd_defs.h:230
#define CMD_DATAFLASH_FREEZE_SECTOR_LOCKDOWN
Definition: cmd_defs.h:273
#define CMD_DATAFLASH_BUFFER1_READ_LF
Definition: cmd_defs.h:213
void SPI_DualExchange(uint8_t standardSPINumBytes, uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MOSI is used for the opcode and address...
Definition: spi_driver.c:355
void dataflashSectorErase(uint32_t address)
OPCODE: 0x7C
Definition: dataflash.c:267
#define CMD_DATAFLASH_READ_SECT_LOCK_REG
Definition: cmd_defs.h:272
void dataflashMemoryPageRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD2 Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:96
#define CMD_DATAFLASH_READ_MID
Definition: cmd_defs.h:238
#define CMD_DATAFLASH_BUFFER1_WRITE
Definition: cmd_defs.h:215
void dataflashBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x84 Programs &#39;txNumBytes&#39; bytes of data to buffer 1 starting at the address indicated by a...
Definition: dataflash.c:176
#define CMD_DATAFLASH_BUFFER2_READ_LF
Definition: cmd_defs.h:288
void dataflashBuffer1ToMainMemoryWithErase(uint32_t address)
OPCODE: 0x83 Programs the entire buffer 1 page to main memory starting at the address indicated by ...
Definition: dataflash.c:193
void dataflashResumeFromDPD()
OPCODE: 0xAB Wake the device from deep power down mode. See dataflashDPD().
Definition: dataflash.c:440
#define CMD_DATAFLASH_BUF1_READ_LEG
Definition: cmd_defs.h:242
#define CMD_DATAFLASH_MEM_BUF1_COMPARE
Definition: cmd_defs.h:232
void SPI_Delay(uint32_t delayTime)
Performs a delayTime number of NOPs.
Definition: spi_driver.c:140
void dataflashProgramEraseResume()
OPCODE: 0xD0 Resumes a suspended program or erase operation. See dataflashProgramEraseSuspend().
Definition: dataflash.c:667
#define CMD_DATAFLASH_BUF1_2MEM_W_ERASE
Definition: cmd_defs.h:216
#define CMD_DATAFLASH_PROGRAM_SECURITY_REG
Definition: cmd_defs.h:274
void dataflashWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy).
Definition: dataflash.c:65
void dataflashQuadOutputRead(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x6B Reads &#39;txNumBytes&#39; bytes of data in Quad Output Mode starting at &#39;address&#39; using SI...
Definition: dataflash.c:541
void dataflashChipErase()
OPCODE: 0xC794_809A Erases the entire chip by setting all bits.
Definition: dataflash.c:277
#define CMD_DATAFLASH_SR_READ_LEG
Definition: cmd_defs.h:245
void dataflashMemtoBuffer2Compare(uint32_t address)
OPCODE: 0x61 Compare the contents of a page in main memory to the contents of buffer 2...
Definition: dataflash.c:848
#define CMD_DATAFLASH_BUF2_READ_LEG
Definition: cmd_defs.h:298
void dataflashRMWThruBuffer2(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x59 Reads main memory to buffer 1, modifies it, then writes the data back to main memory w...
Definition: dataflash.c:821
#define CMD_DATAFLASH_RD_MOD_WR_THRU_BUF1
Definition: cmd_defs.h:224
#define CMD_DATAFLASH_PROGRAM_ERASE_RESUME
Definition: cmd_defs.h:270
#define CMD_DATAFLASH_DUAL_OUTPUT_READ_ARRAY
Definition: cmd_defs.h:250
void dataflashBuffer2ReadHighFreq(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0xD6 Reads rxNumBytes starting from location &#39;address&#39; in buffer 2 and stores the data in t...
Definition: dataflash.c:757
void dataflashConfigurePower2PageSize()
OPCODE: 0x3D_2A_80_A6 Configure the device to read and write with pages configured to 256 bytes...
Definition: dataflash.c:450
void dataflashMemtoBuffer1Transfer(uint32_t address)
OPCODE: 0x53 Transfer the contents of a page in main memory at the address indicated by &#39;address&#39; t...
Definition: dataflash.c:385
void dataflashEnableSectorProtection()
OPCODE: 0x3D_2A_7F_A9 Enables sector protection.
Definition: dataflash.c:307
#define CMD_DATAFLASH_MEM_PRGM_BUF1_WO_ERASE
Definition: cmd_defs.h:219
void dataflashMemoryProgramThruBuffer1WithoutErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x02
Definition: dataflash.c:230
#define CMD_DATAFLASH_AUTO_PAGE_REWRITE1
Definition: cmd_defs.h:233
#define CMD_DATAFLASH_RD_MOD_WR_THRU_BUF2
Definition: cmd_defs.h:294
#define CMD_DATAFLASH_CONFIGURE_STD_PG_SIZE
Definition: cmd_defs.h:240
#define CMD_DATAFLASH_BLOCK_ERASE
Definition: cmd_defs.h:221
void dataflashMemtoBuffer2Transfer(uint32_t address)
OPCODE: 0x55
Definition: dataflash.c:838
void dataflashArrayReadHighFreq1(uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x1B Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: dataflash.c:136
void dataflashDualInputBuffer1Write(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x24 Programs &#39;txNumBytes&#39; bytes of data to buffer 1 starting at the address indicated by a...
Definition: dataflash.c:551
void dataflashConfigureStandardPageSize()
OPCODE: 0x3D_2A_80_A7 Configure the device to read and write with pages configured to 264 bytes...
Definition: dataflash.c:463
#define CMD_DATAFLASH_RESUME_FROM_DPD
Definition: cmd_defs.h:235
#define CMD_DATAFLASH_AUTO_PAGE_REWRITE2
Definition: cmd_defs.h:297
void SPI_Exchange(uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MISO and MOSI fill their standard SPI role...
Definition: spi_driver.c:325
void dataflashQuadDisable()
OPCODE: 0x3D2A8167 Programs the NV-QE bit to a logical 0 to disable the Quad I/O commands...
Definition: dataflash.c:634
void dataflashReadSecurityReg(uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x77 Reads &#39;rxNumBytes&#39; bytes of data in from the security register.
Definition: dataflash.c:375
void dataflashMemoryProgramThruBuffer2WithErase(uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
OPCODE: 0x85 Programs main memory through buffer 2 starting at the address indicated by &#39;address&#39; w...
Definition: dataflash.c:804
#define CMD_DATAFLASH_ARRAY_READ_LEG
Definition: cmd_defs.h:212