nf.h

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00013 
00014 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00015  *
00016  * Redistribution and use in source and binary forms, with or without
00017  * modification, are permitted provided that the following conditions are met:
00018  *
00019  * 1. Redistributions of source code must retain the above copyright notice,
00020  * this list of conditions and the following disclaimer.
00021  *
00022  * 2. Redistributions in binary form must reproduce the above copyright notice,
00023  * this list of conditions and the following disclaimer in the documentation
00024  * and/or other materials provided with the distribution.
00025  *
00026  * 3. The name of Atmel may not be used to endorse or promote products derived
00027  * from this software without specific prior written permission.
00028  *
00029  * 4. This software may only be redistributed and used in connection with an Atmel
00030  * AVR product.
00031  *
00032  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00033  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00034  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00035  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00036  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00037  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00038  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00039  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00041  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00042  */
00043 
00044 #ifndef _NF_H_
00045 #define _NF_H_
00046 
00047 // ooo ooo                            o
00048 //  o   o
00049 //  o   o
00050 //  o   o   oooo   ooo oo  oo oo    ooo    oo oo    oooooo
00051 //  o o o       o    oo  o  oo  o     o     oo  o  o    o
00052 //  o o o   ooooo    o      o   o     o     o   o  o    o
00053 //  o o o  o    o    o      o   o     o     o   o  o    o
00054 //   o o   o    o    o      o   o     o     o   o   ooooo
00055 //   o o    oooo o ooooo   ooo ooo  ooooo  ooo ooo      o
00056 //                                                      o
00057 //                                                  oooo
00058 //
00059 // Please note that auto-detect mode (NF_AUTO_DETECT_2KB=TRUE or
00060 // NF_AUTO_DETECT_512B=TRUE) may give different performances
00061 // than static compilation (#define NF_TYPE_...)
00062 //
00063 
00065 #define  M_ID_MICRON       0x2C
00066 #define  M_ID_HYNIX        0xAD
00067 #define  M_ID_SANDISK      0x98
00068 #define  M_ID_ST           0x20
00069 #define  M_ID_TOSHIBA      0x98
00070 #define  M_ID_TOSHIBA96    0x96
00071 #define  M_ID_SAMSUNG      0xEC
00072 #define  M_ID_INFINEON     0xC1
00073 
00074 // Structs used in generic mode
00075 
00076 // Device Indentifiant
00077 typedef struct {
00078    U8  manuf;
00079    U8  dev;
00080    U8  conf;
00081 } St_nf_id;
00082 
00083 // Table to link Device Indentifiant and Number of block
00084 typedef struct {
00085    U8  dev_id;
00086    U8  nb_zones;     // zone = 1024 blocks
00087 }St_nf_link_id_block;
00088 
00089 // Device Configuration
00090 typedef struct {
00091    U8  copy_back_cont   :4;
00092    U8  copy_back_discont:4;
00093    U8  cache_program    :1;
00094    U8  ce_toggle        :1;
00095 } St_nf_conf;
00096 
00097 
00098 //-- Pre Check configuration
00099 //
00100 #define NF_BAD_CONFIG            FALSE
00101 #define NF_GENERIC_DRIVER        FALSE // the configuration TRUE, it is not available
00102 #define NF_SHIFT_SECTOR_BYTE     9     // (1<<n) size of sector, unit in bytes (other value not supported)
00103 #if (!defined NF_AUTO_DETECT_2KB)
00104 #  define   NF_AUTO_DETECT_2KB   FALSE
00105 #endif
00106 #if (!defined NF_AUTO_DETECT_512B)
00107 #  define   NF_AUTO_DETECT_512B  FALSE
00108 #endif
00109 #if (NF_AUTO_DETECT_2KB==TRUE) && (NF_AUTO_DETECT_512B==TRUE)
00110 #  undef  NF_BAD_CONFIG
00111 #  define NF_BAD_CONFIG (TRUE)
00112 #  error NF_AUTO_DETECT_2KB and NF_AUTO_DETECT_512B can not be activated at the same time.
00113 #endif
00114 
00115 #include "nf_512B.h"
00116 #include "nf_2KB.h"
00117 
00118 //-- Final Check configuration
00119 //
00120 #if (NF_AUTO_DETECT_2KB==TRUE) && (NF_TYPE_512B_KNOWN==TRUE)
00121 #  undef  NF_BAD_CONFIG
00122 #  define NF_BAD_CONFIG (TRUE)
00123 #  error NF_AUTO_DETECT_2KB and NF_TYPE_x 512B can not be activated at the same time.
00124 #endif
00125 #if (NF_AUTO_DETECT_512B==TRUE) && (NF_TYPE_2KB_KNOWN==TRUE)
00126 #  undef  NF_BAD_CONFIG
00127 #  define NF_BAD_CONFIG (TRUE)
00128 #  error NF_AUTO_DETECT_512B and NF_TYPE_x 2KB can not be activated at the same time.
00129 #endif
00130 #if (NF_AUTO_DETECT_2KB==FALSE) && (NF_AUTO_DETECT_512B==FALSE)
00131 #  define NF_DETECTION_ID  (DISABLE)
00132 #  if (NF_TYPE_2KB_KNOWN ==FALSE) && (NF_TYPE_512B_KNOWN ==FALSE)
00133 #     undef  NF_BAD_CONFIG
00134 #     define NF_BAD_CONFIG (TRUE)
00135 #     error No NandFlash configuration found (NF_AUTO_DETECT_2KB, NF_AUTO_DETECT_512B, NF_TYPE_x)
00136 #  endif
00137 #else
00138 #  define NF_DETECTION_ID  (ENABLE)
00139 #endif
00140 
00141 
00142 #endif   // _NF_H_

Generated on Wed Sep 23 09:17:02 2009 for ATMEL by  doxygen 1.5.3