os/kernelhwsrv/kernel/eka/include/drivers/crashflashnor.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32\drivers\crashflash\crashflashnor.h
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 #ifndef __CRASH_FLASH_NOR_H__
    22 #define __CRASH_FLASH_NOR_H__
    23 
    24 #ifndef EPOC32
    25 
    26 #include <crashflash.h>
    27 #include <kernel/kernel.h>
    28 
    29 /* @file
    30 @internalTechnology
    31 */
    32 
    33 /* The generic crash flash nor support allows for a 32, 16, or 8 bit interface
    34  * to the nor flash chip.  One of the following should be defined in the
    35  * variant's mmp file.
    36  */
    37 #ifdef TCFI_4BYTE_WORD
    38 typedef TUint32 TCFIWord;
    39 #elif defined(TCFI_2BYTE_WORD)
    40 typedef TUint16 TCFIWord;
    41 #elif defined(TCFI_1BYTE_WORD)
    42 typedef TUint8 TCFIWord;
    43 #else
    44 #error One of TCFI_4BYTE_WORD, TCFI_2BYTE_WORD, or TCFI_1BYTE_WORD must be defined.
    45 #endif
    46 
    47 /** 
    48 An implmentation of the CrashFlash interface for nor flash.
    49 @internalTechnology
    50 */
    51 class CrashFlashNor : public CrashFlash
    52 	{
    53 public:
    54 	TInt Initialise();
    55 	void StartTransaction();
    56 	void EndTransaction();
    57 	void Write(const TDesC8& aDes);
    58 	void WriteSignature(const TDesC8& aDes);
    59 	void Read(TDes8& aDes);
    60 	void SetReadPos(TUint aPos);
    61 	void SetWritePos(const TUint aPos);
    62 	void EraseLogArea();
    63 	TUint BytesWritten();
    64 	void EraseFlashBlock(TUint aBlock);
    65 #ifdef _CRASHLOG_COMPR	
    66 	TUint GetOutputLimit();
    67 	TUint GetLogOffset();
    68 #endif
    69 protected:
    70 	/** @publishedPartner
    71 	@released */
    72 	virtual TInt VariantInitialise()=0;
    73 	/** @publishedPartner
    74 	@released */
    75 	virtual void DoWrite(TCFIWord aWord)=0;
    76 	/** @publishedPartner
    77 	@released */
    78 	virtual TCFIWord DoRead()=0;
    79 	/** @publishedPartner
    80 	@released */
    81 	virtual void DoEraseBlock(TUint aBlock)=0;
    82 private:
    83 	TCFIWord iWriteBuf;
    84 	TCFIWord iReadBuf;
    85 	TUint iWriteBufBytes;
    86 	TUint iReadBufBytes;
    87 protected:
    88 	/** @publishedPartner
    89 	@released */
    90 	TUint iEraseBlockSize;
    91 	/** @publishedPartner
    92 	@released */
    93 	TUint iWritePos;
    94 	/** @publishedPartner
    95 	@released */
    96 	TUint iReadPos;
    97 private:
    98 	TUint iWriteTotal;
    99 	};
   100 
   101 #endif
   102 
   103 #endif