1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/nkernsmp/nk_event.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +// Copyright (c) 2007-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\nkernsmp\nk_event.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 __NK_EVENT_H__
1.25 +#define __NK_EVENT_H__
1.26 +
1.27 +#include <nklib.h>
1.28 +
1.29 +class NSchedulable;
1.30 +class TSpinLock;
1.31 +class TDfcQue;
1.32 +
1.33 +/********************************************
1.34 + * Event handler
1.35 + ********************************************/
1.36 +
1.37 +/**
1.38 +@internalComponent
1.39 +
1.40 +General event handler callback
1.41 +*/
1.42 +typedef void (*NEventFn)(TAny*);
1.43 +
1.44 +/**
1.45 +@internalComponent
1.46 +
1.47 +General event handler structure
1.48 +*/
1.49 +struct NEventHandler : public SDblQueLink // link into active queue
1.50 + {
1.51 + inline NEventHandler()
1.52 + : iHState(0), iTied(0), iPtr(0), iFn(0)
1.53 + {
1.54 + iTiedLink.iNext = 0;
1.55 + }
1.56 +
1.57 + enum TEventHandlerType
1.58 + {
1.59 + EEventHandlerIrq=0xFCu,
1.60 + EEventHandlerNTimer=0xFDu,
1.61 + EEventHandlerIDFC=0xFEu,
1.62 + EEventHandlerDummy=0xFFu,
1.63 + };
1.64 + struct N8816
1.65 + {
1.66 + TUint8 iHType;
1.67 + TUint8 iHState8;
1.68 + TUint16 iHState16;
1.69 + };
1.70 + struct N8888
1.71 + {
1.72 + TUint8 iHType;
1.73 + TUint8 iHState0;
1.74 + TUint8 iHState1;
1.75 + TUint8 iHState2;
1.76 + };
1.77 + union
1.78 + {
1.79 + volatile TUint32 iHState; // state information
1.80 + volatile TUint8 iHType; // type of event handler
1.81 + volatile N8816 i8816;
1.82 + volatile N8888 i8888;
1.83 + };
1.84 + union
1.85 + {
1.86 + NSchedulable* volatile iTied; // pointer to tied thread/group
1.87 + TDfcQue* volatile iDfcQ; // doubles as pointer to DFC queue
1.88 + }; // since DFCs can't be tied
1.89 + TAny* volatile iPtr; // argument to callback
1.90 + volatile NEventFn iFn; // callback function
1.91 + SDblQueLink iTiedLink; // link to tied/group for cleanup purposes
1.92 +
1.93 + static TSpinLock TiedLock; // Protects iTied member of all NEventHandlers
1.94 + };
1.95 +
1.96 +#endif