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.

114 lines
2.9 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**
  2. * @file
  3. * VIF codes.
  4. */
  5. #ifndef __VIF_CODES_H__
  6. #define __VIF_CODES_H__
  7. #include <tamtypes.h>
  8. /** No Operation */
  9. #define VIF_CMD_NOP 0x00
  10. /** Sets CYCLE register */
  11. #define VIF_CMD_STCYCL 0x01
  12. /** Sets OFFSET register (VIF1) */
  13. #define VIF_CMD_OFFSET 0x02
  14. /** Sets BASE register (VIF1) */
  15. #define VIF_CMD_BASE 0x03
  16. /** Sets ITOPS register */
  17. #define VIF_CMD_ITOP 0x04
  18. /** Sets MODE register */
  19. #define VIF_CMD_STMOD 0x05
  20. /** Mask GIF transfer (VIF1) */
  21. #define VIF_CMD_MSKPATH3 0x06
  22. /** Sets Mark register */
  23. #define VIF_CMD_MARK 0x07
  24. /** Wait for end of microprogram */
  25. #define VIF_CMD_FLUSHE 0x10
  26. /** Wait for end of microprogram & Path 1/2 GIF xfer (VIF1) */
  27. #define VIF_CMD_FLUSH 0x11
  28. /** Wait for end of microprogram & all Path GIF xfer (VIF1) */
  29. #define VIF_CMD_FLUSHA 0x13
  30. /** Activate microprogram */
  31. #define VIF_CMD_MSCAL 0x14
  32. /** Execute microrprogram continuously */
  33. #define VIF_CMD_MSCNT 0x17
  34. /** Activate microprogram (VIF1) */
  35. #define VIF_CMD_MSCALF 0x15
  36. /** Sets MASK register */
  37. #define VIF_CMD_STMASK 0x20
  38. /** Sets ROW register */
  39. #define VIF_CMD_STROW 0x30
  40. /** Sets COL register */
  41. #define VIF_CMD_STCOL 0x31
  42. /** Load microprogram */
  43. #define VIF_CMD_MPG 0x4A
  44. /** Transfer data to GIF (VIF1) */
  45. #define VIF_CMD_DIRECT 0x50
  46. /** Transfer data to GIF but stall for Path 3 IMAGE mode (VIF1) */
  47. #define VIF_CMD_DIRECTHL 0x51
  48. #define PACK_VIFTAG(Q,W0,W1,W2,W3) \
  49. Q->sw[0] = (u32)(W0), \
  50. Q->sw[1] = (u32)(W1), \
  51. Q->sw[2] = (u32)(W2), \
  52. Q->sw[3] = (u32)(W3)
  53. /** Transfers data to the VU Mem */
  54. #define VIF_CMD_UNPACK(M,VN,VL) \
  55. (u32)((VL) & 0x00000003) << 0 | (u32)((VN) & 0x00000003) << 2 | \
  56. (u32)((M) & 0x00000001) << 4 | (u32)((3) & 0x00000003) << 5
  57. #define STCYCL_IMDT(CL,WL) \
  58. (u32)((CL) & 0x000000FF) << 0 | (u32)((WL) & 0x000000FF) << 8
  59. #define OFFSET_IMDT(OFFSET) \
  60. (u32)((OFFSET) & 0x000003FF)
  61. #define BASE_IMDT(BASE) \
  62. (u32)((BASE) & 0x000003FF)
  63. #define ITOP_IMDT(ADDR) \
  64. (u32)((ADDR) & 0x000003FF)
  65. #define STMOD_IMDT(MODE) \
  66. (u32)((MODE) & 0x00000003)
  67. #define MSKPATH3_IMDT(MASK) \
  68. (u32)((MASK) & 0x00000001) << 15
  69. #define MARK_IMDT(MARK) \
  70. (u32)((MARK) & 0x0000FFFF)
  71. #define MSCAL_IMDT(EXECADDR) \
  72. (u32)((EXECADDR) & 0x0000FFFF)
  73. #define MSCALF_IMDT(EXECADDR) \
  74. (u32)((EXECADDR) & 0x0000FFFF)
  75. #define MPG_IMDT(LOADADDR) \
  76. (u32)((LOADADDR) & 0x0000FFFF)
  77. #define MPG_NUM(SIZE) \
  78. (u32)((SIZE) & 0x000000FF) << 16
  79. #define DIRECT_IMDT(SIZE) \
  80. (u32)((SIZE) & 0x0000FFFF)
  81. #define DIRECTHL_IMDT(EXECADDR) \
  82. (u32)((EXECADDR) & 0x0000FFFF)
  83. #define UNPACK_IMDT(ADDR,USN,FLG) \
  84. (u32)((ADDR) & 0x000003FF) << 0 | (u32)((USN) & 0x00000001) << 14 | \
  85. (u32)((FLG) & 0x00000001) << 15
  86. #define UNPACK_NUM(SIZE) \
  87. (u32)((SIZE) & 0x000000FF) << 16
  88. #define VIF_CODE(IMDT,NUM,CMD,IRQ) \
  89. (u32)((IMDT) & 0x0000FFFF) << 0 | (u32)((NUM) & 0x000000FF) << 16 | \
  90. (u32)((CMD) & 0x000000FF) << 24 | (u32)((IRQ) & 0x00000001) << 31
  91. #endif /* __VIF_CODES_H__ */