os/kernelhwsrv/kernel/eka/include/nkernsmp/nk_event.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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\include\nkernsmp\nk_event.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 __NK_EVENT_H__
    22 #define __NK_EVENT_H__
    23 
    24 #include <nklib.h>
    25 
    26 class NSchedulable;
    27 class TSpinLock;
    28 class TDfcQue;
    29 
    30 /********************************************
    31  * Event handler
    32  ********************************************/
    33 
    34 /**
    35 @internalComponent
    36 
    37 General event handler callback
    38 */
    39 typedef void (*NEventFn)(TAny*);
    40 
    41 /**
    42 @internalComponent
    43 
    44 General event handler structure
    45 */
    46 struct NEventHandler : public SDblQueLink		// link into active queue
    47 	{
    48 	inline NEventHandler()
    49 		:	iHState(0), iTied(0), iPtr(0), iFn(0)
    50 		{
    51 		iTiedLink.iNext = 0;
    52 		}
    53 
    54 	enum TEventHandlerType
    55 		{
    56 		EEventHandlerIrq=0xFCu,
    57 		EEventHandlerNTimer=0xFDu,
    58 		EEventHandlerIDFC=0xFEu,
    59 		EEventHandlerDummy=0xFFu,
    60 		};
    61 	struct N8816
    62 		{
    63 		TUint8	iHType;
    64 		TUint8	iHState8;
    65 		TUint16	iHState16;
    66 		};
    67 	struct N8888
    68 		{
    69 		TUint8	iHType;
    70 		TUint8	iHState0;
    71 		TUint8	iHState1;
    72 		TUint8	iHState2;
    73 		};
    74 	union
    75 		{
    76 		volatile TUint32		iHState;		// state information
    77 		volatile TUint8			iHType;			// type of event handler
    78 		volatile N8816			i8816;
    79 		volatile N8888			i8888;
    80 		};
    81 	union
    82 		{
    83 		NSchedulable* volatile	iTied;			// pointer to tied thread/group
    84 		TDfcQue* volatile		iDfcQ;			// doubles as pointer to DFC queue
    85 		};										// since DFCs can't be tied
    86 	TAny* volatile				iPtr;			// argument to callback
    87 	volatile NEventFn			iFn;			// callback function
    88 	SDblQueLink					iTiedLink;		// link to tied/group for cleanup purposes
    89 
    90 	static TSpinLock			TiedLock;		// Protects iTied member of all NEventHandlers
    91 	};
    92 
    93 #endif