lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /*******************************************************************************
|
| 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 | ****************************************************************************/
|
| 44 |
|
| 45 | /****************************************************************************
|
| 46 | * Function Prototypes
|
| 47 | ****************************************************************************/
|
| 48 |
|
| 49 | /*******************************************************************************
|
| 50 | * Function:downloader_get_part
|
| 51 | * Description:
|
| 52 | * Parameters:
|
| 53 | * Input:
|
| 54 | *
|
| 55 | * Output:
|
| 56 | *
|
| 57 | * Returns:
|
| 58 | *
|
| 59 | *
|
| 60 | * Others:
|
| 61 | ********************************************************************************/
|
| 62 | partition_entry_t * downloader_get_part(const char *partname);
|
| 63 | /*******************************************************************************
|
| 64 | * Function:downloader_get_part_dl
|
| 65 | * Description:
|
| 66 | * Parameters:
|
| 67 | * Input:
|
| 68 | *
|
| 69 | * Output:
|
| 70 | *
|
| 71 | * Returns:
|
| 72 | *
|
| 73 | *
|
| 74 | * Others:
|
| 75 | ********************************************************************************/
|
| 76 |
|
| 77 | partition_entry_t * downloader_get_part_dl(const char *partname);
|
| 78 | /*******************************************************************************
|
| 79 | * Function:downloader_nand_read
|
| 80 | * Description:
|
| 81 | * Parameters:
|
| 82 | * Input:
|
| 83 | *
|
| 84 | * Output:
|
| 85 | *
|
| 86 | * Returns:
|
| 87 | *
|
| 88 | *
|
| 89 | * Others:
|
| 90 | ********************************************************************************/
|
| 91 | int downloader_nand_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 92 | /*******************************************************************************
|
| 93 | * Function:downloader_nand_write
|
| 94 | * Description:
|
| 95 | * Parameters:
|
| 96 | * Input:
|
| 97 | *
|
| 98 | * Output:
|
| 99 | *
|
| 100 | * Returns:
|
| 101 | *
|
| 102 | *
|
| 103 | * Others:
|
| 104 | ********************************************************************************/
|
| 105 | int downloader_nand_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 106 | /*******************************************************************************
|
| 107 | * Function:downloader_zftl_read
|
| 108 | * Description:
|
| 109 | * Parameters:
|
| 110 | * Input:
|
| 111 | *
|
| 112 | * Output:
|
| 113 | *
|
| 114 | * Returns:
|
| 115 | *
|
| 116 | *
|
| 117 | * Others:
|
| 118 | ********************************************************************************/
|
| 119 | int downloader_zftl_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 120 | /*******************************************************************************
|
| 121 | * Function:downloader_zftl_write
|
| 122 | * Description:
|
| 123 | * Parameters:
|
| 124 | * Input:
|
| 125 | *
|
| 126 | * Output:
|
| 127 | *
|
| 128 | * Returns:
|
| 129 | *
|
| 130 | *
|
| 131 | * Others:
|
| 132 | ********************************************************************************/
|
| 133 | int downloader_zftl_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 134 | /*******************************************************************************
|
| 135 | * Function:downloader_nand_fs_read
|
| 136 | * Description:
|
| 137 | * Parameters:
|
| 138 | * Input:
|
| 139 | *
|
| 140 | * Output:
|
| 141 | *
|
| 142 | * Returns:
|
| 143 | *
|
| 144 | *
|
| 145 | * Others:
|
| 146 | ********************************************************************************/
|
| 147 | int downloader_nand_fs_read(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 148 | /*******************************************************************************
|
| 149 | * Function:downloader_nand_fs_write
|
| 150 | * Description:
|
| 151 | * Parameters:
|
| 152 | * Input:
|
| 153 | *
|
| 154 | * Output:
|
| 155 | *
|
| 156 | * Returns:
|
| 157 | *
|
| 158 | *
|
| 159 | * Others:
|
| 160 | ********************************************************************************/
|
| 161 | int downloader_nand_fs_write(partition_entry_t * part, uint offset, uint size, unchar * buffer);
|
| 162 | /*******************************************************************************
|
| 163 | * Function:downloader_nand_erase
|
| 164 | * Description:
|
| 165 | * Parameters:
|
| 166 | * Input:
|
| 167 | *
|
| 168 | * Output:
|
| 169 | *
|
| 170 | * Returns:
|
| 171 | *
|
| 172 | *
|
| 173 | * Others:
|
| 174 | ********************************************************************************/
|
| 175 | int downloader_nand_erase(partition_entry_t * part, uint partEraseSize);
|
| 176 | /*******************************************************************************
|
| 177 | * Function:downloader_nand_eraseall
|
| 178 | * Description:
|
| 179 | * Parameters:
|
| 180 | * Input:
|
| 181 | *
|
| 182 | * Output:
|
| 183 | *
|
| 184 | * Returns:
|
| 185 | *
|
| 186 | *
|
| 187 | * Others:
|
| 188 | ********************************************************************************/
|
| 189 | int downloader_nand_eraseall(void);
|
| 190 |
|
| 191 | /*******************************************************************************
|
| 192 | * Function:downloader_nand_auto
|
| 193 | * Description:
|
| 194 | * Parameters:
|
| 195 | * Input:
|
| 196 | *
|
| 197 | * Output:
|
| 198 | *
|
| 199 | * Returns:
|
| 200 | *
|
| 201 | *
|
| 202 | * Others:
|
| 203 | ********************************************************************************/
|
| 204 | int downloader_nand_erase_auto(void);
|
| 205 |
|
| 206 | int do_nand_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
|
| 207 |
|
| 208 | int do_raw_read(unsigned int offset, unsigned int size);
|
| 209 |
|
| 210 | int do_ram_read(unsigned int offset, unsigned int size);
|
| 211 |
|
| 212 | int do_zftl_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
|
| 213 |
|
| 214 | int do_yaffs_read(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
|
| 215 |
|
| 216 | int do_mmc_read(partition_entry_t *part, char *par , unsigned int offset,unsigned int size );
|
| 217 |
|
| 218 | int do_nand_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
|
| 219 |
|
| 220 | int do_raw_write(unsigned int offset, unsigned int size);
|
| 221 |
|
| 222 | int do_yaffs_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size );
|
| 223 |
|
| 224 | int do_zftl_write(partition_entry_t *part, char *par , unsigned int offset, unsigned int size);
|
| 225 |
|
| 226 | int do_ram_write( unsigned int offset, unsigned int size);
|
| 227 |
|
| 228 | int do_mmc_write(partition_entry_t *part, char *par , unsigned int offset,unsigned int size );
|
| 229 |
|
| 230 | #endif
|
| 231 |
|