📄 dma_config.c
字号:
/******************************************************************************/
//
// Name: BF533 DMA Setup
//
/******************************************************************************
File Name: DMA_Config.c
Special Connections: None
Purpose: The file sets up the DMA transfer
*********************************************************************************/
#include <cdefBF533.h>
#include "DMA_Config.h"
void Init_DMA(void)
{
unsigned char i=0;
// DMA Descriptor Array Mode Start Address
unsigned short *pDMA_DAMSA;
pDMA_DAMSA= (unsigned short *)0x00AA0000;
//DMA Descriptor Array write
for(i=0 ;i<25 ;i++)
{
// DMA Channel 0 Next Descriptor Pointer Register
pDMA_DAMSA[0+i*8] = (unsigned short)((i + 1) * 16);
//Target address of the DMA
//pDMA_DAMSA[1+i*8] = (unsigned short)((i * 414720)&0xFFFF);
//pDMA_DAMSA[2+i*8] = (unsigned short)(((i * 414720)&0xFFFF0000)>>16);
pDMA_DAMSA[1+i*8] = (unsigned short)((i * 414720)&0xFFFF);
pDMA_DAMSA[2+i*8] = (unsigned short)(((i * 414720)&0xFFFF0000)>>16);
//DMA Config: Enable DMA | Memory write DMA | Two Dim| Discard DMA FIFO before start | enable assertation of interrupt | NDSIZE for stop mode
//pDMA_DAMSA[3+i*7] = DMAEN | WNR | WDSIZE_32 | DMA2D | RESTART | DI_SEL | DI_EN | 0x0800 | 0xE000 ;
pDMA_DAMSA[3+i*8] = DMAEN | WNR | WDSIZE_16 | DMA2D | RESTART | DI_SEL | DI_EN | 0x0800 | 0x6000 ;
//RAM_Length 32bit transfers will be executed
pDMA_DAMSA[4+i*8] = RAMCOW_Length;
//The modifier is set to 4 because of the 32bit transfers
pDMA_DAMSA[5+i*8] = 0x2;
//RAM_Length 32bit transfers will be executed
pDMA_DAMSA[6+i*8] = RAMROW_Length;
//The modifier is set to 4 because of the 32bit transfers
pDMA_DAMSA[7+i*8] = 0x2;
}
// DMA Channel 0 (24) Descriptor Pointer Register
// pDMA_DAMSA[0+24*8] = (unsigned short)0x0;
/*------------------------------------------------*/
//Target address of the DMA
*pDMA0_START_ADDR = 0x0;
//RAM_Length 32bit transfers will be executed
*pDMA0_X_COUNT = RAMCOW_Length;
//The modifier is set to 4 because of the 32bit transfers
*pDMA0_X_MODIFY = 0x2;
//RAM_Length 32bit transfers will be executed
*pDMA0_Y_COUNT = RAMROW_Length;
//The modifier is set to 4 because of the 32bit transfers
*pDMA0_Y_MODIFY = 0x2;
// DMA Channel 0 Next Descriptor Pointer Register
*pDMA0_NEXT_DESC_PTR = (unsigned short *)0x00AA0000;
//PPI Peripheral is used
*pDMA0_PERIPHERAL_MAP = 0x0;
//DMA Config: Enable DMA | Memory write DMA | Two Dim| Discard DMA FIFO before start | enable assertation of interrupt | NDSIZE for stop mode
//*pDMA0_CONFIG = DMAEN | WNR | WDSIZE_32 | DMA2D | RESTART | DI_SEL | DI_EN |0x0800 |0xE000;
*pDMA0_CONFIG = DMAEN | WNR | WDSIZE_16 | DMA2D | RESTART | DI_SEL | DI_EN |0x0800 |0x6000;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -