📄 dma_example.txt
字号:
/****************************************Copyright (c)****************************************************
** Guangzhou ZHIYUAN electronics Co.,LTD.
**
** http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name: main.c
** Latest modified Date: 2008-8-18
** Latest Version: 1.0
** Descriptions: 用户程序主文件
**
**--------------------------------------------------------------------------------------------------------
** Created by: CaiWenqi
** Created date: 2008-8-18
** Version: 1.0
** Descriptions: The original version
**
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
*********************************************************************************************************/
#include "config.h"
/*********************************************************************************************************
** Function name: sysDelay
** Descriptions: 主程序
** Input parameters: uiT 数值越大,延时越长
** Output parameters: NONE
** Returned value: NONE
*********************************************************************************************************/
void sysDelay(uint16 uiT)
{
uint16 i,j;
for(j = 0; j < uiT; j++)
for(i = 0; i < 0x0fff; i++);
}
/*********************************************************************************************************
** Function name: main
** Descriptions: 主程序
** Input parameters: NONE
** Output parameters: NONE
** Returned value: NONE
*********************************************************************************************************/
void main(void)
{
CreatDescLMode a1,a2,a3;
char *str1 = "/************************/\n";
char *str2 = "/* BeiJing huanying ni! */\n";
char *str3 = "/**********OVER**********/\n";
uartConfig(9600, 8, 1, PARITY_DIS);
*pUART_IER |= 0x0007;
ssync();
//uartSendStr("System Runing...\n");
a1.uiNextDescPtr = (uint32)&a2;
a1.uiStartAddr = (uint32)(str1);
a1.ucDmaConfig = 0x0001|(7<<12)|(7<<8);
a1.ucXCount = strlen(str1);
a1.ucXModify = 1;
a2.uiNextDescPtr = (uint32)&a3;
a2.uiStartAddr = (uint32)(str2);
a2.ucDmaConfig = 0x0001|(7<<12)|(7<<8);
a2.ucXCount = strlen(str2);
a2.ucXModify = 1;
a3.uiNextDescPtr = 0;
a3.uiStartAddr = (uint32)(str3);
a3.ucDmaConfig = 0x0001;
a3.ucXCount = strlen(str3);
a3.ucXModify = 1;
//*pDMA7_PERIPHERAL_MAP = 0;
ssync();
*pDMA7_PERIPHERAL_MAP = 7 << 12; //配置外设映射
ssync();
*pDMA7_NEXT_DESC_PTR = (&a1);
ssync();
*pDMA7_CONFIG = 0x0001|(7<<12)|(7<<8)|(1<<5); //启动传输
ssync();
//uartSendStr("Setup Successfully!\n");
while(1)
{
}
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -