关于NIOS II的DMA controller
来源:互联网 发布:用java输出正方形 编辑:程序博客网 时间:2024/06/07 01:28
不过,请人帮忙调通了API版的DMA,但是8bit和16bit的可以进行DMA传输,32bit的传输不成功~
#include <stdio.h>
#include <stdlib.h>
#include "sys/alt_dma.h"
#include "system.h"
static volatile int rx_done = 0;
void done (void* handle, void* data)
{
rx_done++;
}
void delay(int ms)
{
while(ms--);
}
int main (int argc, char* argv[], char* envp[])
{
int rc,i,k = 0, m = 0;
alt_dma_txchan txchan;
alt_dma_rxchan rxchan;
void* tx_data = (void*) alt_uncached_malloc(1000);
void* rx_buffer = (void*)alt_uncached_malloc(1000);
memset(rx_buffer,0,1000);
for(i = 0;i<1000;i++)
{
((unsigned char*)tx_data)[i]= i;
}
if ((txchan = alt_dma_txchan_open("/dev/dma")) ==NULL)
{
printf ("Failed to open transmit channel\n");
exit (1);
}
if ((rxchan = alt_dma_rxchan_open("/dev/dma")) ==NULL)
{
printf ("Failed to open receive channel\n");
exit (1);
}
if(alt_dma_txchan_ioctl(txchan,ALT_DMA_SET_MODE_8,NULL)<0)
{
printf ("Failed to ioctrl transmit channel\n");
exit (1);
}
if(alt_dma_rxchan_ioctl(rxchan,ALT_DMA_SET_MODE_8,NULL)<0)
{
printf ("Failed to ioctrl transmit channel\n");
exit (1);
}
if ((rc = alt_dma_txchan_send (txchan,
tx_data,
128,
NULL,
NULL)) < 0)
{
printf ("Failed to post transmit request, reason = %i\n",rc);
exit (1);
}
if ((rc = alt_dma_rxchan_prepare (rxchan,
rx_buffer,
128,
done,
NULL)) < 0)
{
printf ("Failed to post read request, reason = %i\n",rc);
exit (1);
}
while(1)
{
k =rx_done;
if(k ==1)
break;
m++;
}
printf ("Transfer successful! %d\n",m);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include "sys/alt_dma.h"
#include "system.h"
static volatile int rx_done = 0;
void done (void* handle, void* data)
{
rx_done++;
}
void delay(int ms)
{
}
int main (int argc, char* argv[], char* envp[])
{
int rc,i,k = 0, m = 0;
alt_dma_txchan txchan;
alt_dma_rxchan rxchan;
void* tx_data = (void*) alt_uncached_malloc(1000);
void* rx_buffer = (void*)alt_uncached_malloc(1000);
memset(rx_buffer,0,1000);
for(i = 0;i<1000;i++)
{
}
if ((txchan = alt_dma_txchan_open("/dev/dma")) ==NULL)
{
printf ("Failed to open transmit channel\n");
exit (1);
}
if ((rxchan = alt_dma_rxchan_open("/dev/dma")) ==NULL)
{
printf ("Failed to open receive channel\n");
exit (1);
}
if(alt_dma_txchan_ioctl(txchan,ALT_DMA_SET_MODE_8,NULL)<0)
{
printf ("Failed to ioctrl transmit channel\n");
exit (1);
}
if(alt_dma_rxchan_ioctl(rxchan,ALT_DMA_SET_MODE_8,NULL)<0)
{
printf ("Failed to ioctrl transmit channel\n");
exit (1);
}
if ((rc = alt_dma_txchan_send (txchan,
tx_data,
128,
NULL,
NULL)) < 0)
{
printf ("Failed to post transmit request, reason = %i\n",rc);
exit (1);
}
if ((rc = alt_dma_rxchan_prepare (rxchan,
rx_buffer,
128,
done,
NULL)) < 0)
{
printf ("Failed to post read request, reason = %i\n",rc);
exit (1);
}
while(1)
{
}
printf ("Transfer successful! %d\n",m);
return 0;
}
0 0
- 关于NIOS II的DMA controller
- Nios II Step By Step 3--Nios II …
- Nios II的Boot过程分析(转载)
- Nios II中DMA设备的使用
- 基于Nios II的DMA传输
- Nios II 中的DMA
- Nios II中的DMA传输
- NIOS II常见编译问题解…
- View Controller 生命周期的…
- View Controller 生命周期的…
- 关于 YII 学习 的文章 连接
- 快速获得Altera NIOS技术支持的方法
- c++ 关于char *的…
- DMA 使用基本配置
- STM32 DMA使用详解
- 关于NIOS II IDE 编译速度的问题
- 关于Nios II中Verify failed错误的解决方法
- 关于alter system switch lo…
- 很久以前
- 妈妈的哲学
- 四月物语
- SRAM与SDRAM的比较(转自CSDN)
- NIOS中各程序存储器的关系
- 关于NIOS II的DMA controller
- 但不愿再参与漫长重建
- Nios II Step By Step 3--Nios II …
- Nios II的Boot过程分析(转载)
- FPGA中跨时钟域的信号处理--异步FI…
- 异步fifo的verilog代码
- sprintf函数的用法
- FPGA EPCS烧写及NiosII Flas…
- EP3C25的EPCS_controller引脚配置…