Update contrib.
1 // Copyright (c) 2006-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\init.cpp
18 #include <nktest/nkutils.h>
21 TLinAddr RomHeaderAddress;
22 TLinAddr SuperPageAddress;
23 TBool InitialThreadDefined;
26 NThread* InitialThread;
32 const char* NullNames[KMaxCpus] =
45 extern "C" void StartSystemTimer();
46 extern "C" void Hw_Init1();
47 extern "C" void Hw_InitAPs();
48 extern "C" void Hw_Init3();
49 extern "C" TLinAddr __initial_stack_base();
50 extern "C" TInt __initial_stack_size();
52 extern void Main(TAny*);
54 extern "C" void KernelMain()
56 KPrintf("KernelMain()");
60 NTimerQ::Init1(__timer_period());
61 SetupMemoryAllocator();
63 InitialThread = new NThread;
64 __KTRACE_OPT(KTHREAD,DEBUGPRINT("Initial thread at %08x", InitialThread));
65 SNThreadCreateInfo info;
68 info.iStackBase = (TAny*)__initial_stack_base();
69 info.iStackSize = __initial_stack_size();
74 info.iFastExecTable = 0;
75 info.iSlowExecTable = 0;
76 info.iParameterBlock = 0;
77 info.iParameterBlockSize = 0;
79 info.iCpuAffinity = 0;
83 NKern::Init(InitialThread, info);
85 InitialThread->iNThreadBaseSpare8 = (TUint32)NullNames[NKern::CurrentCpu()];
87 InitialThread->iSpare8 = (TUint32)"Null";
89 InitialThreadDefined = ETrue;
91 KPrintf("NKern::CurrentThread() = %08x", NKern::CurrentThread());
92 KPrintf("TR=%x",__cpu_id());
98 CleanupDfcQ = CreateDfcQ("Cleanup", 17, KCpuAffinityAny);
99 TimerDfcQ = CreateDfcQ("Timer", 48);
100 NTimerQ::Init3(TimerDfcQ);
105 MainThread = CreateThread("Main", &Main, 16, 0, 0, ETrue, KTimeslice);
107 KPrintf("spinning ...");
115 extern "C" void ApMainGeneric(volatile SAPBootInfo* aInfo)
117 NThread* t = (NThread*)aInfo->iArgs[0];
118 __KTRACE_OPT(KTHREAD,DEBUGPRINT("Initial thread at %08x", t));
119 SNThreadCreateInfo info;
122 info.iStackBase = (TAny*)aInfo->iInitStackBase;
123 info.iStackSize = aInfo->iInitStackSize;
125 info.iTimeslice = -1;
126 info.iAttributes = 0;
128 info.iFastExecTable = 0;
129 info.iSlowExecTable = 0;
130 info.iParameterBlock = (const TUint32*)aInfo;
131 info.iParameterBlockSize = 0;
132 info.iCpuAffinity = 0; // nanokernel substitutes with correct CPU number
135 NKern::Init(t, info);
136 t->iNThreadBaseSpare8 = (TUint32)NullNames[NKern::CurrentCpu()];
138 KPrintf("NKern::CurrentThread() = %08x\n", NKern::CurrentThread());
140 __e32_atomic_store_ord32(&aInfo->iArgs[1], 1);
142 __KTRACE_OPT(KBOOT,DEBUGPRINT("AP status=%08x", __cpu_status_reg()));
143 KPrintf("AP TR=%x",__cpu_id());
152 TBool BTrace::IsSupported(TUint aCategory)