00001 /* ---------------------------------------------------------------------------- 00002 * ATMEL Microcontroller Software Support 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2010, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 00030 #ifndef NANDCOMMON_H 00031 #define NANDCOMMON_H 00032 00033 /*---------------------------------------------------------------------------- 00034 * Definitions 00035 *----------------------------------------------------------------------------*/ 00036 00037 /** 00038 * \file 00039 * NandFlash Maximum Supported Values 00040 * Since no memory allocation is available, limits have been set on various 00041 * characteristics of a NandFlash chip: 00042 * 00043 * Maximums 00044 * - NandCommon_MAXNUMBLOCKS 00045 * - NandCommon_MAXNUMPAGESPERBLOCK 00046 * - NandCommon_MAXPAGESIZE 00047 */ 00048 00049 /** Maximum number of blocks in a device */ 00050 #define NandCommon_MAXNUMBLOCKS 1024 //2048 00051 00052 /** Maximum number of pages in one block*/ 00053 #define NandCommon_MAXNUMPAGESPERBLOCK 256 //64 00054 00055 /** Maximum size of the data area of one page, in bytes.*/ 00056 #if !defined(NF_MAXPAGESIZE_SUPPORT_2K) 00057 #define NandCommon_MAXPAGEDATASIZE 4096 //2048 00058 #else 00059 #define NandCommon_MAXPAGEDATASIZE 2048 00060 #endif 00061 00062 /** Maximum size of the spare area of one page, in bytes.*/ 00063 #define NandCommon_MAXPAGESPARESIZE 128 //64 00064 00065 /** Maximum number of ecc bytes stored in the spare for one single page.*/ 00066 #define NandCommon_MAXSPAREECCBYTES 48 //24 00067 00068 /** Maximum number of extra free bytes inside the spare area of a page.*/ 00069 #define NandCommon_MAXSPAREEXTRABYTES 78 //38 00070 00071 00072 /** 00073 * NandFlash Error Codes 00074 * NandFlash API methods return either 0 (indicating that there was no error), 00075 * or one of the following error codes: 00076 * 00077 * - NandCommon_ERROR_NOMOREBLOCKS 00078 * - NandCommon_ERROR_BLOCKNOTMAPPED 00079 * - NandCommon_ERROR_OUTOFBOUNDS 00080 *- NandCommon_ERROR_MAPPINGNOTFOUND 00081 * - NandCommon_ERROR_CANNOTREAD 00082 */ 00083 00084 /** No more blocks can be allocated for a write operation.*/ 00085 #define NandCommon_ERROR_NOMOREBLOCKS 1 00086 00087 /** The desired logical block has no current physical mapping.*/ 00088 #define NandCommon_ERROR_BLOCKNOTMAPPED 2 00089 00090 /** Access if out-of-bounds.*/ 00091 #define NandCommon_ERROR_OUTOFBOUNDS 3 00092 00093 /** There are no block having the desired property.*/ 00094 #define NandCommon_ERROR_NOBLOCKFOUND 4 00095 00096 /** The nandflash device has no logical mapping information on it.*/ 00097 #define NandCommon_ERROR_MAPPINGNOTFOUND 5 00098 00099 /** A read operation cannot be carried out.*/ 00100 #define NandCommon_ERROR_CANNOTREAD 6 00101 00102 /** A write operation cannot be carried out.*/ 00103 #define NandCommon_ERROR_CANNOTWRITE 7 00104 00105 /** NandFlash chip model cannot be recognized.*/ 00106 #define NandCommon_ERROR_UNKNOWNMODEL 8 00107 00108 /** Page data is corrupted according to ECC*/ 00109 #define NandCommon_ERROR_CORRUPTEDDATA 9 00110 00111 /** Block is not in the required status.*/ 00112 #define NandCommon_ERROR_WRONGSTATUS 10 00113 00114 /** Device has no logical mapping stored in it*/ 00115 #define NandCommon_ERROR_NOMAPPING 11 00116 00117 /** The block being accessed is bad and must be replaced*/ 00118 #define NandCommon_ERROR_BADBLOCK 12 00119 00120 /** Failed to perform an erase operation*/ 00121 #define NandCommon_ERROR_CANNOTERASE 13 00122 00123 /** A hardware copyback operation failed.*/ 00124 #define NandCommon_ERROR_CANNOTCOPY 14 00125 00126 /** HW Ecc Not compatible with the Nand Model*/ 00127 #define NandCommon_ERROR_ECC_NOT_COMPATIBLE 15 00128 00129 /** DMA failed. */ 00130 #define NandCommon_ERROR_DMA 16 00131 00132 #endif /*#ifndef NANDCOMMON_H */ 00133