1 /* 2 * Copyright 2009, Colin Günther, coling@gmx.de 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "device.h" 8 9 #include <compat/sys/kernel.h> 10 11 12 int ticks; 13 static timer sHardClockTimer; 14 15 16 /*! 17 * Implementation of FreeBSD's hardclock timer. 18 */ 19 static status_t 20 hardClock(timer* hardClockTimer) 21 { 22 atomic_add((vint32*)&ticks, 1); 23 return B_OK; 24 } 25 26 27 /*! 28 * Initialization of the hardclock timer which ticks according to hz defined in 29 * compat/sys/kernel.h. 30 */ 31 status_t 32 init_hard_clock() 33 { 34 ticks = 0; 35 return add_timer(&sHardClockTimer, hardClock, ticks_to_usecs(1), 36 B_PERIODIC_TIMER); 37 } 38 39 40 void 41 uninit_hard_clock() 42 { 43 cancel_timer(&sHardClockTimer); 44 } 45