os/kernelhwsrv/bsptemplate/asspandvariant/template_assp/template_assp.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// template\template_assp\template_assp.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
sl@0
    19
#include <template_assp_priv.h>
sl@0
    20
sl@0
    21
//----------------------------------------------------------------------------
sl@0
    22
// Initialisation
sl@0
    23
sl@0
    24
void TTemplate::Init3()
sl@0
    25
//
sl@0
    26
// Phase 3 initialisation
sl@0
    27
//
sl@0
    28
    {
sl@0
    29
	//
sl@0
    30
	// TO DO: (optional)
sl@0
    31
	//
sl@0
    32
	// Initialise any TTemplate class data members here
sl@0
    33
	//
sl@0
    34
sl@0
    35
	// Use assp-specific nano wait implementation
sl@0
    36
	Kern::SetNanoWaitHandler(NanoWait);
sl@0
    37
	}
sl@0
    38
sl@0
    39
EXPORT_C TMachineStartupType TTemplate::StartupReason()
sl@0
    40
//
sl@0
    41
// Read and return the Startup reason of the Hardware
sl@0
    42
//
sl@0
    43
	{
sl@0
    44
	//
sl@0
    45
	// TO DO: (optional)
sl@0
    46
	//
sl@0
    47
	// Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values
sl@0
    48
	// and return this
sl@0
    49
	//
sl@0
    50
	return EStartupCold;   // EXAMPLE ONLY
sl@0
    51
	}
sl@0
    52
sl@0
    53
EXPORT_C TInt TTemplate::CpuVersionId()
sl@0
    54
//
sl@0
    55
// Read and return the the CPU ID
sl@0
    56
//
sl@0
    57
	{
sl@0
    58
	//
sl@0
    59
	// TO DO: (optional)
sl@0
    60
	//
sl@0
    61
	// Read the CPU identification register (if one exists) mask off redundant bits and return this
sl@0
    62
	//
sl@0
    63
	return 0;   // EXAMPLE ONLY
sl@0
    64
	}
sl@0
    65
sl@0
    66
EXPORT_C TUint TTemplate::DebugPortAddr()
sl@0
    67
//
sl@0
    68
// Return Linear base address of debug UART (as selected in obey file or with eshell debugport command).
sl@0
    69
//	
sl@0
    70
	{
sl@0
    71
	//
sl@0
    72
	// TO DO: (optional)
sl@0
    73
	//
sl@0
    74
	// Read the iDebugPort field of the SuperPage, map the result to the corresponding Serial Port Linear
sl@0
    75
	// address and return this, like the following EXAMPLE ONLY:
sl@0
    76
	//
sl@0
    77
	TUint debugPort;
sl@0
    78
	switch (Kern::SuperPage().iDebugPort)
sl@0
    79
		{
sl@0
    80
		case 1:
sl@0
    81
			debugPort=KHwBaseSerial1;
sl@0
    82
			break;
sl@0
    83
		case 2:
sl@0
    84
			debugPort=KHwBaseSerial2;
sl@0
    85
			break;
sl@0
    86
		case 3:
sl@0
    87
			debugPort=KHwBaseSerial3;
sl@0
    88
			break;
sl@0
    89
		default:
sl@0
    90
			debugPort=KHwBaseSerial1;
sl@0
    91
			break;
sl@0
    92
		}
sl@0
    93
	return debugPort;
sl@0
    94
	}
sl@0
    95
sl@0
    96
EXPORT_C TUint TTemplate::ProcessorPeriodInPs()
sl@0
    97
//
sl@0
    98
// Return CPU clock period in picoseconds
sl@0
    99
//
sl@0
   100
	{
sl@0
   101
	//
sl@0
   102
	// TO DO: (optional)
sl@0
   103
	//
sl@0
   104
	// Read the CPU clock speed and return its period in picoseconds. If only a limited range of speeds is possible
sl@0
   105
	// it is preferable to use the masked speed reading as an index into a look up table containing the corresponding
sl@0
   106
	// period
sl@0
   107
	//
sl@0
   108
	return 0;	// EXAMPLE ONLY
sl@0
   109
	}
sl@0
   110
sl@0
   111
EXPORT_C void TTemplate::SetIntMask(TUint aValue)
sl@0
   112
//
sl@0
   113
// Set the Hardware Interrupt masks
sl@0
   114
//
sl@0
   115
	{
sl@0
   116
	// the following is EXAMPLE ONLY
sl@0
   117
	TInt irq=NKern::DisableAllInterrupts();
sl@0
   118
	AsspRegister::Write32(KHwInterruptsMaskSet,    aValue);
sl@0
   119
	AsspRegister::Write32(KHwInterruptsMaskClear, ~aValue);
sl@0
   120
	NKern::RestoreInterrupts(irq);
sl@0
   121
	}
sl@0
   122
sl@0
   123
EXPORT_C void TTemplate::ModifyIntMask(TUint aClearMask,TUint aSetMask)
sl@0
   124
//
sl@0
   125
// Modify the Hardware Interrupt masks
sl@0
   126
//
sl@0
   127
	{
sl@0
   128
	// the following is EXAMPLE ONLY
sl@0
   129
	TInt irq=NKern::DisableAllInterrupts();
sl@0
   130
	AsspRegister::Write32(KHwInterruptsMaskSet,    aSetMask);
sl@0
   131
	AsspRegister::Write32(KHwInterruptsMaskClear, ~aClearMask);
sl@0
   132
	NKern::RestoreInterrupts(irq);
sl@0
   133
	}
sl@0
   134
sl@0
   135
EXPORT_C TUint TTemplate::IntsPending()
sl@0
   136
//
sl@0
   137
// Return the state of pending interrupts
sl@0
   138
//
sl@0
   139
	{
sl@0
   140
	// the following is EXAMPLE ONLY
sl@0
   141
	return(AsspRegister::Read32(KHwInterruptsIrqPending));
sl@0
   142
	}
sl@0
   143
sl@0
   144
EXPORT_C TUint TTemplate::RtcData()
sl@0
   145
//
sl@0
   146
// Return the current time of the RTC
sl@0
   147
//
sl@0
   148
	{
sl@0
   149
	//
sl@0
   150
	// TO DO: (optional)
sl@0
   151
	//
sl@0
   152
	// Read the RTC current time register and return this time
sl@0
   153
	//
sl@0
   154
	return 0;	// EXAMPLE ONLY
sl@0
   155
	}
sl@0
   156
sl@0
   157
EXPORT_C void TTemplate::SetRtcData(TUint aValue)
sl@0
   158
//
sl@0
   159
// Set the RTC time
sl@0
   160
//
sl@0
   161
	{
sl@0
   162
	//
sl@0
   163
	// TO DO: (optional)
sl@0
   164
	//
sl@0
   165
	// Set the RTC current time with aValue (may need formatting appropriately)
sl@0
   166
	//
sl@0
   167
	}
sl@0
   168
sl@0
   169
EXPORT_C TPhysAddr TTemplate::VideoRamPhys()
sl@0
   170
//
sl@0
   171
// Return the physical address of the video RAM
sl@0
   172
//
sl@0
   173
	{
sl@0
   174
	return TemplateAssp::VideoRamPhys;
sl@0
   175
	}