| 2 |
theseven |
1 |
//
|
|
|
2 |
//
|
|
|
3 |
// Copyright 2010 TheSeven
|
|
|
4 |
//
|
|
|
5 |
//
|
| 427 |
farthen |
6 |
// This file is part of emCORE.
|
| 2 |
theseven |
7 |
//
|
| 427 |
farthen |
8 |
// emCORE is free software: you can redistribute it and/or
|
| 2 |
theseven |
9 |
// modify it under the terms of the GNU General Public License as
|
|
|
10 |
// published by the Free Software Foundation, either version 2 of the
|
|
|
11 |
// License, or (at your option) any later version.
|
|
|
12 |
//
|
| 427 |
farthen |
13 |
// emCORE is distributed in the hope that it will be useful,
|
| 2 |
theseven |
14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
16 |
// See the GNU General Public License for more details.
|
|
|
17 |
//
|
|
|
18 |
// You should have received a copy of the GNU General Public License along
|
| 427 |
farthen |
19 |
// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 2 |
theseven |
20 |
//
|
|
|
21 |
//
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#ifndef __NAND_H__
|
|
|
25 |
#define __NAND_H__
|
|
|
26 |
|
|
|
27 |
#include "global.h"
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
struct nand_device_info_type
|
|
|
31 |
{
|
|
|
32 |
uint32_t id;
|
|
|
33 |
uint16_t blocks;
|
|
|
34 |
uint16_t userblocks;
|
|
|
35 |
uint16_t pagesperblock;
|
|
|
36 |
uint8_t blocksizeexponent;
|
|
|
37 |
uint8_t tunk1;
|
|
|
38 |
uint8_t twp;
|
|
|
39 |
uint8_t tunk2;
|
|
|
40 |
uint8_t tunk3;
|
|
|
41 |
} __attribute__((packed));
|
|
|
42 |
|
|
|
43 |
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
|
|
|
44 |
void* sparebuffer, uint32_t doecc,
|
|
|
45 |
uint32_t checkempty);
|
|
|
46 |
uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
|
|
|
47 |
void* sparebuffer, uint32_t doecc);
|
|
|
48 |
uint32_t nand_block_erase(uint32_t bank, uint32_t page);
|
|
|
49 |
|
|
|
50 |
uint32_t nand_read_page_fast(uint32_t page, void* databuffer,
|
|
|
51 |
void* sparebuffer, uint32_t doecc,
|
|
|
52 |
uint32_t checkempty);
|
| 54 |
theseven |
53 |
uint32_t nand_write_page_start(uint32_t bank, uint32_t page, void* databuffer,
|
|
|
54 |
void* sparebuffer, uint32_t doecc);
|
|
|
55 |
uint32_t nand_write_page_collect(uint32_t bank);
|
| 2 |
theseven |
56 |
|
|
|
57 |
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
|
|
58 |
uint32_t nand_reset(uint32_t bank);
|
| 61 |
theseven |
59 |
int nand_device_init(void);
|
| 54 |
theseven |
60 |
void nand_set_active(void);
|
|
|
61 |
long nand_last_activity(void);
|
|
|
62 |
void nand_power_up(void);
|
|
|
63 |
void nand_power_down(void);
|
| 2 |
theseven |
64 |
|
|
|
65 |
|
|
|
66 |
#endif
|