os/kernelhwsrv/brdbootldr/ubootldr/inc/flash_nor.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/brdbootldr/ubootldr/inc/flash_nor.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,119 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __FLASH_NOR_H__
    1.20 +#define __FLASH_NOR_H__
    1.21 +
    1.22 +// If Flash parameters are not already defined, set them to Tyax values.
    1.23 +#ifndef FLASHERASEBLOCKSIZE
    1.24 +#define FLASHERASEBLOCKSIZE 0x20000 //128KB
    1.25 +#endif
    1.26 +#ifndef FLASHWRITEBUFSIZE
    1.27 +#define FLASHWRITEBUFSIZE 0x40 //64 bytes
    1.28 +#endif
    1.29 +
    1.30 +///////////////////////////////////////////////////////////////////////////////
    1.31 +//
    1.32 +// CFI - flash identification
    1.33 +//
    1.34 +///////////////////////////////////////////////////////////////////////////////
    1.35 +enum CfiManifacturerId
    1.36 +	{
    1.37 +	CFI_MANUF_SPANSION = 0x01,
    1.38 +	CFI_MANUF_INTEL    = 0x89,
    1.39 +	CFI_MANUF_ANY      = (TUint16) -1, // some manufacturers' flash chips comform to one standard CFI command set
    1.40 +	};
    1.41 +
    1.42 +enum CfiDeviceId
    1.43 +	{
    1.44 +	CFI_DEV_S29GL512N  = 0x227e,
    1.45 +	CFI_DEV_SIBLEY     = 0x88b1,          // Intel Sibley as found on 3430 SDP (H6)
    1.46 +	CFI_DEV_28F256L18T = 0x880d,          // Intel Tyax as found on my H4
    1.47 +	CFI_DEV_ANY        = (TUint16) -1,    // some manufacturers' flash chips comform to one standard CFI command set
    1.48 +	};
    1.49 +
    1.50 +typedef struct
    1.51 +	{
    1.52 +	TPtrC   name;
    1.53 +	TUint16	manufacturerId;
    1.54 +	TUint16 deviceId;
    1.55 +
    1.56 +	TInt (*reset)(TUint32 flashId, TUint32 address);
    1.57 +	TInt (*erase)(TUint32 flashId, TUint32 aBase,  TUint32 anAddr, TUint32 aSize);
    1.58 +	TInt (*write)(TUint32 flashId, TUint32 anAddr, TUint32 aSize,  const TUint32* aPS);
    1.59 +
    1.60 +	TUint   blockSize;  // the physical block size of the flash
    1.61 +	}
    1.62 +TFlashInfo;
    1.63 +
    1.64 +const TUint	FLASH_TYPE_UNKNOWN        = 0;
    1.65 +
    1.66 +///////////////////////////////////////////////////////////////////////////////
    1.67 +//
    1.68 +// CFI - generic command processing
    1.69 +//
    1.70 +///////////////////////////////////////////////////////////////////////////////
    1.71 +typedef struct
    1.72 +	{
    1.73 +	TUint32 location; // where to write this command to
    1.74 +	TUint32	offset;   // the offset for this command
    1.75 +	TUint32 command;  // the command itself
    1.76 +	}
    1.77 +TCfiCommands;
    1.78 +
    1.79 +enum
    1.80 +	{
    1.81 +	CFI_BASE8,   // use the base   address for this 8 bit command
    1.82 +	CFI_SECTOR8, // use the sector address for this 8 bit command
    1.83 +
    1.84 +	CFI_END = (TUint32) -1 // used to mark the end of the command sequence
    1.85 +	};
    1.86 +
    1.87 +
    1.88 +
    1.89 +const TUint32 KFlashEraseBlockSize = FLASHERASEBLOCKSIZE;
    1.90 +const TUint32 KFlashWriteBufSize   = FLASHWRITEBUFSIZE;
    1.91 +const TUint32 KRebootDelaySecs     = 5; // Delay(S) between flashing bootldr to reboot
    1.92 +
    1.93 +// Flash commands
    1.94 +//const TUint8	KCmdWordProgram        = 0x40 ;
    1.95 +const TUint8	KCmdBlockErase1        = 0x20 ;
    1.96 +const TUint8	KCmdBlockErase2        = 0xd0 ;
    1.97 +//const TUint8	KCmdEraseSuspend       = 0xb0 ;
    1.98 +//const TUint8	KCmdEraseResume        = 0xd0 ;
    1.99 +const TUint8	KCmdReadStatus         = 0x70 ; 
   1.100 +const TUint8	KCmdClearStatus        = 0x50 ;
   1.101 +const TUint8	KCmdReadArrayMode      = 0xFF ; 
   1.102 +const TUint8	KCmdClearBlockLockBit1 = 0x60 ;
   1.103 +const TUint8	KCmdClearBlockLockBit2 = 0xD0 ;
   1.104 +//const TUint8  KCmdSetBlockLockBit1   = 0x60 ;
   1.105 +//const TUint8	KCmdSetBlockLockBit2   = 0x01 ;
   1.106 +
   1.107 +// Flash status
   1.108 +const TUint8	KStatusBusy            = 0x80 ;
   1.109 +//const TUint8	KStatusProgramError    = 0x38 ;
   1.110 +//const TUint8	KStatusVoltageError    = 0x08 ;
   1.111 +const TUint8	KStatusCmdSeqError     = 0x30 ;
   1.112 +const TUint8	KStatusLockBitError    = 0x20 ;
   1.113 +
   1.114 +const TUint8    KCmdWriteStatusSibley  = 0xE9; // Sibley write
   1.115 +const TUint8    KCmdWriteStatus        = 0xE8; // send Tyax write
   1.116 +
   1.117 +GLREF_C TUint32 * GetFlashChunk(void);
   1.118 +GLREF_C TBool     BlankCheck   (TUint32 anAddr, TUint32 aSize);
   1.119 +GLREF_C TInt      Erase        (TUint32 anAddr, TUint32 aSize);
   1.120 +GLREF_C TInt      Write        (TUint32 anAddr, TUint32 aSize, const TUint32* aPS);
   1.121 +
   1.122 +#endif