Nico Huber | c83239e | 2016-10-05 17:46:49 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- This file is part of the coreboot project. |
| 3 | -- |
| 4 | -- Copyright (C) 2016 secunet Security Networks AG |
| 5 | -- |
| 6 | -- This program is free software; you can redistribute it and/or modify |
| 7 | -- it under the terms of the GNU General Public License as published by |
| 8 | -- the Free Software Foundation; version 2 of the License. |
| 9 | -- |
| 10 | -- This program is distributed in the hope that it will be useful, |
| 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | -- GNU General Public License for more details. |
| 14 | -- |
| 15 | |
| 16 | with Interfaces.C; |
| 17 | |
| 18 | package body HW.Time.Timer |
| 19 | with Refined_State => (Timer_State => null, |
| 20 | Abstract_Time => null) |
| 21 | is |
| 22 | |
| 23 | procedure Timer_Monotonic_Get (MT : out Interfaces.C.long); |
| 24 | pragma Import (C, Timer_Monotonic_Get, "timer_monotonic_get"); |
| 25 | |
| 26 | function Raw_Value_Min return T |
| 27 | with |
| 28 | SPARK_Mode => Off |
| 29 | is |
| 30 | Microseconds : Interfaces.C.long; |
| 31 | begin |
| 32 | Timer_Monotonic_Get (Microseconds); |
| 33 | return T (Microseconds); |
| 34 | end Raw_Value_Min; |
| 35 | |
| 36 | function Raw_Value_Max return T |
| 37 | is |
| 38 | begin |
| 39 | return Raw_Value_Min + 1; |
| 40 | end Raw_Value_Max; |
| 41 | |
| 42 | function Hz return T |
| 43 | is |
| 44 | begin |
| 45 | return 1_000_000; |
| 46 | end Hz; |
| 47 | |
| 48 | end HW.Time.Timer; |