gfatimer.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // gfatimer.h :
  2. //
  3. #if !defined(AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_)
  4. #define AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif // __cplusplus
  8. /////////////////////////////////////////////////////////////////////////////
  9. // gfatimer.h - Declarations:
  10. typedef enum GfaTimerResolution
  11. {
  12. GTR_Invalid,
  13. GTR_10ms,
  14. GTR_25ms,
  15. GTR_50ms,
  16. GTR_Last
  17. }GfaTimerResolution;
  18. /////////////////////////////////////////////////////////////////////////////
  19. typedef enum GfaTimerClockPulse
  20. {
  21. GTCP_Invalid = -1,
  22. GTCP_250ms,
  23. GTCP_500ms,
  24. GTCP_750ms,
  25. GTCP_1000ms,
  26. GTCP_1500ms,
  27. GTCP_2000ms,
  28. GTCP_5000ms,
  29. GTCP_10000ms,
  30. GTCP_Last
  31. }GfaTimerClockPulse;
  32. /////////////////////////////////////////////////////////////////////////////
  33. typedef void (*pfnTIMERCALLBACK)(int, void*);
  34. typedef void (*pfnPULSECALLBACK)(GfaTimerClockPulse, int, void*);
  35. /////////////////////////////////////////////////////////////////////////////
  36. // initialization (if GfaTimerRelease is not called explicitly, clean up will
  37. // be done internally, if the process exits gracefully)
  38. int GfaTimerInit(int nTimerCount, GfaTimerResolution res);
  39. void GfaTimerRelease(void);
  40. void GfaRegisterTimerCallback(int tnum, pfnTIMERCALLBACK pfnCallback, void *pContext);
  41. void GfaUnregisterTimerCallback(int tnum);
  42. void GfaRegisterClockPulseCallback(GfaTimerClockPulse cp, pfnPULSECALLBACK pfnCallback, void *pContext);
  43. void GfaUnregisterClockPulseCallback(GfaTimerClockPulse cp);
  44. /////////////////////////////////////////////////////////////////////////////
  45. // mondial legacy timer API
  46. int tf_test(int tnum);
  47. void tf_set(int tnum);
  48. void tf_clear(int tnum);
  49. void tf_store(int tnum, int fset);
  50. unsigned long tw_read(int tnum);
  51. void tw_set(int tnum, unsigned long val); // val in milliseconds
  52. /////////////////////////////////////////////////////////////////////////////
  53. // test clock pulse (see GfaTimerClockPulse enumeration for possible values)
  54. int cp_test(GfaTimerClockPulse cp);
  55. /////////////////////////////////////////////////////////////////////////////
  56. #ifdef __cplusplus
  57. }
  58. #endif // __cplusplus
  59. #endif // !defined(AGD_GFATIMER_H__60DC793C_D443_45EB_AD2F_D947862C2060__INCLUDED_)