sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\nkernsmp\nk_event.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef __NK_EVENT_H__ sl@0: #define __NK_EVENT_H__ sl@0: sl@0: #include sl@0: sl@0: class NSchedulable; sl@0: class TSpinLock; sl@0: class TDfcQue; sl@0: sl@0: /******************************************** sl@0: * Event handler sl@0: ********************************************/ sl@0: sl@0: /** sl@0: @internalComponent sl@0: sl@0: General event handler callback sl@0: */ sl@0: typedef void (*NEventFn)(TAny*); sl@0: sl@0: /** sl@0: @internalComponent sl@0: sl@0: General event handler structure sl@0: */ sl@0: struct NEventHandler : public SDblQueLink // link into active queue sl@0: { sl@0: inline NEventHandler() sl@0: : iHState(0), iTied(0), iPtr(0), iFn(0) sl@0: { sl@0: iTiedLink.iNext = 0; sl@0: } sl@0: sl@0: enum TEventHandlerType sl@0: { sl@0: EEventHandlerIrq=0xFCu, sl@0: EEventHandlerNTimer=0xFDu, sl@0: EEventHandlerIDFC=0xFEu, sl@0: EEventHandlerDummy=0xFFu, sl@0: }; sl@0: struct N8816 sl@0: { sl@0: TUint8 iHType; sl@0: TUint8 iHState8; sl@0: TUint16 iHState16; sl@0: }; sl@0: struct N8888 sl@0: { sl@0: TUint8 iHType; sl@0: TUint8 iHState0; sl@0: TUint8 iHState1; sl@0: TUint8 iHState2; sl@0: }; sl@0: union sl@0: { sl@0: volatile TUint32 iHState; // state information sl@0: volatile TUint8 iHType; // type of event handler sl@0: volatile N8816 i8816; sl@0: volatile N8888 i8888; sl@0: }; sl@0: union sl@0: { sl@0: NSchedulable* volatile iTied; // pointer to tied thread/group sl@0: TDfcQue* volatile iDfcQ; // doubles as pointer to DFC queue sl@0: }; // since DFCs can't be tied sl@0: TAny* volatile iPtr; // argument to callback sl@0: volatile NEventFn iFn; // callback function sl@0: SDblQueLink iTiedLink; // link to tied/group for cleanup purposes sl@0: sl@0: static TSpinLock TiedLock; // Protects iTied member of all NEventHandlers sl@0: }; sl@0: sl@0: #endif