From 044ad7c3987460ede48ff27afd6bdb0ca05a0432 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 4 Jul 2011 20:52:54 +0200 Subject: import at91lib from at91lib_20100901_softpack_1_9_v_1_0_svn_v15011 it's sad to see that atmel doesn't publish their svn repo or has a centralized location or even puts proper version/release info into the library itself --- memories/norflash/NorFlashCFI.h | 230 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 memories/norflash/NorFlashCFI.h (limited to 'memories/norflash/NorFlashCFI.h') diff --git a/memories/norflash/NorFlashCFI.h b/memories/norflash/NorFlashCFI.h new file mode 100644 index 0000000..217608b --- /dev/null +++ b/memories/norflash/NorFlashCFI.h @@ -0,0 +1,230 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * ---------------------------------------------------------------------------- + */ + +#ifndef NORFLASHCFI_H +#define NORFLASHCFI_H + +//------------------------------------------------------------------------------ +// Local constants +//------------------------------------------------------------------------------ + +#define CFI_MAX_ERASE_REGION 4 + +/// Common flash interface query command. +#define CFI_QUERY_COMMAND 0x98 +#define CFI_QUERY_ADDRESS 0x55 +#define CFI_QUERY_OFFSET 0x10 + +//------------------------------------------------------------------------------ +// Exported defination +//------------------------------------------------------------------------------ +/// Vendor command set control interface ID code . +#define CMD_SET_NULL 0x0000 +#define CMD_SET_INTEL_EXT 0x0001 +#define CMD_SET_AMD 0x0002 +#define CMD_SET_INTEL 0x0003 +#define CMD_SET_AMD_EXT 0x0004 +#define CMD_SET_MISUBISHI 0x0100 +#define CMD_SET_MISUBISHI_EXT 0x0101 +#define CMD_SET_SST 0x0102 + + +/// Indicates the maximum region for norflash device. +#define NORFLASH_MAXNUMRIGONS 4 +/// Indicates the NorFlash uses an 8-bit address bus. +#define FLASH_CHIP_WIDTH_8BITS 0x01 +/// Indicates the NorFlash uses an 16-bit address bus. +#define FLASH_CHIP_WIDTH_16BITS 0x02 +/// Indicates the NorFlash uses an 32-bit address bus. +#define FLASH_CHIP_WIDTH_32BITS 0x04 +/// Indicates the NorFlash uses an 64-bit address bus. +#define FLASH_CHIP_WIDTH_64BITS 0x08 + +//------------------------------------------------------------------------------ +// Local Type +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// Describes a Norflash CFI query system interface information. +//------------------------------------------------------------------------------ +#ifdef __ICCARM__ // IAR +#pragma pack(1) // IAR +#define __attribute__(...) // IAR +#endif // IAR + +struct NorFlashCfiQueryInfo { + + /// Query Unique String "QRY". + unsigned char queryUniqueString[3]; + /// Primary vendor command set and control interface ID . + unsigned short primaryCode; + /// Address for primary extended query table. + unsigned short primaryAddr; + /// Alternate vendor command set and control interface ID . + unsigned short alternateCode; + /// Address for alternate extended query table. + unsigned short alternateAddr; + /// Vcc logic supply minimum write/erase voltage. + unsigned char minVcc; + /// Vcc logic supply maximum write/erase voltage. + unsigned char maxVcc; + /// Vpp logic supply minimum write/erase voltage. + unsigned char minVpp; + /// Vpp logic supply maximum write/erase voltage. + unsigned char maxVpp; + /// Timeout per single write (2<