]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
3 Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
4 Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/ArmGenericTimerCounterLib.h>
17 #include <Library/ArmLib.h>
21 ArmGenericTimerEnableTimer (
27 TimerCtrlReg
= ArmReadCntvCtl ();
28 TimerCtrlReg
|= ARM_ARCH_TIMER_ENABLE
;
29 ArmWriteCntvCtl (TimerCtrlReg
);
34 ArmGenericTimerReenableTimer (
42 ArmGenericTimerDisableTimer (
48 TimerCtrlReg
= ArmReadCntvCtl ();
49 TimerCtrlReg
&= ~ARM_ARCH_TIMER_ENABLE
;
50 ArmWriteCntvCtl (TimerCtrlReg
);
55 ArmGenericTimerSetTimerFreq (
59 ArmWriteCntFrq (FreqInHz
);
64 ArmGenericTimerGetTimerFreq (
68 return ArmReadCntFrq ();
73 ArmGenericTimerGetTimerVal (
77 return ArmReadCntvTval ();
83 ArmGenericTimerSetTimerVal (
87 ArmWriteCntvTval (Value
);
92 ArmGenericTimerGetSystemCount (
96 return ArmReadCntvCt ();
101 ArmGenericTimerGetTimerCtrlReg (
105 return ArmReadCntvCtl ();
110 ArmGenericTimerSetTimerCtrlReg (
114 ArmWriteCntvCtl (Value
);
119 ArmGenericTimerGetCompareVal (
123 return ArmReadCntvCval ();
128 ArmGenericTimerSetCompareVal (
132 ArmWriteCntvCval (Value
);