Update contrib.
1 // Copyright (c) 1999-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.
16 #if !defined(__K32BM_H__)
20 #include <kernel/kernel.h>
21 #include <kernel/kern_priv.h>
26 * <code>MBMIsr</code> interface is typically implemented by the LDD that binds
27 * an ISR to the PDD interrupt source using <code>DBMPChannel::BindInterrupt(MBMIsr*)</code>.
33 * LDD-level Interrupt Service Routine interface.
34 * This function is called by the PDD in response to a <code>DBMPChannel::RequestInterrupt()</code> request..
36 * @param aNow the current time in ticks
38 virtual void Isr(TBMTicks aNow) = 0;
42 * <code>MBMInterruptLatencyIsr</code> interface is typically implemented by the LDD that binds
43 * an ISR to the PDD interrupt source using <code>DBMPChannel::BindInterrupt(MBMInterruptLatencyIsr*)</code>.
45 class MBMInterruptLatencyIsr
49 * LDD-level Interrupt Service Routine interface.
50 * This function is called by the PDD to deliver to LDD one interrupt latency measurement
51 * that was performed by PDD in response to a <code>DBMPChannel::RequestInterrupt()</code> request.
53 * @param aLatency the result in tick of one interrupt latency measurement.
55 virtual void InterruptLatencyIsr(TBMTicks aLatency) = 0;
61 * The caller must guarantee mutual excusion between the folloing calls:
62 * <code>BindInterrupt(MBMIsr* aIsr)</code>
63 * <code>BindInterrupt(MBMInterruptLatencyIsr* aIsr)</code>
64 * <code>RequestInterrupt()</code>
65 * <code>CancelInterrupt()</code>
67 class DBMPChannel : public DBase
71 * Gets the high-resolution timer period
73 * @return timer period in ticks
75 virtual TBMTicks TimerPeriod() = 0;
77 * Gets the current value of the high-resolution timer
79 * @return current time in ticks
81 virtual TBMTicks TimerStamp() = 0;
83 * Translates high-resolution timer ticks to nanoseconds
85 * @param aTicks time in ticks. The implementation must truncate <code>aTicks</code> value to
86 * <code>aTicks % TimerPeriod()</code> prior to translation.
88 * @return time in nano-seconds
90 virtual TBMNs TimerTicksToNs(TBMTicks aTicks) = 0;
92 * Translates nanoseconds to high-resolution timer ticks
94 * @param aNs time in nanoseconds
96 * @return time in ticks
98 virtual TBMTicks TimerNsToTicks(TBMNs aNs) = 0;
100 * Binds an LDD-level ISR to the PDD interrupt source.
102 * The <code>MBMIsr::Isr()</code> handler is called by the LDD's ISR
103 * in response to a <code>DBMChannel::RequestInterrupt()</code> request.
105 * @param aIsr points to the LDD ISR object.
107 * @return KErrNone - on success;otherwise - an error code .
109 virtual TInt BindInterrupt(MBMIsr* aIsr) = 0;
111 * Binds an LDD-level ISR to the PDD interrupt source.
113 * The <code>MBMInterruptLatencyIsr::Isr()</code> handler is called by the LDD's ISR
114 * in response to a <code>DBMChannel::RequestInterrupt()</code> request.
116 * @param aIsr points to the LDD ISR object.
118 * @return KErrNone - on success;otherwise - an error code .
120 virtual TInt BindInterrupt(MBMInterruptLatencyIsr* aIsr) = 0;
122 * Asynchronously requests an interrupt.
123 * The implmentation must provide
124 * When the interrupt will actually occur the PDD ISR will call the bound LDD-level
125 * <code>MBMIsr</code> or <code>MBMInterruptLatencyIsr</code> object. Note that only one
126 * LDD ISR object can be bound to the PDD interrupt source at any given moment of time.
128 virtual void RequestInterrupt() = 0;
130 * Cancels a possibly outstanding interrupt request.
131 * When returns the PDD interrupt has been either occured or canceled.
133 virtual void CancelInterrupt() = 0;
137 #define BM_ASSERT(aCond) \
138 __ASSERT_DEBUG( (aCond), (Kern::Printf("Assertion '" #aCond "' failed;\nFile: '" __FILE__ "' Line: %d\n", __LINE__), Kern::Fault("BM", 0)) )
142 KBMLDDHighPriority = 64 - 1, // KNumPriorities - 1,
143 KBMLDDMidPriority = KBMLDDHighPriority - 1,
144 KBMLDDLowPriority = KBMLDDMidPriority - 1,