| 253 |
theseven |
1 |
//
|
|
|
2 |
//
|
|
|
3 |
// Copyright 2009 TheSeven
|
|
|
4 |
//
|
|
|
5 |
//
|
|
|
6 |
// This file is part of the Linux4Nano toolkit.
|
|
|
7 |
//
|
|
|
8 |
// TheSeven's iBugger is free software: you can redistribute it and/or
|
|
|
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 |
//
|
|
|
13 |
// TheSeven's iBugger is distributed in the hope that it will be useful,
|
|
|
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
|
|
|
19 |
// with the Linux4Nano toolkit. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20 |
//
|
|
|
21 |
//
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#ifndef __NAND_H__
|
|
|
25 |
#define __NAND_H__
|
|
|
26 |
|
|
|
27 |
#include <toolkit.h>
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
#define NAND_CMD_READ 0x00
|
|
|
31 |
#define NAND_CMD_PROGCNFRM 0x10
|
|
|
32 |
#define NAND_CMD_READ2 0x30
|
|
|
33 |
#define NAND_CMD_BLOCKERASE 0x60
|
|
|
34 |
#define NAND_CMD_GET_STATUS 0x70
|
|
|
35 |
#define NAND_CMD_PROGRAM 0x80
|
|
|
36 |
#define NAND_CMD_ERASECNFRM 0xD0
|
|
|
37 |
#define NAND_CMD_RESET 0xFF
|
|
|
38 |
|
|
|
39 |
#define NAND_STATUS_READY 0x40
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
struct nand_device_info_type
|
|
|
43 |
{
|
|
|
44 |
uint32_t id;
|
|
|
45 |
uint16_t blocks;
|
|
|
46 |
uint16_t userblocks;
|
|
|
47 |
uint8_t blocksizeexponent;
|
|
|
48 |
uint8_t tunk1;
|
|
|
49 |
uint8_t twp;
|
|
|
50 |
uint8_t dummy;
|
|
|
51 |
} __attribute__((packed));
|
|
|
52 |
|
|
|
53 |
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* data, void* spare, uint32_t checkempty);
|
|
|
54 |
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
|
|
55 |
uint32_t nand_reset(uint32_t bank);
|
|
|
56 |
uint32_t nand_init();
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
#endif
|