Update contrib.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // \e32test\nkernsa\interrupts.h
23 #ifndef __INTERRUPTS_H__
24 #define __INTERRUPTS_H__
28 #define IMPORT_C /* */
30 /*************************************************
32 *************************************************/
33 typedef void (*TIsr)(TAny*);
39 A class that exports interrupt functionality to device drivers and
40 other kernel-side code.
42 Although Symbian OS defines this class, it does not implement it;
43 an implementation for each of the functions defined by this class must
44 be provided by the Variant in the baseport.
46 Note that the class only provides the public API for using interrupts,
47 not for dispatching them.
55 Associates the specified interrupt service routine (ISR) function with
56 the specified interrupt Id.
58 This is also known as binding the interrupt.
60 When the ISR is called, the value aPtr is passed as the argument.
61 ISR may either be a bare function or a static class member, taking TAny* parameter:
63 void Isr(TAny* aParam)
66 Note that you must call Interrupt::Enable() before you can start
69 @param anId The interrupt Id.
70 @param anIsr The address of the ISR function.
71 @param aPtr 32-bit value that is passed to the ISR.
72 This is designated a TAny* type as it is usually a pointer to
73 the owning class or data to be used in the ISR, although
74 it can be any 32-bit value.
76 @return KErrNone, if successful; KErrArgument, if anId is invalid;
77 KErrInUse, if the ISR is already bound to this interrupt.
79 IMPORT_C static TInt Bind(TInt anId, TIsr anIsr, TAny* aPtr);
83 Unbinds the interrupt service routine (ISR) function from
84 the specified interrupt id.
86 @param anId The interrupt Id.
88 @return KErrNone, if successful; KErrArgument, if anId is invalid;
89 KErrGeneral, if there is no ISR bound to this interrupt.
91 IMPORT_C static TInt Unbind(TInt anId);
95 Enables the specified interrupt.
97 After enabling the interrupt, the ISR will run if the interrupt signals.
99 @param anId The interrupt Id.
101 @return KErrNone, if successful; KErrArgument, if anId is invalid;
102 KErrGeneral, if there is no ISR bound to this interrupt.
104 IMPORT_C static TInt Enable(TInt anId);
108 Disables the specified interrupt.
110 After calling this function, the interrupt source cannot generate
111 an interrupt to the CPU.
113 @param anId The interrupt Id.
115 @return KErrNone, if successful; KErrArgument, if anId is invalid;
116 KErrGeneral, if there is no ISR bound to this interrupt.
118 IMPORT_C static TInt Disable(TInt anId);
122 Clears any pending signal on the specified interrupt.
124 @param anId The interrupt Id.
126 @return KErrNone, if successful; KErrArgument, if anId is invalid;
127 KErrGeneral, if there is no ISR bound to this interrupt.
129 IMPORT_C static TInt Clear(TInt anId);
133 Changes the priority of the specified interrupt to the new specified value.
135 The meaning of the priority value is determined by the baseport.
136 The function returns KErrNotSupported if the hardware or the baseport
137 does not support configurable interrupt priorities.
139 @param anId The interrupt Id.
140 @param aPriority The new priority value.
142 @return KErrNone, if successful; KErrArgument, if anId is invalid;
143 KErrNotSuppported, if configurable interrupt priorities
146 IMPORT_C static TInt SetPriority(TInt anId, TInt aPriority);
149 struct SInterruptHandler