c3fa31d5b6f9b4c3eb05b4c5caae57bcccc8b84e
[bertos.git] / bertos / cpu / cortex-m3 / drv / mt29f_sam3.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2011 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief Micron MT29F serial NAND driver for SAM3's static memory controller (interface).
34  *
35  * \author Stefano Fedrigo <aleph@develer.com>
36  */
37
38 #ifndef MT29F_SAM3_H
39 #define MT29F_SAM3_H
40
41 #include <drv/mt29f.h>
42
43
44 // MT29F2G08AAD, FIXME: configurable
45 #define MT29F_DATA_SIZE   0x800       // 2048 B
46 #define MT29F_SPARE_SIZE  0x40        // 64 B
47 #define MT29F_PAGE_SIZE   (MT29F_DATA_SIZE + MT29F_SPARE_SIZE)
48 #define MT29F_BLOCK_SIZE  0x20000     // 128 kB
49 #define MT29F_SIZE        0x10000000  // 256 MB
50 #define MT29F_ECC_NWORDS  (MT29F_DATA_SIZE / 256)
51
52 /*
53  * PIO definitions.
54  */
55 #define MT29F_PIN_CE        BV(6)
56 #define MT29F_PIN_RB        BV(2)
57 #define MT29F_PINS_PORTA    (MT29F_PIN_CE | MT29F_PIN_RB)
58 #define MT29F_PERIPH_PORTA  PIO_PERIPH_B
59
60 #define MT29F_PIN_OE        BV(19)
61 #define MT29F_PIN_WE        BV(20)
62 #define MT29F_PIN_IO        0x0000FFFF
63 #define MT29F_PINS_PORTC    (MT29F_PIN_OE | MT29F_PIN_WE | MT29F_PIN_IO)
64 #define MT29F_PERIPH_PORTC  PIO_PERIPH_A
65
66 #define MT29F_PIN_CLE       BV(9)
67 #define MT29F_PIN_ALE       BV(8)
68 #define MT29F_PINS_PORTD    (MT29F_PIN_CLE | MT29F_PIN_ALE)
69 #define MT29F_PERIPH_PORTD  PIO_PERIPH_A
70
71
72 #endif /* MT29F_SAM3_H */
73