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.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\include\nkernsmp\nk_event.h
sl@0
    15
// 
sl@0
    16
// WARNING: This file contains some APIs which are internal and are subject
sl@0
    17
//          to change without notice. Such APIs should therefore not be used
sl@0
    18
//          outside the Kernel and Hardware Services package.
sl@0
    19
//
sl@0
    20
sl@0
    21
#ifndef __NK_EVENT_H__
sl@0
    22
#define __NK_EVENT_H__
sl@0
    23
sl@0
    24
#include <nklib.h>
sl@0
    25
sl@0
    26
class NSchedulable;
sl@0
    27
class TSpinLock;
sl@0
    28
class TDfcQue;
sl@0
    29
sl@0
    30
/********************************************
sl@0
    31
 * Event handler
sl@0
    32
 ********************************************/
sl@0
    33
sl@0
    34
/**
sl@0
    35
@internalComponent
sl@0
    36
sl@0
    37
General event handler callback
sl@0
    38
*/
sl@0
    39
typedef void (*NEventFn)(TAny*);
sl@0
    40
sl@0
    41
/**
sl@0
    42
@internalComponent
sl@0
    43
sl@0
    44
General event handler structure
sl@0
    45
*/
sl@0
    46
struct NEventHandler : public SDblQueLink		// link into active queue
sl@0
    47
	{
sl@0
    48
	inline NEventHandler()
sl@0
    49
		:	iHState(0), iTied(0), iPtr(0), iFn(0)
sl@0
    50
		{
sl@0
    51
		iTiedLink.iNext = 0;
sl@0
    52
		}
sl@0
    53
sl@0
    54
	enum TEventHandlerType
sl@0
    55
		{
sl@0
    56
		EEventHandlerIrq=0xFCu,
sl@0
    57
		EEventHandlerNTimer=0xFDu,
sl@0
    58
		EEventHandlerIDFC=0xFEu,
sl@0
    59
		EEventHandlerDummy=0xFFu,
sl@0
    60
		};
sl@0
    61
	struct N8816
sl@0
    62
		{
sl@0
    63
		TUint8	iHType;
sl@0
    64
		TUint8	iHState8;
sl@0
    65
		TUint16	iHState16;
sl@0
    66
		};
sl@0
    67
	struct N8888
sl@0
    68
		{
sl@0
    69
		TUint8	iHType;
sl@0
    70
		TUint8	iHState0;
sl@0
    71
		TUint8	iHState1;
sl@0
    72
		TUint8	iHState2;
sl@0
    73
		};
sl@0
    74
	union
sl@0
    75
		{
sl@0
    76
		volatile TUint32		iHState;		// state information
sl@0
    77
		volatile TUint8			iHType;			// type of event handler
sl@0
    78
		volatile N8816			i8816;
sl@0
    79
		volatile N8888			i8888;
sl@0
    80
		};
sl@0
    81
	union
sl@0
    82
		{
sl@0
    83
		NSchedulable* volatile	iTied;			// pointer to tied thread/group
sl@0
    84
		TDfcQue* volatile		iDfcQ;			// doubles as pointer to DFC queue
sl@0
    85
		};										// since DFCs can't be tied
sl@0
    86
	TAny* volatile				iPtr;			// argument to callback
sl@0
    87
	volatile NEventFn			iFn;			// callback function
sl@0
    88
	SDblQueLink					iTiedLink;		// link to tied/group for cleanup purposes
sl@0
    89
sl@0
    90
	static TSpinLock			TiedLock;		// Protects iTied member of all NEventHandlers
sl@0
    91
	};
sl@0
    92
sl@0
    93
#endif