source: rtems/c/src/lib/libbsp/m68k/efi332/timer/timer.c @ f52111f

4.104.114.84.95
Last change on this file since f52111f was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*  Timer_init()
2 *
3 *  This routine initializes a timer in efi68k's DP8570A TCP
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  NOTE: It is important that the timer start/stop overhead be
10 *        determined when porting or modifying this code.
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.OARcorp.com/rtems/license.html.
18 *
19 *  $Id$
20 */
21
22
23#include <bsp.h>
24
25rtems_boolean Timer_driver_Find_average_overhead;
26
27extern rtems_isr Clock_isr();
28
29void Timer_initialize( void )
30{
31}
32
33/*
34 *  The following controls the behavior of Read_timer().
35 *
36 *  FIND_AVG_OVERHEAD *  instructs the routine to return the "raw" count.
37 *
38 *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
39 *  is usually deducted from the number returned.
40 *
41 *  LEAST_VALID is the lowest number this routine should trust.  Numbers
42 *  below this are "noise" and zero is returned.
43 */
44
45#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
46                             /* (Y countdowns) to start/stop the timer. */
47                             /* This value is in microseconds. */
48#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
49
50/*
51 * Return timer value in 1/2-microsecond units
52 */
53int Read_timer( void )
54{
55  rtems_unsigned32 total;
56  total = 0;
57
58  if ( Timer_driver_Find_average_overhead == 1 )
59    return total;          /* in XXX microsecond units */
60
61  if ( total < LEAST_VALID )
62    return 0;            /* below timer resolution */
63
64  return (total - AVG_OVERHEAD);
65}
66
67
68/*
69 *  Empty function call used in loops to measure basic cost of looping
70 *  in Timing Test Suite.
71 */
72
73rtems_status_code Empty_function(void)
74{
75    return RTEMS_SUCCESSFUL;
76}
77
78void Set_find_average_overhead(
79  rtems_boolean find_flag
80)
81{
82  Timer_driver_Find_average_overhead = find_flag;
83}
Note: See TracBrowser for help on using the repository browser.