os/kernelhwsrv/kernel/eka/include/nkernsmp/arm/arm_tmr.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-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
// e32\include\nkernsmp\arm\arm_tmr.h
sl@0
    15
// 
sl@0
    16
// WARNING: This file contains some APIs which are internal and are subject
sl@0
    17
//          to change without notice. Such APIs should therefore not be used
sl@0
    18
//          outside the Kernel and Hardware Services package.
sl@0
    19
//
sl@0
    20
sl@0
    21
#ifndef	__ARM_TMR_H__
sl@0
    22
#define	__ARM_TMR_H__
sl@0
    23
#include <e32def.h>
sl@0
    24
sl@0
    25
#ifdef	__STANDALONE_NANOKERNEL__
sl@0
    26
#undef	__IN_KERNEL__
sl@0
    27
#define	__IN_KERNEL__
sl@0
    28
#endif
sl@0
    29
sl@0
    30
#if !defined(__CPU_ARM11MP__) && !defined(__CPU_CORTEX_A9__)
sl@0
    31
#error	Unknown local timer
sl@0
    32
#endif
sl@0
    33
sl@0
    34
// Local timer looks the same on ARM11MP and Cortex A9
sl@0
    35
struct ArmLocalTimer
sl@0
    36
	{
sl@0
    37
	volatile TUint32	iTimerLoad;				// 00 Timer reload value (write also writes counter)
sl@0
    38
	volatile TUint32	iTimerCount;			// 04 Timer instantaneous count value
sl@0
    39
	volatile TUint32	iTimerCtrl;				// 08 Timer control register
sl@0
    40
	volatile TUint32	iTimerIntStatus;		// 0C Timer interrupt status register
sl@0
    41
	volatile TUint32	i_Spare1[4];			// 10 unused
sl@0
    42
	volatile TUint32	iWatchdogLoad;			// 20 Watchdog reload value (write also writes counter)
sl@0
    43
	volatile TUint32	iWatchdogCount;			// 24 Watchdog instantaneous count value
sl@0
    44
	volatile TUint32	iWatchdogCtrl;			// 28 Watchdog control register
sl@0
    45
	volatile TUint32	iWatchdogIntStatus;		// 2C Watchdog interrupt status register
sl@0
    46
	volatile TUint32	iWatchdogResetSent;		// 30 Watchdog reset sent register
sl@0
    47
	volatile TUint32	iWatchdogDisable;		// 34 Watchdog disable register
sl@0
    48
	volatile TUint32	i_Spare2[50];			// 38 unused
sl@0
    49
	};
sl@0
    50
sl@0
    51
__ASSERT_COMPILE(sizeof(ArmLocalTimer)==0x100);
sl@0
    52
sl@0
    53
// These bits apply to both timer and watchdog control registers
sl@0
    54
enum TArmTimerCtrl
sl@0
    55
	{
sl@0
    56
	E_ArmTmrCtrl_Enable			=1u,		// when set, timer counts down
sl@0
    57
	E_ArmTmrCtrl_Reload			=2u,		// when set, timer reloads on reaching zero
sl@0
    58
	E_ArmTmrCtrl_IntEn			=4u,		// when set enables timer interrupt
sl@0
    59
	E_ArmTmrCtrl_WD				=8u,		// set when in watchdog mode (watchdog only, can write to 1 but not 0)
sl@0
    60
	E_ArmTmrCtrl_PrescaleShift	=8u,
sl@0
    61
	E_ArmTmrCtrl_PrescaleMask	=0xff00u,	// bits 8-15 = prescale value - divides by (P+1)
sl@0
    62
											// input to prescaler is PERIPHCLK (=CPUCLK/2 on NE1, CPUCLK/N in general, N>=2)
sl@0
    63
	E_ArmTmrCtrl_Prescale64		=0x3f00u,	// value to prescale by 64 (matches cycle counter prescaler)
sl@0
    64
	};
sl@0
    65
sl@0
    66
enum TArmTimerIntStatus
sl@0
    67
	{
sl@0
    68
	E_ArmTmrIntStatus_Event		=1u			// set when timer counter reaches zero, write 1 to clear
sl@0
    69
	};
sl@0
    70
sl@0
    71
enum TArmTimerWRS
sl@0
    72
	{
sl@0
    73
	E_ArmTmrWRS_ResetSent		=1u			// set if the watchdog caused a reset, write 1 to clear
sl@0
    74
	};
sl@0
    75
sl@0
    76
enum TArmTimerWDDisable
sl@0
    77
	{
sl@0
    78
	E_ArmTmrWDD_1				=0x12345678u,	// to disable watchdog, write this ...
sl@0
    79
	E_ArmTmrWDD_2				=0x87654321u,	// ... then this with no intervening writes
sl@0
    80
	};
sl@0
    81
sl@0
    82
sl@0
    83
sl@0
    84
#endif	// 	__ARM_TMR_H__