| 1 | /* |
| 2 | * Copyright(C) 2009 Qi Hardware Inc., |
| 3 | * Authors: Xiangfu Liu <xiangfu@sharism.cc> |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __CMD_H__ |
| 20 | #define __CMD_H__ |
| 21 | |
| 22 | #include "usb_boot_defines.h" |
| 23 | |
| 24 | #define COMMAND_NUM 31 |
| 25 | |
| 26 | struct ingenic_dev ingenic_dev; |
| 27 | struct hand hand; |
| 28 | struct sdram_in sdram_in; |
| 29 | struct nand_in nand_in; |
| 30 | |
| 31 | unsigned int total_size; |
| 32 | unsigned char code_buf[4 * 512 * 1024]; |
| 33 | unsigned char check_buf[4 * 512 * 1024]; |
| 34 | unsigned char cs[16]; |
| 35 | unsigned char ret[8]; |
| 36 | |
| 37 | static const char IMAGE_TYPE[][30] = { |
| 38 | "with oob and ecc", |
| 39 | "with oob and without ecc", |
| 40 | "without oob", |
| 41 | }; |
| 42 | |
| 43 | int boot(char *stage1_path, char *stage2_path); |
| 44 | int init_nand_in(); |
| 45 | int nand_read(int mode); |
| 46 | int nand_prog(void); |
| 47 | int nand_query(void); |
| 48 | int nand_erase(struct nand_in *nand_in); |
| 49 | int debug_memory(unsigned int start, unsigned int size); |
| 50 | int debug_gpio(unsigned char ops, unsigned char pin); |
| 51 | int debug_go(void); |
| 52 | int device_reset(int ops); |
| 53 | int nand_markbad(struct nand_in *nand_in); |
| 54 | int sdram_load_file(struct sdram_in *sdram_in, char *file_path); |
| 55 | |
| 56 | #endif /* __CMD_H__ */ |
| 57 | |