#ifndef __SPS2_DMA_OPERATION_HEADERS__ #define __SPS2_DMA_OPERATION_HEADERS__ #include "dma_packets.h" #ifndef NULL #define NULL ((void *)0) #endif #define DMA_CHANNEL_VIF0 0x00 #define DMA_CHANNEL_VIF1 0x01 #define DMA_CHANNEL_GIF 0x02 #define DMA_CHANNEL_fromIPU 0x03 #define DMA_CHANNEL_toIPU 0x04 #define DMA_CHANNEL_fromSIF0 0x05 #define DMA_CHANNEL_toSIF1 0x06 #define DMA_CHANNEL_SIF2 0x07 #define DMA_CHANNEL_fromSPR 0x08 #define DMA_CHANNEL_toSPR 0x09 #define DMA_FLAG_TRANSFERTAG 0x01 #define DMA_FLAG_INTERRUPTSAFE 0x02 #ifdef __cplusplus extern "C" { #endif int dma_reset(void); /** Initializes the specified dma channel. */ int dma_channel_initialize( uint8_t channel, void *handler, uint32_t flags ); /** Enables dma fast waits for that channel */ static inline void dma_channel_fast_waits( uint8_t channel ){ /*DMA_REG_PCR*/ *((volatile uint32_t *)0x1000E020) |= ( 1 << channel ); }; /** Waits until channel is usable based on coprocessor status */ void dma_wait_fast(void); /** Wait until the specified dma channel is ready. */ int dma_channel_wait( uint8_t channel, uint32_t timeout ); /** * Send packet2. * Type chain/normal is choosen from packet2_t. * @param packet2 Pointer to packet. * @param channel DMA channel. * @param flush_cache Should be cache flushed before send? */ void dma_channel_send_packet2( packet2_t *packet2, uint8_t channel, uint8_t flush_cache ); /** Send a dmachain to the specified dma channel. */ int dma_channel_send_chain( uint8_t channel, void *data, uint32_t qwc, uint32_t flags, uint32_t spr ); /** Send a ucab dmachain to the specified dma channel. */ int dma_channel_send_chain_ucab( uint8_t channel, void *data, uint32_t qwc, uint32_t flags ); /** Send data to the specified dma channel. */ int dma_channel_send_normal( uint8_t channel, void *data, uint32_t qwc, uint32_t flags, uint32_t spr ); /** Send ucab data to the specified dma channel. */ int dma_channel_send_normal_ucab( uint8_t channel, void *data, uint32_t qwc, uint32_t flags ); /** Receive data from the specified dma channel. */ int dma_channel_receive_normal( uint8_t channel, void *data, uint32_t data_size, uint32_t flags, uint32_t spr ); /** Receive data from the specified dma channel. */ int dma_channel_receive_chain( uint8_t channel, void *data, uint32_t data_size, uint32_t flags, uint32_t spr ); /** Shut down the specified dma channel. */ int dma_channel_shutdown( uint8_t channel, uint32_t flags ); #ifdef __cplusplus } #endif #endif