6
Copyright (C) 2005 Marc Singer
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License as
10
published by the Free Software Foundation; either version 2 of the
11
License, or (at your option) any later version.
13
This program is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33
unsigned long timer_read (void)
41
returns the difference in time in milliseconds.
43
The base counter rate is 66.66MHz or a 15ns cycle time. 1us takes
44
67 counts, 1ms takes 66660 counts. It wraps at about 64 seconds.
46
The math works out such that wrapping around the end will return
51
unsigned long timer_delta (unsigned long start, unsigned long end)
53
return (end - start)/66660;