資源簡介
sg-dma dma傳輸在nios中實(shí)現(xiàn)。

代碼片段和文件信息
#include?“stdio.h“
#include?“stdlib.h“
#include?“io.h“
#include?“alt_types.h“
#include?“altera_avalon_sgdma.h“
#include?“sys/alt_cache.h“
/**********************************************************************************
?*?This?function?is?responsible?for?allocating?the?data?buffer?for?each???????????*
?*?descriptor.?A?random?buffer?length?will?be?generated?if?you?set?the?minimum????*
?*?and?maximum?buffer?lengths?to?be?different.?To?run?a?more?controlled?test?set?*
?*?the?minimum?and?maximum?buffer?lengths?to?be?equal.????????????????????????????*
?*????????????????????????????????????????????????????????????????????????????????*
?*?Returns?0?for?sucess?1?for?failure.???????????????????????????????????????????*
?**********************************************************************************/
alt_u32?create_test_data(alt_sgdma_descriptor?*?transmit_descriptors
??????????????????????alt_sgdma_descriptor?*?receive_descriptors
??????????????????????alt_u32?number_of_buffers
??????????????????????alt_u32?minimum_buffer_length
??????????????????????alt_u32?maximum_buffer_length)
{
??alt_u32?buffer_counter?contents_counter?temp_length;
??alt_u32?*transmit_ptr?*receive_ptr;
??alt_u8?*transmit_ptr_copy?*receive_ptr_copy;??//?will?use?these?to?fill?up?the?tx?buffers?and?clear?the?rx?buffers
??alt_u32?temp_data?=?0;??
??/*??Initialization?of?the?buffer?memories?and?the?transmit+receive?descriptors?*/
??for(buffer_counter?=?0;?buffer_counter???{
????/*??Generate?a?random?buffer?length?between?within?MINIMUM_BUFFER_LENGTH?and?MAXIMUM_BUFFER_LENGTH?*/
????if(minimum_buffer_length?==?maximum_buffer_length)??//?if?you?don‘t?want?a?random?length?set?these?equal
????{??
??????temp_length?=?minimum_buffer_length;
????}
????else
????{
??????if(minimum_buffer_length?>?maximum_buffer_length)
??????{
?????????printf(“Please?set?the?maximum?buffer?length?to?be?larger?than\n“);
?????????printf(“the?minimum?buffer?length?(in?includes_and_settigns.h)\n“);
?????????return?1;
??????}
??????temp_length?=?(rand()?%?(maximum_buffer_length?-?minimum_buffer_length))?+?minimum_buffer_length;??????
????}
????
????
????transmit_ptr?=?(alt_u32?*)malloc(temp_length);??//?this?descriptor?will?point?at?a?buffer?of?length?(temp_length)
????if(transmit_ptr?==?NULL)
????{
??????printf(“Allocating?a?transmit?buffer?region?failed\n“);
??????return?1;?
????}
????receive_ptr?=?(alt_u32?*)malloc(temp_length);??//?since?the?same?contents?will?be?received?the?length?is?the?same
????if(receive_ptr?==?NULL)
????{
??????printf(“Allocating?a?receive?buffer?region?failed\n“);
??????return?1;?
????}
????/*?This?will?populate?sequential?data?(modulo?256)?in?each?transmit?buffer?a?byte?at?a?time.
?????*?The?recieve?buffers?are?also?cleared?with?zeros?so?that?each?time?this?software?is?run
?????*?the?data?can?be?reverified.??Before?this?function?returns?a?flush?will?be?performed?t
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\
?????文件????????3351??2007-05-02?13:19??SG-DMA\7_1\CycloneII\readme.txt
?????文件?????????910??2007-02-27?18:58??SG-DMA\7_1\CycloneII\SG-DMA.qpf
?????文件???????12395??2007-05-02?14:00??SG-DMA\7_1\CycloneII\SG-DMA.qsf
?????文件??????841106??2007-05-01?13:10??SG-DMA\7_1\CycloneII\SG-DMA.sof
?????文件????????3100??2007-03-12?08:31??SG-DMA\7_1\CycloneII\SGDMA_Design.bsf
?????文件??????134570??2007-05-01?13:03??SG-DMA\7_1\CycloneII\SGDMA_Design.ptf
?????文件???????36049??2007-05-01?13:02??SG-DMA\7_1\CycloneII\SGDMA_Design.sopc
?????文件???????15702??2007-05-01?11:14??SG-DMA\7_1\CycloneII\SG_DMA.bdf
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\software\
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\
?????文件????????1848??2007-04-30?15:27??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.cdtbuild
?????文件????????2761??2007-05-01?11:09??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.cdtproject
?????文件????????2948??2007-03-29?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.project
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.settings\
?????文件?????????106??2007-03-29?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.settings\org.eclipse.cdt.core.prefs
?????文件?????????414??2007-04-30?15:27??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\.settings\org.eclipse.cdt.managedbuilder.core.prefs
?????文件?????????137??2007-03-29?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\application.stf
?????文件????????7627??2007-05-01?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\create_test_data.c
?????文件????????6551??2007-04-11?18:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\desc
?????文件????????1536??2007-05-01?11:08??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\includes_and_settings.h
?????文件???????10606??2007-04-30?15:21??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\main.c
?????文件?????????646??2007-03-29?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\readme.txt
?????文件????????4493??2007-05-01?11:08??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE\validate_results.c
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\
?????文件????????1822??2007-03-29?11:06??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\.cdtbuild
?????文件????????2551??2007-05-01?11:09??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\.cdtproject
?????文件????????4583??2007-04-27?15:20??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\.project
?????目錄???????????0??2008-12-11?10:10??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\.settings\
?????文件?????????106??2007-03-29?11:07??SG-DMA\7_1\CycloneII\software\SGDMA_SOFTWARE_syslib\.settings\org.eclipse.cdt.core.prefs
............此處省略106個文件信息
- 上一篇:linux學(xué)習(xí)資料(收集了很久)
- 下一篇:繞過趨勢殺毒卸載密碼
評論
共有 條評論