os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4/cryptoh4rng.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4/cryptoh4rng.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,84 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @internalComponent
    1.25 + @released
    1.26 +*/
    1.27 +#ifndef __CRYPTOH4RNG__
    1.28 +#define __CRYPTOH4RNG__
    1.29 +#include "cryptojobs.h"
    1.30 +
    1.31 +class DCryptoH4Chan;
    1.32 +class DLddChanRandom;
    1.33 +class CryptoH4JobRandom : public CryptoJobRandom
    1.34 +	{
    1.35 +public:
    1.36 +	CryptoH4JobRandom(DLddChanRandom &aLddChanRandom);
    1.37 +	virtual ~CryptoH4JobRandom();
    1.38 +
    1.39 +	virtual void SetDfcQ(TDfcQue *aDfcQue);
    1.40 +
    1.41 +	virtual void SetDetails(DCryptoJobScheduler *aJobScheduler, MCryptoJobCallbacks *aCallbacks,
    1.42 +							TUint32 aNumOfBytes);
    1.43 +
    1.44 +	virtual void GetToPddBuffer(TUint8 * &aBuf, TUint32 &aBufLen, TBool &aMore);
    1.45 +	virtual void BytesWrittenToPdd(TUint32 aBytes);
    1.46 +
    1.47 +	virtual void GetFromPddBuffer(TUint8 * &aBuf, TUint32 &aBufLen, TBool &aMore);
    1.48 +	virtual void BytesReadFromPdd(TUint32 aBytes);
    1.49 +
    1.50 +
    1.51 +private:	
    1.52 +	// Implementations of virtual base class methods to support DCryptoJobScheduler
    1.53 +	virtual void DoSlice(TBool aFirstSlice);
    1.54 +	virtual TBool DoSaveState();
    1.55 +	virtual void DoRestoreState();
    1.56 +	virtual void DoReleaseHw();
    1.57 +	
    1.58 +	TInt BytesAvailable() const;
    1.59 +	void RegionsAvailable(TUint8 * &aPtr1, TInt &aLen1, 
    1.60 +						  TUint8 * &aPtr2, TInt &aLen2) const;
    1.61 +
    1.62 +	DLddChanRandom &iLddChanRandom;
    1.63 +	
    1.64 +	// Details of job
    1.65 +	TUint32 iRandomBuffer[64]; // Temporary buffer for PDD to write into
    1.66 +	TInt iJobSizeInBytes;
    1.67 +	TInt iSwReadByteOffset;
    1.68 +	TInt iHw32Index;
    1.69 +
    1.70 +	// Hook/enable unhook/disable ISR in top level OMAP h/w
    1.71 +	// Done at job scheduling level
    1.72 +	TBool iIsrHooked;
    1.73 +	void HookIsr();
    1.74 +	void UnHookIsr();
    1.75 +
    1.76 +	// Enable/disable RNG ISR in Mask register
    1.77 +	// Done for each byte of data.
    1.78 +	inline void EnableIsr();
    1.79 +	inline void DisableIsr();
    1.80 +	
    1.81 +	static void Isr(TAny *aPtr);
    1.82 +
    1.83 +    static void RandomDfc(TAny* aPtr);
    1.84 +	void DoRandomDfc();
    1.85 +    TDfc iRandomDfc;	
    1.86 +	};
    1.87 +#endif