📄 main.asm
字号:
/*****************************************************************************
** **
** Name: MemDMA_descriptor.dpj **
** **
******************************************************************************
(C) Copyright 2003 - Analog Devices, Inc. All rights reserved.
File Name: main.asm
Date Modified: 3/5/03 RG Rev 1.0
Software: VisualDSP++3.1
Hardware: ADSP-BF533 EZ-KIT Board
Special Connections: None
Purpose: To demonstrate various memDMA descriptor examples
including 1D to 1D, 1D to 2D, and 2D to 2D
Program Parameters:
******************************************************************************/
#include "defBF533.h"
#define N 0x100 // number of elements to transfer in each DMA example
// Define extern functions
.extern memdma_init;
.extern activate_dma_engine;
.extern memdma_move1D;
.extern memdma_move1Dto2D;
.extern memdma_move2Dto2D;
// Set up input and output buffers in L1 data bank A
.section L1_data_a;
.align 4;
.global input_frame;
input_frame:
.byte _input_frame[N] = "input_data.dat"; // load in 256 values from a test file
input_frame.end:
.global output_frame_1Dto1D; // output buffer after 1D to 1D DMA
output_frame_1Dto1D:
.byte _output_frame_1Dto1D[N];
output_frame_1Dto1D.end:
.global output_frame_1Dto2D; // output buffer after 1D to 2D DMA
output_frame_1Dto2D:
.byte _output_frame_1Dto2D[N];
output_frame_1Dto2D.end:
.global output_frame_2Dto2D; // output buffer after 2D to 2D DMA
output_frame_2Dto2D:
.byte _output_frame_2Dto2D[N];
output_frame_2Dto2D.end:
.section L1_code;
.align 4;
.global _main;
_main:
call memdma_init; // setup descriptor framework
// In this example, there are up to 4 descriptor
// sets defined. Each descriptor has a source
// and destination buffer. The small descriptor model
// is used.
// In the following example, 3 descriptor sets are built.
// In each case, the data registers are used to store the following DMA info
// prior to making the setup call
//r0 -> src address
//r1 -> XCNT/XMOD
//r2 -> YCNT/YMOD
//r3 -> Dst Addr
r0.h = input_frame; //source address
r0.l = input_frame;
r1.l = N >> 2; //XCNT -> 100 bytes
r1.h = 4; //XMOD = 4bytes - 32bit xfers
// XMOD has to be at least 4 since 32-bit transfers are used
r3.h = output_frame_1Dto1D; //Destination Address for first descriptor
r3.l = output_frame_1Dto1D;
call memdma_move1D; //setup 1D to 1D L1->L1 descriptor
r0.h = input_frame; //source address
r0.l = input_frame;
r1.l = 0x0002; //D_XCNT -2 columns
r1.h = 0x0004; //D_XMOD = 4 bytes ( 32bit transfers)
r2.l = 0x0003; //YCNT -> 3 rows
r2.h = 0x0010; //YMOD - 16 bytes (produces a separation of 12 bytes (16-4) between each block)
r3.h = output_frame_1Dto2D; //Destination Address
r3.l = output_frame_1Dto2D;
call memdma_move1Dto2D; //setup 1D to 2D L1->L1 descriptor
r0.h = input_frame; //source address
r0.l = input_frame;
r1.l = 0x0002; //S and D_XCNT -2 columns;
r1.h = 0x0004; //S and D_XMOD = 4 bytes - 1 32bit element
r2.l = 0x0003; //S and D YCNT -> 2 rows;
r2.h = 0x0010; //S and D YMOD - 16 bytes
r3.h = output_frame_2Dto2D; //Destination Address
r3.l = output_frame_2Dto2D;
call memdma_move2Dto2D; //setup 2D to 2D L1->L1 descriptor
call activate_dma_engine; // start descriptor based DMA
// Open a memory window and look at the following labels to see the results of each DMA
// output_frame_1Dto1D
// output_frame_1Dto2D
// output_frame_2Dto2D:
here:
jump here; // Example done
_main.end:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -