mt29f nand driver: use context the right way, storing and using right chip select...
[bertos.git] / bertos / cpu / cortex-m3 / drv / mt29f_sam3.h
index a6108b06a489c66e21b36b5e3374ab619679745e..c3fa31d5b6f9b4c3eb05b4c5caae57bcccc8b84e 100644 (file)
 #ifndef MT29F_SAM3_H
 #define MT29F_SAM3_H
 
+#include <drv/mt29f.h>
+
+
 // MT29F2G08AAD, FIXME: configurable
-#define MT29F_PAGE_SIZE  2048
-#define MT29F_SIZE       0x10000000  // 256 MB
+#define MT29F_DATA_SIZE   0x800       // 2048 B
+#define MT29F_SPARE_SIZE  0x40        // 64 B
+#define MT29F_PAGE_SIZE   (MT29F_DATA_SIZE + MT29F_SPARE_SIZE)
+#define MT29F_BLOCK_SIZE  0x20000     // 128 kB
+#define MT29F_SIZE        0x10000000  // 256 MB
+#define MT29F_ECC_NWORDS  (MT29F_DATA_SIZE / 256)
 
 /*
  * PIO definitions.
 #define MT29F_PINS_PORTC    (MT29F_PIN_OE | MT29F_PIN_WE | MT29F_PIN_IO)
 #define MT29F_PERIPH_PORTC  PIO_PERIPH_A
 
-#define MT29F_PIN_CLE       BV(22)
-#define MT29F_PIN_ALE       BV(21)
+#define MT29F_PIN_CLE       BV(9)
+#define MT29F_PIN_ALE       BV(8)
 #define MT29F_PINS_PORTD    (MT29F_PIN_CLE | MT29F_PIN_ALE)
 #define MT29F_PERIPH_PORTD  PIO_PERIPH_A
 
+
 #endif /* MT29F_SAM3_H */