1 |
7 |
pradd |
#ifndef CMD_H
|
2 |
|
|
#define CMD_H
|
3 |
|
|
|
4 |
|
|
/* Communication protocol commands */
|
5 |
|
|
#define NAND_CHIP_ENABLE 1
|
6 |
|
|
#define NAND_CHIP_DISABLE 2
|
7 |
|
|
#define NAND_CHIP_RESET 3
|
8 |
|
|
#define NAND_CHIP_READ_ID 4
|
9 |
|
|
#define NAND_CHIP_READ_ID_ONFI 5
|
10 |
|
|
#define NAND_CHIP_READ_PARAM_PAGE 6
|
11 |
|
|
#define NAND_CHIP_READ_PAGE 7
|
12 |
|
|
#define NAND_SET_CONFIG_DATA 8
|
13 |
|
|
#define NAND_CHIP_READ_CACHE_SEQ 9 // READ_PAGE_CACHE_SEQUENTIAL
|
14 |
|
|
#define NAND_CHIP_READ_STATUS 10
|
15 |
|
|
#define NAND_CHIP_READ_UNIQUE_ID 11
|
16 |
|
|
#define NAND_CHIP_BLOCK_ERASE 12
|
17 |
|
|
#define NAND_CHIP_TOGGLE_WP 13
|
18 |
|
|
#define NAND_CHIP_PAGE_PROGRAM 14
|
19 |
|
|
#define NAND_CHIP_READ_STATUS_ENHANCED 15
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
/* Chip commands (ONFI) */
|
23 |
|
|
#define NC_RESET 0xFF
|
24 |
|
|
#define NC_READ_ID 0x90
|
25 |
|
|
#define NC_READ_PARAM_PAGE 0xEC
|
26 |
|
|
#define NC_READ_MODE 0x00
|
27 |
|
|
#define NC_READ_PAGE 0x30
|
28 |
|
|
#define NC_READ_PAGE_CACHE_SEQ 0x31
|
29 |
|
|
#define NC_READ_PAGE_CACHE_LAST 0x3F
|
30 |
|
|
#define NC_READ_STATUS 0x70
|
31 |
|
|
#define NC_READ_UNIQUE_ID 0xED
|
32 |
|
|
#define NC_BLOCK_ERASE1 0x60
|
33 |
|
|
#define NC_BLOCK_ERASE2 0xD0
|
34 |
|
|
#define NC_PAGE_PROGRAM_START 0x80
|
35 |
|
|
#define NC_PAGE_PROGRAM_END 0x10
|
36 |
|
|
#define NC_READ_STATUS_ENHANCED 0x78
|
37 |
|
|
|
38 |
|
|
void do_delay(int cycles);
|
39 |
|
|
|
40 |
|
|
void cmd_chip_enable(unsigned char* cmd);
|
41 |
|
|
void cmd_chip_disable();
|
42 |
|
|
void cmd_chip_reset();
|
43 |
|
|
void cmd_chip_read_id(unsigned char* outBuffer, int addr);
|
44 |
|
|
void cmd_chip_read_param_page(unsigned char* outBuffer);
|
45 |
|
|
void cmd_chip_read_page(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCycles);
|
46 |
|
|
void cmd_chip_read_page_cache_sequential(unsigned char* inBuffer, unsigned char* outBuffer, int len, int addressCylces);
|
47 |
|
|
unsigned char cmd_chip_read_status();
|
48 |
|
|
unsigned char cmd_chip_read_status_enhanced(unsigned char* inBuffer, int addressCycles);
|
49 |
|
|
void cmd_chip_read_unique_id(unsigned char* outBuffer);
|
50 |
|
|
void cmd_chip_block_erase(unsigned char* inBuffer);
|
51 |
|
|
unsigned char cmd_chip_page_program(unsigned char* inBuffer, int addressCycles, int pageSize);
|
52 |
|
|
|
53 |
|
|
#endif /* CMD_H */
|