/* This File Automatically Generated by the build system */ 
#include <fix.h> 
#ifndef __TIMER_H 
#define  __TIMER_H 
/*
 *
 * $Source: x:/prj/tech/libsrc/timer/RCS/tmdecl.h $
 * $Revision: 1.5 $
 * $Author
 * $Date: 1997/06/18 02:13:25 $
 *
 * External declarations for timer functions.
 *
 * This file is part of the timer library.
 *
 * $Log: tmdecl.h $
 * Revision 1.5  1997/06/18  02:13:25  TOML
 * time unrecorded
 * 
 * Revision 1.4  1996/07/19  14:25:50  TOML
 * *** empty log message ***
 * 
 * Revision 1.3  1994/11/09  00:30:13  lmfeeney
 * added variable names to prototype
 *
 *
 * Revision 1.2  1994/10/17  17:45:24  lmfeeney
 * removed old functions added new ones
 *
 * Revision 1.1  1993/05/20  15:53:03  kaboom
 * Initial revision
 *
 */

typedef void (*pfv)();

extern volatile long tm_millisec;
extern volatile fix tm_fix;

#ifndef _WIN32
#define tm_get_millisec() (tm_millisec)
#define tm_get_fix() (tm_fix)
#else
EXTERN long LGAPI tm_get_millisec(void);
EXTERN long LGAPI tm_get_millisec_unrecorded(void);
EXTERN fix LGAPI tm_get_fix(void);
#endif

extern int tm_init_realtime (unsigned long rt_freq_in, unsigned long spec_freq, pfv fn);
extern long tm_get_rt_freq ();

 /* add_process is not a macro, because it  checks that the ftab
   is non-null and warns if it is.  this is mostly an aid for catching
   initialization order errors, not a useful check
   all the rest of the tm_functions are #defines in tmmac.h
   (which is not included as an internal tm header file!)
 */

extern int tm_add_process (pfv prot_func, int real_func, long denom);

enum {
  TMC_ADD_PROCESS,
  TMC_REM_PROCESS,
  TMC_ACT_PROCESS,
  TMC_DEACT_PROCESS,
  TMC_SET_PROC_DENOM,
  TMC_SET_PROC_FREQ,
  TMC_SET_PROC_PER,
  TMC_TIMER_FNS
};

extern  pfv *tm_ftab;  

extern  pfv tm_ftab_libt [TMC_TIMER_FNS]; 
extern  pfv tm_ftab_ail [TMC_TIMER_FNS];  

/* external interface to timer library -- easier than renaming all the tm_
 * functions
 */

/* see comment in tmdecl.h

#define tm_add_process \
     ((int (*) ()) tm_ftab[TMC_ADD_PROCESS])
*/

#define tm_remove_process \
     ((int (*) ()) tm_ftab[TMC_REM_PROCESS])

#define tm_activate_process \
     ((int (*) ()) tm_ftab[TMC_ACT_PROCESS])

#define tm_deactivate_process \
     ((int (*) ()) tm_ftab[TMC_DEACT_PROCESS])

#define tm_set_process_denom \
     ((void  (*) ()) tm_ftab[TMC_SET_PROC_DENOM])

#define tm_set_process_freq \
     ((void  (*) ()) tm_ftab[TMC_SET_PROC_FREQ])

#define tm_set_process_period \
     ((void  (*) ()) tm_ftab[TMC_SET_PROC_PER])

//
// $Source: r:/prj/lib/src/timer/rcs/tmd.inc $
// $Revision: 1.2 $
// $Author
// $Date: 1994/10/17 17:34:50 $
//
// External declarations for timer global variables.
//
// This file is part of the timer library.
//
// $Log: tmd.inc $
// Revision 1.2  1994/10/17  17:34:50  lmfeeney
// tmd_ticks removed to tm_realtime
// 
// Revision 1.1  1993/05/20  15:49:36  kaboom
// Initial revision
// 
extern char * tmd_lowmem_start;
//
// $Source: r:/prj/lib/src/timer/rcs/tmflag.inc $
// $Revision: 1.1 $
// $Author
// $Date: 1993/05/20 15:49:53 $
//
// Flag bit definitions for timer status.
//
// Definition of flags in timer record.
//
// $Log: tmflag.inc $
// Revision 1.1  1993/05/20  15:49:53  kaboom
// Initial revision
// 
#define TMF_INUSE (1)
#define TMF_ACTIVE (2)
#define TMF_DUAL (4)
//
// $Source: r:/prj/lib/src/timer/rcs/tmlow.inc $
// $Revision: 1.2 $
// $Author
// $Date: 1994/10/17 17:44:08 $
//
// Definitions for format of low memory buffer.
//
// This file is part of the timer library.
//
// $Log: tmlow.inc $
// Revision 1.2  1994/10/17  17:44:08  lmfeeney
// use memory formerly used for tmd_ticks to store eax, not
// optimal, but easiest
// 
// Revision 1.1  1993/05/20  15:50:18  kaboom
// Initial revision
// 
#define TML_RECLIST_SIZE (0x10)
#define TML_OLD_REAL_HANDLER (0)
#define TML_DENOM (4           )
#define TML_NEW_DENOM (8           )
#define TML_CUR_REC (12          )
#define TML_GLOBAL_SIZE (16)
#define TML_RECLIST_START (TML_GLOBAL_SIZE)
#define TML_RECLIST_END (TML_RECLIST_START+TMR_SIZE*TML_RECLIST_SIZE)
#define TML_RECLIST_LAST (TML_RECLIST_END-TMR_SIZE)
#define TML_LOWBUF_SIZE (TML_RECLIST_END)
//
// $Source: r:/prj/lib/src/timer/rcs/tmreg.inc $
// $Revision: 1.1 $
// $Author
// $Date: 1993/05/20 15:50:46 $
//
// Timer port/mode definitions.
//
// This file is part of the timer library.
//
// $Log: tmreg.inc $
// Revision 1.1  1993/05/20  15:50:46  kaboom
// Initial revision
// 
#define TMD_INT (8)
#define TMD_FREQ (1193180)
#define TMD_DEF_DENOM (0x10000)
#define TMP_MODE (0x43)
#define TMP_CHAN0 (0x40)
#define TMM_RATEGEN (0x34)
#define TMM_SQUARE (0x36)
#endif /* __TIMER_H */ 
