~ubuntu-branches/ubuntu/feisty/apex/feisty

« back to all changes in this revision

Viewing changes to src/mach-ixp42x/timer.c

  • Committer: Bazaar Package Importer
  • Author(s): Marc Singer
  • Date: 2006-10-22 14:20:13 UTC
  • Revision ID: james.westby@ubuntu.com-20061022142013-zy5md2199ipggdxq
Tags: 1.4.7
* New command line starts RTC.
* Moved the environment to the same block as the loader.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* timer.c
 
2
 
 
3
   written by Marc Singer
 
4
   14 Jan 2005
 
5
 
 
6
   Copyright (C) 2005 Marc Singer
 
7
 
 
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.
 
12
 
 
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.
 
17
 
 
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
 
21
   USA.
 
22
 
 
23
   -----------
 
24
   DESCRIPTION
 
25
   -----------
 
26
 
 
27
*/
 
28
 
 
29
#include <config.h>
 
30
#include <service.h>
 
31
#include "hardware.h"
 
32
 
 
33
unsigned long timer_read (void)
 
34
{
 
35
  return OST_TS;
 
36
}
 
37
 
 
38
 
 
39
/* timer_delta
 
40
 
 
41
   returns the difference in time in milliseconds.
 
42
 
 
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.
 
45
 
 
46
   The math works out such that wrapping around the end will return
 
47
   the expected result.
 
48
 
 
49
*/
 
50
 
 
51
unsigned long timer_delta (unsigned long start, unsigned long end)
 
52
{
 
53
  return (end - start)/66660;
 
54
}