📄 dma_init.c
字号:
#include <cdefBF533.h>
#include <plx9054_bf533_test.h>
extern unsigned short *pWrite;
//////////////////////////////////////////////////////////
// parameter : Addr -- DMA Sdram Sdram Addr
// FPGA addr and the Length is static
//
//////////////////////////////////////////////////////////
void SdramDMAFPGA(unsigned long Addr)
{
*pMDMA_S1_START_ADDR = Addr;
*pMDMA_S1_CONFIG |= DMA_EN;
*pMDMA_D1_CONFIG |= DMA_EN;
}
void L1DMASdram(unsigned long SAddr,unsigned long DAddr)
{
*pMDMA_S0_START_ADDR = SAddr;
*pMDMA_D0_START_ADDR = DAddr;
*pMDMA_S0_CONFIG |= DMA_EN;
*pMDMA_D0_CONFIG |= DMA_EN;
}
void Init_DMA(void)
{
/* //Target address of the DMA
*pDMA0_START_ADDR = 0x0;
//RAM_Length 32bit transfers will be executed
*pDMA0_X_COUNT = RAM_Length;
//The modifier is set to 2 because of the 16bit transfers
*pDMA0_X_MODIFY = 0x2;
//PPI Peripheral is used
*pDMA0_PERIPHERAL_MAP = 0x0;
*/
//Mem DMA is used
// Mem DMA can not be reassignable ,why set the default value to it ?
*pMDMA_D1_PERIPHERAL_MAP = 0x0040;
*pMDMA_S1_PERIPHERAL_MAP = 0x0040;
// Configure MDMA0
// 16-bit transfers, Interrupt on completion, Autobuffer mode
//DMA Config: Memory write DMA | enable assertation of interrupt | NDSIZE for stop mode | Enable STOP DMA
*pMDMA_D1_CONFIG = WNR | WDSIZE_16 | DI_EN ;//| FLOW_1;
// Start address of data buffer
*pMDMA_D1_START_ADDR = pWrite;
// DMA inner loop count
*pMDMA_D1_X_COUNT = 4096;
// Inner loop address increment
*pMDMA_D1_X_MODIFY = 2;
//DMA Config: enable assertation of interrupt | NDSIZE for stop mode | Enable STOP DMA
*pMDMA_S1_CONFIG = WDSIZE_16 | DI_EN ;//| FLOW_1;
// Start address of data buffer
//*pMDMA_S0_START_ADDR is empty
// DMA inner loop count
*pMDMA_S1_X_COUNT = 4096;
// Inner loop address increment
*pMDMA_S1_X_MODIFY = 2;
*pMDMA_D0_PERIPHERAL_MAP = 0x0040;
*pMDMA_S0_PERIPHERAL_MAP = 0x0040;
// Configure MDMA0
// 16-bit transfers, Interrupt on completion, Autobuffer mode
//DMA Config: Memory write DMA | enable assertation of interrupt | NDSIZE for stop mode | Enable STOP DMA
*pMDMA_D0_CONFIG = WNR | WDSIZE_16 | DI_EN ;//| FLOW_1;
// Start address of data buffer
//*pMDMA_D0_START_ADDR = pWrite;
// DMA inner loop count
*pMDMA_D0_X_COUNT = 4096;
// Inner loop address increment
*pMDMA_D0_X_MODIFY = 2;
//DMA Config: enable assertation of interrupt | NDSIZE for stop mode | Enable STOP DMA
*pMDMA_S0_CONFIG = WDSIZE_16 | DI_EN ;//| FLOW_1;
// Start address of data buffer
//*pMDMA_S0_START_ADDR is empty
// DMA inner loop count
*pMDMA_S0_X_COUNT = 4096;
// Inner loop address increment
*pMDMA_S0_X_MODIFY = 2;
}//end Init_DMA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -