s3c6410 DMA 实现(入门级)

char src[200] = "abcdefghigklmn123456\n";
 char dest[200] = "kkkk\n";

void dma_init(void)
{
 DMACConfiguration = 1;   //开总的DMA 使能
 DMACC7SrcAddr = (int)src;  //给源地址寄存器赋源地址
 DMACC7DestAddr = (int)dest;//给目标地址寄存器赋目的地址
 DMACC7Control0 = 0x0c000000;   //【26】【27】位置1,使源地址和目标地址在发送后递增
 DMACC7Control1 = 0x64;   //写入拷贝的size;
 DMACC7Configuration |= 1<<0;  //开channel7 DMA 
}

main()

{

dma_init();
 delay();
 my_puts("----------------\n");
 my_puts(src);
 my_puts(dest);

}

之后打印出的src和dest内容相同

6410手册中操作DMA的编程步骤:

Steps to program a DMA channel: 

1. Decide whether use secure DMAC(SDMAC) or general DMAC(DMAC). In order to use general DMAC,

disable secure DMA control register(SDMA_SEL) of system controller. (Reset value is SDMAC)

 

2. Select a free DMA channel with the priority needed. Where DMA channel 0 has the highest priority and DMA   

channel 7 the lowest priority.  

 

DMACCXCONFIGURATION

DMACC7Configuration  【0】位值1

 

3. Clear any pending interrupts on the channel to be used by writing to the DMACIntTCClr and DMACIntErrClr

registers. The previous channel operation might have left interrupts active.

4. Write the source address into the DMACCxSrcAddr register.

5. Write the destination address into the DMACCxDestAddr register.

 

6. Write the address of the next LLI into the DMACCxLLI register. If the transfer comprises of a single packet of

data then must be written into this register.

 

Offset Contents

Next LLI address Source Address for next transfer

Next LLI address + 0x04 Destination Address for next transfer

Next LLI address + 0x08 Next LLI address for next transfer

Next LLI address + 0x0C DMACCxControl0 data for next transfer

Next LLI address + 0x10 DMACCxControl1 data for next transfer

 

7. Write the control information into the DMACCxControl register.

 

DMACCxControl0

DMACCxControl1         transfer size

8. Write the channel configuration information into the DMACCxConfiguration register. If the Enable bit is set

then the DMA channel is automatically enabled.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值