// gfatimer.h :
//

#if !defined(AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_)
#define AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_

#ifdef __cplusplus
extern "C" {
#endif	//	__cplusplus

/////////////////////////////////////////////////////////////////////////////
// gfatimer.h - Declarations:

typedef enum GfaTimerResolution
{
	GTR_Invalid,
	GTR_10ms,
	GTR_25ms,
	GTR_50ms,
	GTR_Last
	
}GfaTimerResolution;

/////////////////////////////////////////////////////////////////////////////

typedef enum GfaTimerClockPulse
{
	GTCP_Invalid = -1,
	GTCP_250ms,
	GTCP_500ms,
	GTCP_750ms,
	GTCP_1000ms,
	GTCP_1500ms,
	GTCP_2000ms,
	GTCP_5000ms,
	GTCP_10000ms,
	GTCP_Last
}GfaTimerClockPulse;

/////////////////////////////////////////////////////////////////////////////

typedef void (*pfnTIMERCALLBACK)(int, void*);
typedef void (*pfnPULSECALLBACK)(GfaTimerClockPulse, int, void*);

/////////////////////////////////////////////////////////////////////////////
// initialization (if GfaTimerRelease is not called explicitly, clean up will
// be done internally, if the process exits gracefully)

int				GfaTimerInit(int nTimerCount, GfaTimerResolution res);
void			GfaTimerRelease(void);

void			GfaRegisterTimerCallback(int tnum, pfnTIMERCALLBACK pfnCallback, void *pContext);
void			GfaUnregisterTimerCallback(int tnum);

void			GfaRegisterClockPulseCallback(GfaTimerClockPulse cp, pfnPULSECALLBACK pfnCallback, void *pContext);
void			GfaUnregisterClockPulseCallback(GfaTimerClockPulse cp);

/////////////////////////////////////////////////////////////////////////////
// mondial legacy timer API

int				tf_test(int tnum);
void			tf_set(int tnum);
void			tf_clear(int tnum);
void			tf_store(int tnum, int fset);
unsigned long	tw_read(int tnum);
void			tw_set(int tnum, unsigned long val); // val in milliseconds

/////////////////////////////////////////////////////////////////////////////
// test clock pulse (see GfaTimerClockPulse enumeration for possible values)

int				cp_test(GfaTimerClockPulse cp);

/////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif	//	__cplusplus
#endif	//	!defined(AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_)
