阅读DMA Controller Core 官方手册
阅读DMA Controller Core 官方手册

DMA控制器框架图
怎样去设定一个DMA控制器

实例化DMA控制器
参数配置界面如下图所示:

对于width of the DMA length register的配置尝试如下:



正如官方文档中描述的那样:

DMA Length register的位宽决定了DMA Length的最大值,决定了可以用这个DMA控制器传递数据的个数。
DMA的工作模式:

搭建一个系统:
数据从ROM里面,经过DMA控制器传送到RAM里面,软件程序单独在RAM_Pro内存空间里面运行。

注意:片上ROM与片上RAM可以不与Nios II 处理器相连,这样会导致处理器监控不到ROM和RAM里面的数据,在Eclipse里面的debug界面中没法查找到相应的内存空间,但是连上处理器之后,可以查询得到,建议连上
顶层例化:
DMA控制器软件程序的编写:
需要根据用户手册来指导编写:



在Eclipse中编写代码如下:
/*
* "Hello World" example.
*
* This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
* the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
* designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
* device in your system's hardware.
* The memory footprint of this hosted application is ~69 kbytes by default
* using the standard reference design.
*
* For a reduced footprint version of this template, and an explanation of how
* to reduce the memory footprint for a given application, see the
* "small_hello_world" template.
*
*/ #include <stdio.h>
#include <stdlib.h>
#include "sys/alt_dma.h"
#include "system.h"
static volatile int rx_done = ;
static void done(void* handle, void* data)
{
rx_done++;
} int main(int argc, char* argv[], char* envp[])
{
int rc;
alt_dma_txchan txchan;
alt_dma_rxchan rxchan;
void* tx_data = (void*) 0x2000;
void* rx_data = (void*) 0x1000;
if((txchan = alt_dma_txchan_open("/dev/dma")) == NULL)
{
printf ("Failed to open transmit channel\n");
exit();
} if((rxchan = alt_dma_rxchan_open("/dev/dma")) == NULL)
{
printf ("Failed to open receive channel\n");
exit();
} if((rc = alt_dma_txchan_send(txchan,tx_data,,NULL,NULL)) < )
{
printf ("Failed to post transmit request,reason = %i\n",rc);
exit();
} if ((rc = alt_dma_rxchan_prepare(rxchan,rx_data,,NULL,NULL)) < )
{
printf ("Failed to post read request,reason = %i\n",rc);
exit();
} while(!rx_done)
{
printf ("Transfer successful!\n");
}
printf ("Hello from Nios II!\n");
return ;
}
由于数据存储在片上的ROM和RAM中,因此可以用In-System Memory Content Editor来进行查看:
首先给ROM初始化数据文件和Instance ID:

然后,同样需要给RAM分配Instance ID:

最后在In-System Memory Content Editor里面进行查看:

经过核对:数据传输无误。
阅读DMA Controller Core 官方手册的更多相关文章
- grub2详解(翻译和整理官方手册)
翻译了grub2官方手册的绝大部分内容,然后自己整理了一下.因为内容有点杂,所以章节安排上可能不是太合理,敬请谅解. 本文目录: 1.1 基础内容 1.2 安装grub2 1.3 grub2配置文件 ...
- 翻译:CREATE FUNCTION语句(已提交到MariaDB官方手册)
本文为mariadb官方手册:CREATE FUNCTION的译文. 原文:https://mariadb.com/kb/en/library/create-function/我提交到MariaDB官 ...
- Core官方DI剖析(1)--ServiceProvider类和ServiceCollection类
前段时间看了蒋老师的Core文章,对于DI那一块感觉挺有意思,然后就看了一下Core官方DI的源码,这也算是第一个看得懂大部分源码的框架,虽然官方DI相对来说特别简单, 官方DI相对于其它框架(例如 ...
- MariaDB官方手册翻译
MariaDB官方手册 翻译:create database语句(已提交到MariaDB官方手册) 翻译:rename table语句(已提交到MariaDB官方手册) 翻译:alter table语 ...
- 翻译:SET PASSWORD语句(已提交到MariaDB官方手册)
本文为mariadb官方手册:SET PASSWORD的译文. 原文:https://mariadb.com/kb/en/library/set-password/我提交到MariaDB官方手册的译文 ...
- XtraDB/InnoDB的文件格式(已提交到MariaDB官方手册)
本文为mariadb官方手册:XtraDB/InnoDB File Format的译文. 原文:https://mariadb.com/kb/en/library/xtradbinnodb-file- ...
- 翻译:SET Variable(已提交到MariaDB官方手册)
本文为mariadb官方手册:SET Variable的译文. 原文:https://mariadb.com/kb/en/set-variable/我提交到MariaDB官方手册的译文:https:/ ...
- 翻译:赋值操作符(:=)(已提交到MariaDB官方手册)
本文为mariadb官方手册:赋值操作符(:=)的译文. 原文:https://mariadb.com/kb/en/assignment-operator/ 我提交到MariaDB官方手册的译文:ht ...
- 翻译:last_value()函数(已提交到MariaDB官方手册)
本文为mariadb官方手册:LAST_VALUE()的译文. 原文:https://mariadb.com/kb/en/last_value/我提交到MariaDB官方手册的译文:https://m ...
随机推荐
- 解析XML技术
转载:http://developer.51cto.com/art/200903/117512.htm XML现在已经成为一种通用的数据交换格式,它的平台无关性,语言无关性,系统无关性,给数据集成与交 ...
- 启动apache 找不到 mbstring.dll
启动appserv时 提示 无法启动此程序 因为计算机中丢失php mbstring.dll 这种原因一般都是组件加载顺序引起的,在php.ini文件里确保 extension=php_mbstr ...
- Python 使用sqlalchemy操作MYSQL
1. 安装sqlalchemy库 SQL操作引擎可能需要pymysql,故要安装如下两个程序 pip install sqlalchemy pip instal pymysql
- python 实现 KNN 分类器——手写识别
1 算法概述 1.1 优劣 优点:进度高,对异常值不敏感,无数据输入假定 缺点:计算复杂度高,空间复杂度高 应用:主要用于文本分类,相似推荐 适用数据范围:数值型和标称型 1.2 算法伪代码 (1)计 ...
- JavaScript中的内置对象-8--3.Math-Math对象的方法-min()- max()- ceil() - floor()- round()- abs(); Math对象的random()方法;
JavaScript内置对象-3.Math(数值) 学习目标 1.掌握Math对象的方法: min() max() ceil() floor() round() abs() Math.min() 语法 ...
- threejs绘制顺序
renderer.sortObjects = false; 然后,scene.add(),就可以先add先画了,否则add的顺序和渲染出来的顺序不一定一致.
- socket模块粘包现象理解以及解决思路
粘包现象: 在socket网络程序中,TCP和UDP分别是面向连接和非面向连接的.因此TCP的socket编程,收发两端(客户端和服务器端)都要有成对的socket,因此,发送端为了将多个发往接收端的 ...
- 梯度下降法、牛顿法、高斯牛顿法、LM最优化算法
1.梯度下降法 2.牛顿法 3.高斯牛顿法 4.LM算法
- HDU 1425 sort C语言实现快速排序
AC代码:sort Time Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
- php基础-1
php规范 php文件以<?php开头,以?>结尾. php可以和html代码混写,若当前文件为纯php代码 ,则不用写php结尾 php的一行代码以";"(分号)结尾 ...