//------------------------------------------------------------------------------ /// Configure the DMA transfer buffer by giving transfer mode, it could be single /// buffer or multi-buffer(LLI/auto-reload/contiguous buffers) with or without /// Picture-In-Picture mode. /// \param channel Particular channel number. /// \param sourceTransferMode Source buffer transfer mode. /// \param destTransferMode Destination buffer transfer mode. /// \param lli Pointer to a DmaLinkList structure instance. /// \param pip Pointer to a PictureInPicture structure. //------------------------------------------------------------------------------ U8 DMAD_Configure_Buffer(U8 channel, U8 sourceTransferMode, U8 destTransferMode, DmaLinkList *lli, PictureInPicture *pip) { DmaTransfer *pTransfer = &(dmad.transfers[channel]); if(pTransfer-> transferSize > 0) // Check that no transfer is pending on the channel { DEBUG_MSG("DAM transfer is already pending"); return DMAD_ERROR_BUSY; } DMA_SetSourceBufferMode(channel, sourceTransferMode, 0); // Configure source transfer mode. DMA_SetDestBufferMode(channel, destTransferMode, 0); // Configure destination transfer mode. if(lli) { DMA_SetDescriptorAddr(channel, (U32)(&lli[0])); } else { DMA_SetDescriptorAddr(channel, 0); } if(pip) { if(pip->pipSourceBoundarySize)// If source picture-in-picture mode is enabled, program the DMAC_SPIP. { DMA_SPIPconfig(channel, pip->pipSourceHoleSize, pip->pipSourceBoundarySize); // If destination picture-in-picture mode is enabled, program the DMAC_DPIP. } if(pip->pipDestBoundarySize) { DMA_DPIPconfig(channel, pip->pipDestHoleSize, pip->pipDestBoundarySize); } } return 0; }
//------------------------------------------------------------------------------ /// Configure the DMA transfer buffer by giving transfer mode, it could be single /// buffer or multi-buffer(LLI/auto-reload/contiguous buffers) with or without /// Picture-In-Picture mode. /// \param dwChannel Particular dwChannel number. /// \param sourceTransferMode Source buffer transfer mode. /// \param destTransferMode Destination buffer transfer mode. /// \param lli Pointer to a DmaLinkList structure instance. /// \param pip Pointer to a PictureInPicture structure. //------------------------------------------------------------------------------ extern uint32_t DMAD_Configure_Buffer( uint32_t dwChannel, uint32_t sourceTransferMode, uint32_t destTransferMode, DmaLinkList *lli ) { DmaTransfer *pTransfer = &(dmad.transfers[dwChannel]) ; // Check that no transfer is pending on the dwChannel if ( pTransfer-> transferSize > 0 ) { TRACE_ERROR("DAM transfer is already pending\n\r"); return DMAD_ERROR_BUSY ; } // Configure source transfer mode. DMA_SetSourceBufferMode( DMAC, dwChannel, sourceTransferMode, 0 ) ; // Configure destination transfer mode. DMA_SetDestBufferMode( DMAC, dwChannel, destTransferMode, 0 ) ; if ( lli ) { DMA_SetDescriptorAddr( DMAC, dwChannel, (uint32_t)(&lli[0]) ) ; } else { DMA_SetDescriptorAddr( DMAC, dwChannel, 0 ) ; } return 0 ; }
//------------------------------------------------------------------------------ /// Configure the DMA transfer buffer by giving transfer mode, it could be single /// buffer or multi-buffer(LLI/auto-reload/contiguous buffers) with or without /// Picture-In-Picture mode. /// \param channel Particular channel number. /// \param sourceTransferMode Source buffer transfer mode. /// \param destTransferMode Destination buffer transfer mode. /// \param lli Pointer to a DmaLinkList structure instance. /// \param pip Pointer to a PictureInPicture structure. //------------------------------------------------------------------------------ unsigned char DMAD_Configure_Buffer(unsigned char channel, unsigned char sourceTransferMode, unsigned char destTransferMode, DmaLinkList *lli, PictureInPicture *pip) { DmaTransfer *pTransfer = &(dmad.transfers[channel]); // Check that no transfer is pending on the channel if (pTransfer-> transferSize > 0 ) { TRACE_ERROR("DAM transfer is already pending\n\r"); return DMAD_ERROR_BUSY; } // Configure source transfer mode. DMA_SetSourceBufferMode(channel, sourceTransferMode, 0); // Configure destination transfer mode. DMA_SetDestBufferMode(channel, destTransferMode, 0); if(lli){ DMA_SetDescriptorAddr(channel, (unsigned int)(&lli[0])); } else { DMA_SetDescriptorAddr(channel, 0); } if(pip){ #if defined(AT91C_SRC_PIP) // If source picture-in-picture mode is enabled, program the DMAC_SPIP. if(pip->pipSourceBoundarySize){ // If destination picture-in-picture mode is enabled, program the DMAC_DPIP. DMA_SPIPconfiguration(channel, pip->pipSourceHoleSize, pip->pipSourceBoundarySize); } #endif #if defined(AT91C_DST_PIP) if(pip->pipDestBoundarySize){ DMA_DPIPconfiguration(channel, pip->pipDestHoleSize, pip->pipDestBoundarySize); } #endif } return 0; }