阅读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 ...
随机推荐
- express框架以及配置项
以上命令会将 Express 框架安装在当前目录的 node_modules 目录中, node_modules 目录下会自动创建 express 目录.以下几个重要的模块是需要与 express 框 ...
- 使用golang编写prometheus metrics exporter
metrcis输出 collector.go package main import ( "github.com/prometheus/client_golang/prometheus&qu ...
- AMAZON数据集
http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/
- awr脚本使用dump导出导入
实际工作中,存在这么一种场景.客户现场分析问题,无法立即得出结论,且无法远程服务器,因此对于服务器中的awr信息,如何提取是一个问题,oracle有脚本可以对服务器中以db为单位导出awr基表的dum ...
- 【Leetcode】292. Nim Game
problem 292. Nim Game solution class Solution { public: bool canWinNim(int n) { ; } }; 来generalize一下 ...
- tflearn weights获取与存储
参考: http://tflearn.org/examples/
- xdoj-1298(模拟--简易SQL解释器)
题目链接 一 知识点: 1 substr有2种用法: 假设:string s = "0123456789"; string sub1 = s.substr( ...
- 启动tomcat报错:Failed to start component [StandardEngine[Catalina].StandardHost[localhost]
1.右键点击需要启动的tomcat,选择Clean和Clean Tomcat Work Directory,清除即可!
- Manjaro启动项目及服务配置备忘
Manjaro启动项目及服务配置备忘 =============== 系统服务GUI管理搜索 systemdgenie 并安装,类似Windows的服务管理. ================ 系统启 ...
- stack 的一些用法
#include<bits/stdc++.h> using namespace std; int32_t main() { stack<int> st; st.push(); ...