Src/MicrosecondTrap.h

/*                                  MicrosecondTrap.h                               */
/*
 * MicrosecondTrap.h
 * Copyright © 1994 Apple Computer Inc. All rights reserved.
 */
#ifndef __MicrosecondTrap__
#define __MicrosecondTrap__
#include <Types.h>
#include <Traps.h>
#include <Timer.h>
 
/*
 * These definitions are needed for the Microsecond Trap only if you have not
 * upgraded to the Universal Headers.
 */
#ifndef __MIXEDMODE__
/*
 * MixedMode.h is defined for the Universal Headers. If it wasn't defined, we'll
 * define a 64-bit unsigned integer here.
 */
#if defined(powerc) || defined (__powerc)
#pragma options align=mac68k
#endif
struct UnsignedWide {
    unsigned long               hi;
    unsigned long               lo;
};
#if defined(powerc) || defined(__powerc)
#pragma options align=reset
#endif
typedef struct UnsignedWide UnsignedWide;
#endif /* __MIXEDMODE__ */
 
#ifndef __powerc
/*
 * This trap returns the number of microseconds, but is not yet defined in all public
 * headers. It is present on all systems that support the extended time manager..
 */
#ifndef _Microseconds
#define _Microseconds   0xA193
#pragma parameter Microseconds(__A1)
pascal void Microseconds(UnsignedWide *microsecondCount) =
  {0xA193, 0x225F, 0x22C8, 0x2280};
#endif  /* _Microseconds */
#endif  /* __powerc */
 
 
/*
 * TRUE if the Microsecond Trap is present.
 */
Boolean                     MicrosecondTrapPresent(void);
 
/*
 * Convert a Microsecond value to a double-precision number of microseconds.
 */
double                      MicrosecondToDouble(
        register const UnsignedWide *epochPtr
    );
 
/*
 * Return the difference between two Microsecond Trap values.
 * Integer subtraction is used to preserve accuracy.
 */
void
MicrosecondDelta(
        register const UnsignedWide *startPtr,
        register const UnsignedWide *endPtr,
        register UnsignedWide       *result
    );
#endif /* __MicrosecondTrap__ */