Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.1 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. # _____ ___ ____ ___ ____
  3. # ____| | ____| | | |____|
  4. # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
  5. #-----------------------------------------------------------------------
  6. # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
  7. # Licenced under Academic Free License version 2.0
  8. # Review ps2sdk README & LICENSE files for further details.
  9. */
  10. /**
  11. * @file
  12. * Timer prototypes
  13. */
  14. #ifndef __TIMER_H__
  15. #define __TIMER_H__
  16. #include <tamtypes.h>
  17. // EE Timers
  18. #define T0_COUNT ((volatile unsigned int*)0x10000000)
  19. #define T0_MODE ((volatile unsigned int*)0x10000010)
  20. #define T0_COMP ((volatile unsigned int*)0x10000020)
  21. #define T0_HOLD ((volatile unsigned int*)0x10000030)
  22. #define T1_COUNT ((volatile unsigned int*)0x10000800)
  23. #define T1_MODE ((volatile unsigned int*)0x10000810)
  24. #define T1_COMP ((volatile unsigned int*)0x10000820)
  25. #define T1_HOLD ((volatile unsigned int*)0x10000830)
  26. // Note! T2 and T3 don't have a Tn_HOLD register!
  27. // ----------------------------------------------
  28. #define T2_COUNT ((volatile unsigned int*)0x10001000)
  29. #define T2_MODE ((volatile unsigned int*)0x10001010)
  30. #define T2_COMP ((volatile unsigned int*)0x10001020)
  31. #define T3_COUNT ((volatile unsigned int*)0x10001800)
  32. #define T3_MODE ((volatile unsigned int*)0x10001810)
  33. #define T3_COMP ((volatile unsigned int*)0x10001820)
  34. #define Tn_MODE(CLKS,GATE,GATS,GATM,ZRET,CUE,CMPE,OVFE,EQUF,OVFF) \
  35. (u32)((u32)(CLKS) | ((u32)(GATE) << 2) | \
  36. ((u32)(GATS) << 3) | ((u32)(GATM) << 4) | \
  37. ((u32)(ZRET) << 6) | ((u32)(CUE) << 7) | \
  38. ((u32)(CMPE) << 8) | ((u32)(OVFE) << 9) | \
  39. ((u32)(EQUF) << 10) | ((u32)(OVFF) << 11))
  40. // Available rates
  41. #define kBUSCLK (147456000)
  42. #define kBUSCLKBY16 (kBUSCLK / 16)
  43. #define kBUSCLKBY256 (kBUSCLK / 256)
  44. #define kHBLNK_NTSC (15734)
  45. #define kHBLNK_PAL (15625)
  46. #define kHBLNK_DTV480p (31469)
  47. #define kHBLNK_DTV1080i (33750)
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. u32 cpu_ticks(void);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* __TIMER_H__ */