source: rtems/c/src/lib/libbsp/m68k/mrm332/timer/timer.c @ 332484b5

4.104.114.84.95
Last change on this file since 332484b5 was 332484b5, checked in by Joel Sherrill <joel.sherrill@…>, on May 25, 2001 at 4:28:46 PM

2000-05-25 Matt Cross <profesor@…>

  • New MRM332 BSP for the Mini RoboMind? board based on the 68332 microcontroller designed and build by Mark Castelluccio. For details on the MRM see http://www.robominds.com.
  • .cvsignore, ChangeLog? Makefile.am, README, bsp_specs, clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, configure.in, console/.cvsignore, console/Makefile.am, console/console.c, include/.cvsignore, include/Makefile.am, include/bsp.h, include/mrm332.h, misc/dotests, misc/gdbinit68, misc/interr.c, spurious/.cvsignore, spurious/Makefile.am, spurious/spinit.c, start/.cvsignore, start/Makefile.am, start/start.c, startup/.cvsignore, startup/Makefile.am, startup/bspclean.c, startup/bspstart.c, startup/except_vect_332_ROM.S, startup/linkcmds, startup/linkcmds_ROM, timer/.cvsignore, timer/Makefile.am, timer/timer.c, times, wrapup/.cvsignore, wrapup/Makefile.am: Initial files.
  • 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.