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.

78 lines
2.5 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SPS2_DMA_OPERATION_HEADERS__
  2. #define __SPS2_DMA_OPERATION_HEADERS__
  3. #include "dma_packets.h"
  4. #ifndef NULL
  5. #define NULL ((void *)0)
  6. #endif
  7. #define DMA_CHANNEL_VIF0 0x00
  8. #define DMA_CHANNEL_VIF1 0x01
  9. #define DMA_CHANNEL_GIF 0x02
  10. #define DMA_CHANNEL_fromIPU 0x03
  11. #define DMA_CHANNEL_toIPU 0x04
  12. #define DMA_CHANNEL_fromSIF0 0x05
  13. #define DMA_CHANNEL_toSIF1 0x06
  14. #define DMA_CHANNEL_SIF2 0x07
  15. #define DMA_CHANNEL_fromSPR 0x08
  16. #define DMA_CHANNEL_toSPR 0x09
  17. #define DMA_FLAG_TRANSFERTAG 0x01
  18. #define DMA_FLAG_INTERRUPTSAFE 0x02
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. int dma_reset(void);
  23. /** Initializes the specified dma channel. */
  24. int dma_channel_initialize( uint8_t channel, void *handler, uint32_t flags );
  25. /** Enables dma fast waits for that channel */
  26. static inline void dma_channel_fast_waits( uint8_t channel ){ /*DMA_REG_PCR*/ *((volatile uint32_t *)0x1000E020) |= ( 1 << channel ); };
  27. /** Waits until channel is usable based on coprocessor status */
  28. void dma_wait_fast(void);
  29. /** Wait until the specified dma channel is ready. */
  30. int dma_channel_wait( uint8_t channel, uint32_t timeout );
  31. /**
  32. * Send packet2.
  33. * Type chain/normal is choosen from packet2_t.
  34. * @param packet2 Pointer to packet.
  35. * @param channel DMA channel.
  36. * @param flush_cache Should be cache flushed before send?
  37. */
  38. void dma_channel_send_packet2( packet2_t *packet2, uint8_t channel, uint8_t flush_cache );
  39. /** Send a dmachain to the specified dma channel. */
  40. int dma_channel_send_chain( uint8_t channel, void *data, uint32_t qwc, uint32_t flags, uint32_t spr );
  41. /** Send a ucab dmachain to the specified dma channel. */
  42. int dma_channel_send_chain_ucab( uint8_t channel, void *data, uint32_t qwc, uint32_t flags );
  43. /** Send data to the specified dma channel. */
  44. int dma_channel_send_normal( uint8_t channel, void *data, uint32_t qwc, uint32_t flags, uint32_t spr );
  45. /** Send ucab data to the specified dma channel. */
  46. int dma_channel_send_normal_ucab( uint8_t channel, void *data, uint32_t qwc, uint32_t flags );
  47. /** Receive data from the specified dma channel. */
  48. int dma_channel_receive_normal( uint8_t channel, void *data, uint32_t data_size, uint32_t flags, uint32_t spr );
  49. /** Receive data from the specified dma channel. */
  50. int dma_channel_receive_chain( uint8_t channel, void *data, uint32_t data_size, uint32_t flags, uint32_t spr );
  51. /** Shut down the specified dma channel. */
  52. int dma_channel_shutdown( uint8_t channel, uint32_t flags );
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif