os/kernelhwsrv/kernel/eka/include/drivers/crashflashnand.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/crashflashnand.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,120 @@
     1.4 +// Copyright (c) 2004-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 +// e32\include\drivers\crashflashnand.h
    1.18 +// 
    1.19 +// WARNING: This file contains some APIs which are internal and are subject
    1.20 +//          to change without notice. Such APIs should therefore not be used
    1.21 +//          outside the Kernel and Hardware Services package.
    1.22 +//
    1.23 +
    1.24 +#ifndef __CRASHFLASHNAND_H__
    1.25 +#define __CRASHFLASHNAND_H__
    1.26 +#include <crashflash.h>
    1.27 +
    1.28 +class TPib;
    1.29 +class TPibExtension;
    1.30 +
    1.31 +/**
    1.32 +The maximum number of bytes in a nand flash main array
    1.33 +@internalTechnology
    1.34 +*/
    1.35 +const TUint KCFNandMaxBytesMain = 512;
    1.36 +
    1.37 +/**
    1.38 +An implementation of the CrashFlash interface for nand flash.
    1.39 +@internalTechnology
    1.40 +*/
    1.41 +class CrashFlashNand : public CrashFlash
    1.42 +	{
    1.43 +public:
    1.44 +	//From CrashFlash
    1.45 +	virtual TInt Initialise();
    1.46 +	virtual void StartTransaction();
    1.47 +	virtual void EndTransaction();
    1.48 +	virtual void Write(const TDesC8& aDes);
    1.49 +	virtual void WriteSignature(const TDesC8& aDes);
    1.50 +	virtual void Read(TDes8& aDes);
    1.51 +	virtual void SetReadPos(TUint aPos);
    1.52 +	virtual void SetWritePos(const TUint aPos);
    1.53 +	virtual void EraseLogArea();
    1.54 +	virtual void EraseFlashBlock(const TUint aBlock);
    1.55 +	virtual TUint BytesWritten();
    1.56 +#ifdef _CRASHLOG_COMPR	
    1.57 +	virtual TUint GetOutputLimit(void);
    1.58 +	virtual TUint GetLogOffset(void);
    1.59 +#endif
    1.60 +
    1.61 +public:
    1.62 +	/** @publishedPartner
    1.63 +	@released */
    1.64 +	virtual TInt GetDeviceId(TUint8& aDeviceId, TUint8& aManufacturerId)=0;
    1.65 +	/** @publishedPartner
    1.66 +	@released */
    1.67 +	virtual TInt DeviceRead(const TUint aPageAddress, TAny* aBuf, const TUint aLength)=0;
    1.68 +	/** @publishedPartner
    1.69 +	@released */
    1.70 +	virtual TInt DeviceWrite(const TUint aPageAddress, TAny* aBuf, const TUint aLength)=0;
    1.71 +	/** @publishedPartner
    1.72 +	@released */
    1.73 +	virtual TInt DeviceErase(const TUint aBlockAddress)=0;
    1.74 +public:
    1.75 +	/** @publishedPartner
    1.76 +	@released */
    1.77 +	TUint iNumPagesPerBlock;
    1.78 +	/** @publishedPartner
    1.79 +	@released */
    1.80 +	TUint iNumBytesMain;
    1.81 +	/** @publishedPartner
    1.82 +	@released */
    1.83 +	TUint iNumBytesSpare;
    1.84 +	/** @publishedPartner
    1.85 +	@released */
    1.86 +	TUint iNumReservoirBlocks;
    1.87 +	/** @publishedPartner
    1.88 +	@released */
    1.89 +	TUint iNumBlocks;
    1.90 +	/** @publishedPartner
    1.91 +	@released */
    1.92 +	TUint iNumBytesPage;
    1.93 +
    1.94 +protected:
    1.95 +	/** @publishedPartner
    1.96 +	@released */
    1.97 +	virtual TInt VariantInitialise()=0;
    1.98 +
    1.99 +private:
   1.100 +	TInt InitialiseFlashParameters(const TUint8 aDevId, const TUint8 aManId);
   1.101 +	TInt ReadPib(TPib& aPib, TPibExtension& aPibExtension, TUint& aLastGoodBlock);
   1.102 +	TInt ParsePib(TPib& aPib, TPibExtension& aPibExt);
   1.103 +	void DoWriteRead();	
   1.104 +	void DoWrite();
   1.105 +	void DoRead();
   1.106 +private:
   1.107 +	TBool iIs16Bit;
   1.108 +	TUint8 iLogWordSize;
   1.109 +
   1.110 +	TUint iCrashLogStartBlock;
   1.111 +	TUint iNumCrashLogBlocks;
   1.112 +
   1.113 +	TUint iWriteBufIndex;
   1.114 +	TUint iReadBufIndex;
   1.115 +	TUint iWritePageIndex;
   1.116 +	TUint iReadPageIndex;
   1.117 +	TUint iWriteTotal;
   1.118 +
   1.119 +	TUint8 iWriteBuf[KCFNandMaxBytesMain];
   1.120 +	TUint8 iReadBuf[KCFNandMaxBytesMain];
   1.121 +	};
   1.122 +
   1.123 +#endif