Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __FLASH_NOR_H__
17 #define __FLASH_NOR_H__
19 // If Flash parameters are not already defined, set them to Tyax values.
20 #ifndef FLASHERASEBLOCKSIZE
21 #define FLASHERASEBLOCKSIZE 0x20000 //128KB
23 #ifndef FLASHWRITEBUFSIZE
24 #define FLASHWRITEBUFSIZE 0x40 //64 bytes
27 ///////////////////////////////////////////////////////////////////////////////
29 // CFI - flash identification
31 ///////////////////////////////////////////////////////////////////////////////
32 enum CfiManifacturerId
34 CFI_MANUF_SPANSION = 0x01,
35 CFI_MANUF_INTEL = 0x89,
36 CFI_MANUF_ANY = (TUint16) -1, // some manufacturers' flash chips comform to one standard CFI command set
41 CFI_DEV_S29GL512N = 0x227e,
42 CFI_DEV_SIBLEY = 0x88b1, // Intel Sibley as found on 3430 SDP (H6)
43 CFI_DEV_28F256L18T = 0x880d, // Intel Tyax as found on my H4
44 CFI_DEV_ANY = (TUint16) -1, // some manufacturers' flash chips comform to one standard CFI command set
50 TUint16 manufacturerId;
53 TInt (*reset)(TUint32 flashId, TUint32 address);
54 TInt (*erase)(TUint32 flashId, TUint32 aBase, TUint32 anAddr, TUint32 aSize);
55 TInt (*write)(TUint32 flashId, TUint32 anAddr, TUint32 aSize, const TUint32* aPS);
57 TUint blockSize; // the physical block size of the flash
61 const TUint FLASH_TYPE_UNKNOWN = 0;
63 ///////////////////////////////////////////////////////////////////////////////
65 // CFI - generic command processing
67 ///////////////////////////////////////////////////////////////////////////////
70 TUint32 location; // where to write this command to
71 TUint32 offset; // the offset for this command
72 TUint32 command; // the command itself
78 CFI_BASE8, // use the base address for this 8 bit command
79 CFI_SECTOR8, // use the sector address for this 8 bit command
81 CFI_END = (TUint32) -1 // used to mark the end of the command sequence
86 const TUint32 KFlashEraseBlockSize = FLASHERASEBLOCKSIZE;
87 const TUint32 KFlashWriteBufSize = FLASHWRITEBUFSIZE;
88 const TUint32 KRebootDelaySecs = 5; // Delay(S) between flashing bootldr to reboot
91 //const TUint8 KCmdWordProgram = 0x40 ;
92 const TUint8 KCmdBlockErase1 = 0x20 ;
93 const TUint8 KCmdBlockErase2 = 0xd0 ;
94 //const TUint8 KCmdEraseSuspend = 0xb0 ;
95 //const TUint8 KCmdEraseResume = 0xd0 ;
96 const TUint8 KCmdReadStatus = 0x70 ;
97 const TUint8 KCmdClearStatus = 0x50 ;
98 const TUint8 KCmdReadArrayMode = 0xFF ;
99 const TUint8 KCmdClearBlockLockBit1 = 0x60 ;
100 const TUint8 KCmdClearBlockLockBit2 = 0xD0 ;
101 //const TUint8 KCmdSetBlockLockBit1 = 0x60 ;
102 //const TUint8 KCmdSetBlockLockBit2 = 0x01 ;
105 const TUint8 KStatusBusy = 0x80 ;
106 //const TUint8 KStatusProgramError = 0x38 ;
107 //const TUint8 KStatusVoltageError = 0x08 ;
108 const TUint8 KStatusCmdSeqError = 0x30 ;
109 const TUint8 KStatusLockBitError = 0x20 ;
111 const TUint8 KCmdWriteStatusSibley = 0xE9; // Sibley write
112 const TUint8 KCmdWriteStatus = 0xE8; // send Tyax write
114 GLREF_C TUint32 * GetFlashChunk(void);
115 GLREF_C TBool BlankCheck (TUint32 anAddr, TUint32 aSize);
116 GLREF_C TInt Erase (TUint32 anAddr, TUint32 aSize);
117 GLREF_C TInt Write (TUint32 anAddr, TUint32 aSize, const TUint32* aPS);