|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' j6 F. E% {1 U( k* P- [code]EDMA sample test application) B' ?/ P" `$ }' u# L
- /*
" e, X0 @& M8 A - * edma_test.c7 P% Q* `+ p5 Y# t* E1 H' ^( B
- *
* y3 U2 E! k3 ?- E0 P$ i7 o+ r - * brief EDMA3 Test Application2 {; F) y. b+ t B/ r* K+ H
- *
0 Q/ X( P. y3 _ G3 `' Z - * This file contains EDMA3 Test code.
3 r' @. r, W3 r# x* | - *
1 g( E# g5 J/ Y3 ~9 x0 ]& [5 s' Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ m4 s+ _9 A% y: V1 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: D h& G1 i: ^+ r. i9 X K
- * TO CHANGE.3 }8 \ y+ }/ O* N: D6 y J2 }
- */ E9 A4 K, l- ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 P2 r: |0 e1 z. p - *
* M7 ]( m1 M* ?0 C# H. I - * This program is free software; you can redistribute it and/or3 Q( i2 j# a* T6 Z/ Q- D( W
- * modify it under the terms of the GNU General Public License as
. O% M; _" ]( Q - * published by the Free Software Foundation version 2.' C( p/ H$ {; e$ `: X7 v4 m
- *
6 N, x- b6 Z/ r" ]- K+ a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 \: O: a8 H: y+ B, h" w - * kind, whether express or implied; without even the implied warranty2 H# e1 ~% ]$ K+ m: a* O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: U, t) ^6 g% }; \8 B
- * GNU General Public License for more details.7 z8 A, f" z& G% }- K, ~0 p1 d3 A
- */1 b0 o2 h: z! ]
- 3 T% T# u# ` _+ b
- #include <linux/module.h>
9 }& Z' F- u* y1 G. _ - #include <linux/init.h>
# v+ B- b) W0 r# l - #include <linux/errno.h>- L. r( Z5 k7 `( j' i" D
- #include <linux/types.h> M) a0 O5 ^) Y+ i3 w: o
- #include <linux/interrupt.h>
* T$ I9 \. t# T7 A* n* T1 }$ o ]5 c( C6 m - #include <asm/io.h>1 X5 L) x5 k" m: ]$ j: _) K
- #include <linux/moduleparam.h>
8 J" L9 z$ N9 |2 z8 Z8 X( l2 f7 B1 ] - #include <linux/sysctl.h>
! g* y0 p4 B( Y1 d. b - #include <linux/mm.h>
1 J x& s/ h, t, z - #include <linux/dma-mapping.h>
, l6 q% ]) Y1 Q3 P; ^ - . _! I* j7 |' q) _7 R h
- #include <mach/memory.h>3 k6 x F" i6 M
- #include <mach/hardware.h>/ _7 `2 A& c( j
- #include <mach/irqs.h>
( i9 a0 g: e, _/ ]. C$ r6 _ T - #include <asm/hardware/edma.h>
: {" V$ q# c7 K* {/ _ - " M! n3 O! p S i& ?
- #undef EDMA3_DEBUG
1 Q% i C# `: b) f- B - /*#define EDMA3_DEBUG*/
' ~( _4 J& n6 W7 W; E - - I' I: G o, J2 ^$ d9 c
- #ifdef EDMA3_DEBUG: I& K: f1 z% `% j# Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ M& E }; l! W$ e' L2 N% _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 X2 a: O- E. }* v% R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M; e }4 s" Y M& ?4 c
- #else
* p$ C+ u2 W6 }+ E( T8 }) i% y- K - #define DMA_PRINTK( x... )
" M9 I# w2 Y1 s0 r @0 W - #define DMA_FN_IN- K4 `/ \( @$ T5 t
- #define DMA_FN_OUT) T: U- V, t2 e% _' C4 @4 G
- #endif$ Y5 T0 H! e; o
6 R; B( V2 N: `; [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: p* ?$ P6 Y! o3 k/ N _ - #define STATIC_SHIFT 3
: S8 h9 f2 B/ h0 c' C8 o1 t - #define TCINTEN_SHIFT 20
1 p7 z5 T' y0 l9 k5 W& u - #define ITCINTEN_SHIFT 218 `. l% z* {. n( C5 \
- #define TCCHEN_SHIFT 22
. |# L0 F) P3 e" O - #define ITCCHEN_SHIFT 23
3 w4 T J$ G' l# p; u; w4 k - $ e4 K$ z# y9 c; V, L% ^. k; o4 t( K
- static volatile int irqraised1 = 0;* T* ~; m3 R1 F- _4 @0 x0 r( [
- static volatile int irqraised2 = 0;
9 K, o$ V$ ^7 Z. d& A; N) T: { - 8 r4 |0 ]: M9 `1 I, d; s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q [4 j8 ]; s( o) f* I% s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ c7 [) U8 I' q2 I4 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O ^) t% U$ G; z
- ( [$ M; C( w* N9 k6 n+ a7 d
- dma_addr_t dmaphyssrc1 = 0;5 E/ I/ V) b) M
- dma_addr_t dmaphyssrc2 = 0;
4 x3 l( H* |; d6 f2 X, T" ] - dma_addr_t dmaphysdest1 = 0;
$ W |0 |" k5 \4 H+ _2 M - dma_addr_t dmaphysdest2 = 0;- W+ S7 a1 z, y) @- ~
- ( U0 c7 e$ p( `6 F5 r
- char *dmabufsrc1 = NULL;1 p9 N7 J& J$ f6 W6 m) x! F4 a& c- @
- char *dmabufsrc2 = NULL;4 s; H# v5 N ~* |3 V( E: B) D4 C
- char *dmabufdest1 = NULL;% b, W5 \' e; @; b6 c
- char *dmabufdest2 = NULL;
& h( |) a! ~: i l. E6 T, U. f) x# Y
& Z$ e8 f) |2 q3 A; u" N- static int acnt = 512;
! T: o+ b5 i& D8 Y' f9 k* I - static int bcnt = 8;4 Q; d" D" I# t: ?- A
- static int ccnt = 8;
O5 X5 V1 A" o/ m9 {( L0 {
& A7 u2 g8 B. w) p& P/ C6 N; v- module_param(acnt, int, S_IRUGO);2 f% U1 G( C5 {: z% E( k
- module_param(bcnt, int, S_IRUGO);$ W7 A! H. F1 g4 _% A
- module_param(ccnt, int, S_IRUGO);
复制代码
6 o' }8 i" P: m% j& k" K1 a6 l
/ [" X' Q) ?$ I1 F P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F; J. j+ w" w8 t! c9 a
arm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Q8 w. ^* W/ E( g7 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ t6 z7 b+ X5 ?* ^
2 o* t/ ~* x( g5 S; V1 w2 ~; J1 V4 R, r
|
|