os/kernelhwsrv/bsptemplate/asspandvariant/template_assp/template_assp.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/bsptemplate/asspandvariant/template_assp/template_assp.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,175 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// template\template_assp\template_assp.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +#include <template_assp_priv.h>
    1.23 +
    1.24 +//----------------------------------------------------------------------------
    1.25 +// Initialisation
    1.26 +
    1.27 +void TTemplate::Init3()
    1.28 +//
    1.29 +// Phase 3 initialisation
    1.30 +//
    1.31 +    {
    1.32 +	//
    1.33 +	// TO DO: (optional)
    1.34 +	//
    1.35 +	// Initialise any TTemplate class data members here
    1.36 +	//
    1.37 +
    1.38 +	// Use assp-specific nano wait implementation
    1.39 +	Kern::SetNanoWaitHandler(NanoWait);
    1.40 +	}
    1.41 +
    1.42 +EXPORT_C TMachineStartupType TTemplate::StartupReason()
    1.43 +//
    1.44 +// Read and return the Startup reason of the Hardware
    1.45 +//
    1.46 +	{
    1.47 +	//
    1.48 +	// TO DO: (optional)
    1.49 +	//
    1.50 +	// Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values
    1.51 +	// and return this
    1.52 +	//
    1.53 +	return EStartupCold;   // EXAMPLE ONLY
    1.54 +	}
    1.55 +
    1.56 +EXPORT_C TInt TTemplate::CpuVersionId()
    1.57 +//
    1.58 +// Read and return the the CPU ID
    1.59 +//
    1.60 +	{
    1.61 +	//
    1.62 +	// TO DO: (optional)
    1.63 +	//
    1.64 +	// Read the CPU identification register (if one exists) mask off redundant bits and return this
    1.65 +	//
    1.66 +	return 0;   // EXAMPLE ONLY
    1.67 +	}
    1.68 +
    1.69 +EXPORT_C TUint TTemplate::DebugPortAddr()
    1.70 +//
    1.71 +// Return Linear base address of debug UART (as selected in obey file or with eshell debugport command).
    1.72 +//	
    1.73 +	{
    1.74 +	//
    1.75 +	// TO DO: (optional)
    1.76 +	//
    1.77 +	// Read the iDebugPort field of the SuperPage, map the result to the corresponding Serial Port Linear
    1.78 +	// address and return this, like the following EXAMPLE ONLY:
    1.79 +	//
    1.80 +	TUint debugPort;
    1.81 +	switch (Kern::SuperPage().iDebugPort)
    1.82 +		{
    1.83 +		case 1:
    1.84 +			debugPort=KHwBaseSerial1;
    1.85 +			break;
    1.86 +		case 2:
    1.87 +			debugPort=KHwBaseSerial2;
    1.88 +			break;
    1.89 +		case 3:
    1.90 +			debugPort=KHwBaseSerial3;
    1.91 +			break;
    1.92 +		default:
    1.93 +			debugPort=KHwBaseSerial1;
    1.94 +			break;
    1.95 +		}
    1.96 +	return debugPort;
    1.97 +	}
    1.98 +
    1.99 +EXPORT_C TUint TTemplate::ProcessorPeriodInPs()
   1.100 +//
   1.101 +// Return CPU clock period in picoseconds
   1.102 +//
   1.103 +	{
   1.104 +	//
   1.105 +	// TO DO: (optional)
   1.106 +	//
   1.107 +	// Read the CPU clock speed and return its period in picoseconds. If only a limited range of speeds is possible
   1.108 +	// it is preferable to use the masked speed reading as an index into a look up table containing the corresponding
   1.109 +	// period
   1.110 +	//
   1.111 +	return 0;	// EXAMPLE ONLY
   1.112 +	}
   1.113 +
   1.114 +EXPORT_C void TTemplate::SetIntMask(TUint aValue)
   1.115 +//
   1.116 +// Set the Hardware Interrupt masks
   1.117 +//
   1.118 +	{
   1.119 +	// the following is EXAMPLE ONLY
   1.120 +	TInt irq=NKern::DisableAllInterrupts();
   1.121 +	AsspRegister::Write32(KHwInterruptsMaskSet,    aValue);
   1.122 +	AsspRegister::Write32(KHwInterruptsMaskClear, ~aValue);
   1.123 +	NKern::RestoreInterrupts(irq);
   1.124 +	}
   1.125 +
   1.126 +EXPORT_C void TTemplate::ModifyIntMask(TUint aClearMask,TUint aSetMask)
   1.127 +//
   1.128 +// Modify the Hardware Interrupt masks
   1.129 +//
   1.130 +	{
   1.131 +	// the following is EXAMPLE ONLY
   1.132 +	TInt irq=NKern::DisableAllInterrupts();
   1.133 +	AsspRegister::Write32(KHwInterruptsMaskSet,    aSetMask);
   1.134 +	AsspRegister::Write32(KHwInterruptsMaskClear, ~aClearMask);
   1.135 +	NKern::RestoreInterrupts(irq);
   1.136 +	}
   1.137 +
   1.138 +EXPORT_C TUint TTemplate::IntsPending()
   1.139 +//
   1.140 +// Return the state of pending interrupts
   1.141 +//
   1.142 +	{
   1.143 +	// the following is EXAMPLE ONLY
   1.144 +	return(AsspRegister::Read32(KHwInterruptsIrqPending));
   1.145 +	}
   1.146 +
   1.147 +EXPORT_C TUint TTemplate::RtcData()
   1.148 +//
   1.149 +// Return the current time of the RTC
   1.150 +//
   1.151 +	{
   1.152 +	//
   1.153 +	// TO DO: (optional)
   1.154 +	//
   1.155 +	// Read the RTC current time register and return this time
   1.156 +	//
   1.157 +	return 0;	// EXAMPLE ONLY
   1.158 +	}
   1.159 +
   1.160 +EXPORT_C void TTemplate::SetRtcData(TUint aValue)
   1.161 +//
   1.162 +// Set the RTC time
   1.163 +//
   1.164 +	{
   1.165 +	//
   1.166 +	// TO DO: (optional)
   1.167 +	//
   1.168 +	// Set the RTC current time with aValue (may need formatting appropriately)
   1.169 +	//
   1.170 +	}
   1.171 +
   1.172 +EXPORT_C TPhysAddr TTemplate::VideoRamPhys()
   1.173 +//
   1.174 +// Return the physical address of the video RAM
   1.175 +//
   1.176 +	{
   1.177 +	return TemplateAssp::VideoRamPhys;
   1.178 +	}