]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
c941895a3574b0246a8718e3ee3ef02db664deda
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 ArmGenericTimerDisableTimer (
40 TimerCtrlReg
= ArmReadCntvCtl ();
41 TimerCtrlReg
&= ~ARM_ARCH_TIMER_ENABLE
;
42 ArmWriteCntvCtl (TimerCtrlReg
);
47 ArmGenericTimerSetTimerFreq (
51 ArmWriteCntFrq (FreqInHz
);
56 ArmGenericTimerGetTimerFreq (
60 return ArmReadCntFrq ();
65 ArmGenericTimerGetTimerVal (
69 return ArmReadCntvTval ();
75 ArmGenericTimerSetTimerVal (
79 ArmWriteCntvTval (Value
);
84 ArmGenericTimerGetSystemCount (
88 return ArmReadCntvCt ();
93 ArmGenericTimerGetTimerCtrlReg (
97 return ArmReadCntvCtl ();
102 ArmGenericTimerSetTimerCtrlReg (
106 ArmWriteCntvCtl (Value
);
111 ArmGenericTimerGetCompareVal (
115 return ArmReadCntvCval ();
120 ArmGenericTimerSetCompareVal (
124 ArmWriteCntvCval (Value
);