First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
24 #ifndef __CRYPTOH4RNG__
25 #define __CRYPTOH4RNG__
26 #include "cryptojobs.h"
30 class CryptoH4JobRandom : public CryptoJobRandom
33 CryptoH4JobRandom(DLddChanRandom &aLddChanRandom);
34 virtual ~CryptoH4JobRandom();
36 virtual void SetDfcQ(TDfcQue *aDfcQue);
38 virtual void SetDetails(DCryptoJobScheduler *aJobScheduler, MCryptoJobCallbacks *aCallbacks,
41 virtual void GetToPddBuffer(TUint8 * &aBuf, TUint32 &aBufLen, TBool &aMore);
42 virtual void BytesWrittenToPdd(TUint32 aBytes);
44 virtual void GetFromPddBuffer(TUint8 * &aBuf, TUint32 &aBufLen, TBool &aMore);
45 virtual void BytesReadFromPdd(TUint32 aBytes);
49 // Implementations of virtual base class methods to support DCryptoJobScheduler
50 virtual void DoSlice(TBool aFirstSlice);
51 virtual TBool DoSaveState();
52 virtual void DoRestoreState();
53 virtual void DoReleaseHw();
55 TInt BytesAvailable() const;
56 void RegionsAvailable(TUint8 * &aPtr1, TInt &aLen1,
57 TUint8 * &aPtr2, TInt &aLen2) const;
59 DLddChanRandom &iLddChanRandom;
62 TUint32 iRandomBuffer[64]; // Temporary buffer for PDD to write into
64 TInt iSwReadByteOffset;
67 // Hook/enable unhook/disable ISR in top level OMAP h/w
68 // Done at job scheduling level
73 // Enable/disable RNG ISR in Mask register
74 // Done for each byte of data.
75 inline void EnableIsr();
76 inline void DisableIsr();
78 static void Isr(TAny *aPtr);
80 static void RandomDfc(TAny* aPtr);