Update contrib.
1 // Copyright (c) 2003-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\personality\example\isr.cpp
15 // Test code for example RTOS personality.
19 #include "plat_priv.h"
20 #include <personality/example/personality.h>
23 #include <windermere.h>
24 #elif defined(__MISA__)
25 #define __ISR_SUPPORTED__
27 #elif defined(__MCOT__)
28 #define __ISR_SUPPORTED__
30 #elif defined(__MI920__) || defined(__NI1136__)
31 #include <integratorap.h>
32 #elif defined(__EPOC32__) && defined(__CPU_X86)
36 #ifdef __ISR_SUPPORTED__
37 #include "../../misc/prbs.h"
40 extern "C" void stop_random_isr(void);
42 typedef void (*isr_entry)(unsigned);
44 volatile TUint RandomSeed[2] = {0xb504f333u, 0xf9de6484u};
45 volatile isr_entry IsrVector = 0;
46 volatile TUint IsrCount = 0;
51 TUint interval = Random((TUint*)RandomSeed);
53 interval += 256; // 256-1279 ticks = approx 69 to 347 microseconds
54 TUint oscr=TSa1100::OstData();
55 TSa1100::SetOstMatch(KHwOstMatchGeneral, oscr + interval);
56 TSa1100::SetOstMatchEOI(KHwOstMatchGeneral);
57 #elif defined(__MCOT__)
58 TUint interval = Random((TUint*)RandomSeed);
60 interval += 256; // 256-1279 ticks = approx 69 to 347 microseconds
61 TUint oscr=TCotulla::OstData();
62 TCotulla::SetOstMatch(KHwOstMatchGeneral, oscr + interval);
63 TCotulla::SetOstMatchEOI(KHwOstMatchGeneral);
65 (*IsrVector)(IsrCount++);
68 #ifdef __ISR_SUPPORTED__
69 void start_timer(void)
72 // for SA11x0 use OST match 0
73 TInt r=Interrupt::Bind(KIntIdOstMatchGeneral, &timer_isr, 0);
75 TSa1100::ModifyIntLevels(0,KHtIntsOstMatchGeneral); // route new timer interrupt to FIQ
76 TSa1100::SetOstMatchEOI(KHwOstMatchGeneral);
77 TUint oscr=TSa1100::OstData();
78 TSa1100::SetOstMatch(KHwOstMatchGeneral, oscr + 5000);
79 TSa1100::EnableOstInterrupt(KHwOstMatchGeneral);
80 Interrupt::Enable(KIntIdOstMatchGeneral);
81 #elif defined(__MCOT__)
82 // for SA11x0 use OST match 0
83 TInt r=Interrupt::Bind(KIntIdOstMatchGeneral, &timer_isr, 0);
85 TCotulla::ModifyIntLevels(0,KHtIntsOstMatchGeneral); // route new timer interrupt to FIQ
86 TCotulla::SetOstMatchEOI(KHwOstMatchGeneral);
87 TUint oscr=TCotulla::OstData();
88 TCotulla::SetOstMatch(KHwOstMatchGeneral, oscr + 5000);
89 TCotulla::EnableOstInterrupt(KHwOstMatchGeneral);
90 Interrupt::Enable(KIntIdOstMatchGeneral);
95 extern "C" int start_random_isr(isr_entry vector)
99 #ifdef __ISR_SUPPORTED__
103 return KErrNotSupported;
107 extern "C" void stop_random_isr(void)
109 #if defined(__MISA__)
110 Interrupt::Disable(KIntIdOstMatchGeneral);
111 Interrupt::Unbind(KIntIdOstMatchGeneral);
112 #elif defined(__MCOT__)
113 Interrupt::Disable(KIntIdOstMatchGeneral);
114 Interrupt::Unbind(KIntIdOstMatchGeneral);