]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c
d04e04fb334dd3299acde576a372ca3bb54a3225
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
= ArmReadCntpCtl ();
28 TimerCtrlReg
|= ARM_ARCH_TIMER_ENABLE
;
29 ArmWriteCntpCtl (TimerCtrlReg
);
34 ArmGenericTimerDisableTimer (
40 TimerCtrlReg
= ArmReadCntpCtl ();
41 TimerCtrlReg
&= ~ARM_ARCH_TIMER_ENABLE
;
42 ArmWriteCntpCtl (TimerCtrlReg
);
47 ArmGenericTimerSetTimerFreq (
51 ArmWriteCntFrq (FreqInHz
);
56 ArmGenericTimerGetTimerFreq (
60 return ArmReadCntFrq ();
65 ArmGenericTimerGetTimerVal (
69 return ArmReadCntpTval ();
75 ArmGenericTimerSetTimerVal (
79 ArmWriteCntpTval (Value
);
84 ArmGenericTimerGetSystemCount (
88 return ArmReadCntPct ();
93 ArmGenericTimerGetTimerCtrlReg (
97 return ArmReadCntpCtl ();
102 ArmGenericTimerSetTimerCtrlReg (
106 ArmWriteCntpCtl (Value
);
111 ArmGenericTimerGetCompareVal (
115 return ArmReadCntpCval ();
120 ArmGenericTimerSetCompareVal (
124 ArmWriteCntpCval (Value
);