blob: 806700e951a38ee893ae89cb917bb27449aa603e [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
2 * Copyright (C) 2016, ZIXC Corporation.
3 *
4 * File Name: downloader_nand.h
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: 1.0
9 * Author: geanfeng
10 * Date: 2013-03-04
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18#ifndef _DOWNLOADER_NAND_H
19#define _DOWNLOADER_NAND_H
20/****************************************************************************
21* Include files
22****************************************************************************/
23#include <common.h>
24#include <linux/mtd/mtd.h>
25#include <command.h>
26#include <malloc.h>
27#include <nand.h>
28#include <jffs2/jffs2.h>
29#include <partition_table.h>
30/****************************************************************************
31* Macros
32****************************************************************************/
33
34/****************************************************************************
35* Types
36****************************************************************************/
37/****************************************************************************
38* Constants
39****************************************************************************/
40
41/****************************************************************************
42* Global Variables
43****************************************************************************/
xf.liaa4d92f2023-09-13 00:18:58 -070044extern unsigned char g_nor_flag;
lh9ed821d2023-04-07 01:36:19 -070045
46/****************************************************************************
47* Function Prototypes
48****************************************************************************/
49
50/*******************************************************************************
51 * Function:downloader_get_part
52 * Description:
53 * Parameters:
54 * Input:
55 *
56 * Output:
57 *
58 * Returns:
59 *
60 *
61 * Others:
62 ********************************************************************************/
63partition_entry_t * downloader_get_part(const char *partname);
64/*******************************************************************************
65 * Function:downloader_get_part_dl
66 * Description:
67 * Parameters:
68 * Input:
69 *
70 * Output:
71 *
72 * Returns:
73 *
74 *
75 * Others:
76 ********************************************************************************/
77
78partition_entry_t * downloader_get_part_dl(const char *partname);
79/*******************************************************************************
80 * Function:downloader_nand_read
81 * Description:
82 * Parameters:
83 * Input:
84 *
85 * Output:
86 *
87 * Returns:
88 *
89 *
90 * Others:
91 ********************************************************************************/
92int downloader_nand_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
93/*******************************************************************************
94 * Function:downloader_nand_write
95 * Description:
96 * Parameters:
97 * Input:
98 *
99 * Output:
100 *
101 * Returns:
102 *
103 *
104 * Others:
105 ********************************************************************************/
106int downloader_nand_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
107/*******************************************************************************
108 * Function:downloader_zftl_read
109 * Description:
110 * Parameters:
111 * Input:
112 *
113 * Output:
114 *
115 * Returns:
116 *
117 *
118 * Others:
119 ********************************************************************************/
120int downloader_zftl_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
121/*******************************************************************************
122 * Function:downloader_zftl_write
123 * Description:
124 * Parameters:
125 * Input:
126 *
127 * Output:
128 *
129 * Returns:
130 *
131 *
132 * Others:
133 ********************************************************************************/
134int downloader_zftl_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
135/*******************************************************************************
136 * Function:downloader_nand_fs_read
137 * Description:
138 * Parameters:
139 * Input:
140 *
141 * Output:
142 *
143 * Returns:
144 *
145 *
146 * Others:
147 ********************************************************************************/
148int downloader_nand_fs_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
149/*******************************************************************************
150 * Function:downloader_nand_fs_write
151 * Description:
152 * Parameters:
153 * Input:
154 *
155 * Output:
156 *
157 * Returns:
158 *
159 *
160 * Others:
161 ********************************************************************************/
162int downloader_nand_fs_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
163/*******************************************************************************
164 * Function:downloader_nand_erase
165 * Description:
166 * Parameters:
167 * Input:
168 *
169 * Output:
170 *
171 * Returns:
172 *
173 *
174 * Others:
175 ********************************************************************************/
176int downloader_nand_erase(partition_entry_t * part, uint partEraseSize);
177/*******************************************************************************
178 * Function:downloader_nand_eraseall
179 * Description:
180 * Parameters:
181 * Input:
182 *
183 * Output:
184 *
185 * Returns:
186 *
187 *
188 * Others:
189 ********************************************************************************/
190int downloader_nand_eraseall(void);
191
192/*******************************************************************************
193 * Function:downloader_nand_auto
194 * Description:
195 * Parameters:
196 * Input:
197 *
198 * Output:
199 *
200 * Returns:
201 *
202 *
203 * Others:
204 ********************************************************************************/
205int downloader_nand_erase_auto(void);
206
207int do_nand_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
208
209int do_raw_read(unsigned int offset, unsigned int size);
210
211int do_ram_read(unsigned int offset, unsigned int size);
212
213int do_zftl_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
214
215int do_yaffs_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
216
217int do_mmc_read(partition_entry_t *part, char *par , unsigned int offset,unsigned int size );
218
219int do_nand_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
220
221int do_raw_write(unsigned int offset, unsigned int size);
222
223int do_yaffs_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
224
225int do_zftl_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
226
227int do_ram_write( unsigned int offset, unsigned int size);
228
229int do_mmc_write(partition_entry_t *part, char *par , unsigned int offset,unsigned int size );
230
231#endif
232