00001 /* 00002 * $Id: MAM.h,v 1 2006/03/27 19:19:00 BorisK Exp $ 00003 * 00004 * Copyright (C) 2006 ONTRACK s.r.o. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 * 02111-1307, USA. 00020 * 00021 * [1] ARM-based Microcontroller LPC2119/2129/2194/2292/9994, "Preliminary User Manual", February 03, 2004 00022 * Written by Boris Kralik <kralikbo@yahoo.com>, 2006 00023 * [2] 3 Volt Synchronous Intel StrataFlash Memory, OrderNumber:290737-004, February 2002 00024 * 00025 */ 00026 #ifndef MAM_H 00027 #define MAM_H 00028 00029 #include "lpc2119.h" 00030 #include "types.h" 00031 00032 #define AB_LSB_16 1 //LSB for TE28F128J3C (128MBit) 00033 #define AB_CHAIN_OFFSET 3 //A Offset = 3 00034 #define DB_CHAIN_OFFSET 27 00035 00036 #define OUT 1 00037 #define IN 0 00038 00039 #define nCE 0 00040 #define nOE 1 00041 #define nWE 2 00042 00043 /* Name: SetGPIOAddress 00044 * Parameter: uint32_t 00045 * Return value: void 00046 */ 00047 void SetGPIOAddress(uint32_t address); 00048 00049 /* Name: SetGPIOData 00050 * Parameter: uint16_t 00051 * Return value: void 00052 */ 00053 void SetGPIOData(uint16_t data); 00054 00055 /* Name: MemGPIOInit (P3.1-P3.23(AB) - OUT, P1.0(/CE)-L, P1.1(OE), P3.27(WE), P2.0-P2.15(D0-15) - OUT) 00056 * Parameter: void 00057 * Return value: void 00058 */ 00059 void MemGPIOInit(void); 00060 void SetSignal(char const *,short,uint32_t); //nCE,nWE,nOE;IN/OUT;value(0/1) 00061 void SetGPIOData(uint16_t); 00062 /* 00063 * Name: ReadDB 00064 * Parameter: uint32_t 00065 * Return value: uint32_t 00066 */ 00067 uint32_t ReadDB(uint32_t);//Read Data bus 00068 /* 00069 * Name: ReadDBEnd 00070 * Parameter: void 00071 * Return value: uint32_t 00072 */ 00073 uint32_t ReadDBEnd(void); 00074 /* 00075 * Name: ReadDBStart 00076 * Parameter: uint32_t 00077 * Return value: void 00078 */ 00079 void ReadDBStart(uint32_t); 00080 00081 void MemGPIOCE(short); 00082 void MemGPIOWE(short);//GPIO1.1 00083 void MemGPIOOE(short);//GPIO1.1 00084 00085 typedef struct JEDEC{ 00086 uint8_t sManufacturer; 00087 uint8_t sDevice; 00088 }pJEDEC; 00089 typedef struct cfi_query_system_interface_information{ 00090 uint16_t vcc_min_wev; /* in mV */ 00091 uint16_t vcc_max_wev; /* in mV */ 00092 uint16_t vpp_min_wev; /* in mV, 0 - no Vpp pin is present */ 00093 uint16_t vpp_max_wev; /* in mV, 0 - no Vpp pin is present */ 00094 uint32_t typ_single_write_timeout; /* in us, 0 - not supported */ 00095 uint32_t typ_buffer_write_timeout; /* in us, 0 - not supported */ 00096 uint32_t typ_block_erase_timeout; /* in ms, 0 - not supported */ 00097 uint32_t typ_chip_erase_timeout; /* in ms, 0 - not supported */ 00098 uint32_t max_single_write_timeout; /* in us, 0 - not supported */ 00099 uint32_t max_buffer_write_timeout; /* in us, 0 - not supported */ 00100 uint32_t max_block_erase_timeout; /* in ms, 0 - not supported */ 00101 uint32_t max_chip_erase_timeout; /* in ms, 0 - not supported */ 00102 00103 }cfi_query_system_interface_information_t; 00104 typedef struct CFI{ 00105 uint8_t sQ; 00106 uint8_t sR; 00107 uint8_t sY; 00108 cfi_query_system_interface_information_t qsi; 00109 }pCFI; 00110 00111 pJEDEC detect_jedec(void); 00112 pCFI detect_cfi(void); 00113 00114 uint8_t chain[45]; 00115 00116 #endif
1.4.7