Getting Started Tutorial
f
You can download dma_c2h_tutorial.c from the Nios II literature page.
The file is located next to this document ( Nios II C2H Compiler User
Guide) on the Altera Nios II literature page at http://www.altera.com/
literature/lit-nio2.jsp .
The file dma_c2h_tutorial.c includes two functions:
do_dma() – This is the function you accelerate. It performs a block
memory copy. do_dma() takes a source address pointer, a
destination address pointer, and an integer number of bytes to copy.
When implemented in hardware, do_dma() resembles DMA copy
logic. The prototype for do_dma() is as follows:
int do_dma( int * __restrict__ dest_ptr,
int * _ _restrict__ source_ptr, int length )
The _ _ restrict__ qualifier informs the compiler that the
pointers dest_ptr and source_ptr point to mutually exclusive
address ranges. For further information about the __restrict__
qualifier, see “Pointer Aliasing” on page 3–32 of Chapter 3, C-to-
Hardware Mapping Reference .
main() – main() calls do_dma() and measures the amount of time
taken, so that you can compare the software implementation with the
hardware accelerator.
main() performs the following actions:
1.
2.
3.
4.
5.
6.
Allocates two 1 MB buffers in main memory
Fills the source buffer with incrementing values
Fills destination buffer with all 0x0.
Calls the do_dma() function 100 times
Checks the copied data to ensure there were no errors
Frees the two allocated buffers
To measure the time it takes for the copy operations to complete, there are
timer routines around the loop that calls the do_dma() function. After
the application runs, the number of milliseconds that were spent
performing the copy operations is displayed to the Console view in the
Nios II IDE.
Set up the Hardware for the Project
To set up the hardware for the tutorial, perform the following steps:
1.
Connect your Nios development board to power, and connect the
board to your host computer with an Altera download cable.
Altera Corporation
November 2009
9.1
2–5
Nios II C2H Compiler User Guide
相关PDF资料
IPTR-DSPBUILDER DSP BUILDER SOFTWARE
IR11662SPBF IC CNTROL SMART RECTIFIER 8-SOIC
IR1166STRPBF IC MOSFET DRIVER N-CH 200V 8SOIC
IR11672ASPBF IC MOSFET DRIVER 200V 8-SOIC
IR1167ASTRPBF IC SMART SECONDARY DRIVER 8-SOIC
IR11682STRPBF IC MOSFET DRIVER DUAL 200V 8SOIC
IR1168SPBF IC MOSFET DRIVER DUAL 200V 8SOIC
IR1176STR IC DRIVER RECT SYNC 5V 4A 20SSOP
相关代理商/技术参数
IPT-DSPBUILDER 功能描述:开发软件 DSP Builder MATLAB SIMULINK RoHS:否 制造商:Atollic Inc. 产品:Compilers/Debuggers 用于:ARM7, ARM9, Cortex-A, Cortex-M, Cortex-R Processors
IPTE-75GF-1000-70D 制造商: 功能描述: 制造商:undefined 功能描述:
IPTG06A18-11SZC 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector with Backshell to Accommodate
IPTG06A18-11SZCPH16 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector
IPTG06A18-11SZCPHM18 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector
IPTG06A18-11SZCSR 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector
IPTG06ASE18-11SZ 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector
IPTG06E18-11SZC 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector