|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 p M1 N4 ?' e) z4 q3 Q3 M. Y: v! ~
- [code]EDMA sample test application1 W" H4 O3 t! O% n- ?( L/ ]$ r
- /*: s" D5 z; [8 w4 z l8 U3 N% b# H
- * edma_test.c
) d0 F! z9 Q3 q6 L7 X" _% p$ y1 m - *4 U5 J8 A, L4 [: ], d2 Y0 |. L
- * brief EDMA3 Test Application7 D3 M( `$ v$ ?
- *) E# n: l! e1 i7 u K6 O2 o: q
- * This file contains EDMA3 Test code.
% `; ^) F" J) l- Z" [& m - *. ?+ Q5 h# o" D& n8 O0 P2 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; c" e' \7 I$ V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% m3 q' m7 y/ \4 {* \0 J. E - * TO CHANGE.
- o- o4 U6 T$ r; Z; X( J1 z - *
, `3 z9 }3 R# Q' p. D$ X& R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 L# }3 T6 E9 ]7 f# i$ } - *' ]# e9 N; [/ g+ e
- * This program is free software; you can redistribute it and/or
/ {$ V: J; q0 o: F$ k8 e9 D' } - * modify it under the terms of the GNU General Public License as
; S+ x( ^2 c2 U- v - * published by the Free Software Foundation version 2.
@8 ?- X5 s6 W" b) v% a0 @ - *) v" I7 q4 V: M/ h. d4 x1 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ Q) W% \: T) _# c/ F6 S - * kind, whether express or implied; without even the implied warranty
- w8 N4 W) @% H: |, Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" f8 A: r. N4 ~ - * GNU General Public License for more details.
* v# j* p( Z8 Z* D3 t& u$ f A - */! e4 n0 J+ y5 Q3 u
- / K1 W3 d& Q. n
- #include <linux/module.h>% }. ], ~% p# p
- #include <linux/init.h>( t9 V* O5 x- r
- #include <linux/errno.h>
3 B9 p+ W5 ]1 k& p1 X! G' m; B: c - #include <linux/types.h>5 w# \: V5 e+ ~% E2 l' }
- #include <linux/interrupt.h>: n) N3 B. _ |' k G
- #include <asm/io.h>* N" b+ {3 L% \6 A6 r1 X2 T
- #include <linux/moduleparam.h>
* V2 j/ x' y, C( Q - #include <linux/sysctl.h>
) e5 J6 ~& A6 [1 Y w. H; S! N - #include <linux/mm.h>7 B7 J+ @8 t: a5 Z: ?3 M
- #include <linux/dma-mapping.h>% {+ C; m1 f/ Y) i' l; I( S% G
8 c: a; v3 q; M1 ^- #include <mach/memory.h>
9 |$ ]! t( v$ S; f - #include <mach/hardware.h>
9 A' O9 b5 c* U" r9 y" W5 V - #include <mach/irqs.h>9 W, r9 v5 X, D$ ^$ y
- #include <asm/hardware/edma.h>
: @: V5 a: ]3 L1 t) T7 L
4 }7 @2 P- {6 C" l& A8 ?9 N- #undef EDMA3_DEBUG
) u+ r; `& g5 f f4 f% b1 \ - /*#define EDMA3_DEBUG*/9 e, J1 M% ?9 \
- / \+ [3 t }3 h4 W- j
- #ifdef EDMA3_DEBUG
3 q8 D# Y( ^* X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ I" z- w/ I' y( f# j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* ^: \% i, F0 b# D/ J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' B& H5 r `* T5 l - #else
% A6 z& V& P* @" m# m1 Z( C/ ?$ G - #define DMA_PRINTK( x... )
, Q, m- T# m- J' I9 \- w& D - #define DMA_FN_IN5 K' e5 r5 E. k, \# e& T! `, |0 [
- #define DMA_FN_OUT1 @. \7 c }4 X' m
- #endif
9 D$ j1 B" c& c3 m - . L( d- V/ c, {9 R' t8 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( v; C$ k5 X9 L - #define STATIC_SHIFT 3
6 P( s, \. R; W% _( X - #define TCINTEN_SHIFT 20% c, [2 z9 }% q2 \% F
- #define ITCINTEN_SHIFT 21
L' E+ `( H! E3 w/ P" ?& W Z/ W - #define TCCHEN_SHIFT 22
) o, b1 a( f8 g4 F - #define ITCCHEN_SHIFT 23) |; J9 t# A3 O( T, q* w+ f$ ]
0 e. o+ c$ W+ F' s- U. k- static volatile int irqraised1 = 0;! Y7 R1 G$ V u. g7 ~7 [
- static volatile int irqraised2 = 0;
6 W+ A" V% `" w' i h3 ~% \: \+ P
2 [$ ?7 K4 D& I& k' a5 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ y7 Z. G& M S# Q( K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?% e" k. y x, K P' r' b8 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ T* Q* \9 t1 r% b J# O" s
- u L* I: G* q5 s6 s* \2 v- dma_addr_t dmaphyssrc1 = 0;
2 W- n! b! j* {2 L/ B& ^ - dma_addr_t dmaphyssrc2 = 0;
6 K, F0 x1 X. f$ ~& P5 n: [/ K3 o - dma_addr_t dmaphysdest1 = 0;; v4 `" P& q5 @8 s# Q; ?
- dma_addr_t dmaphysdest2 = 0; i% K+ F. w8 b# F4 b" r' W7 b& L
- 6 P9 q- y. P1 z
- char *dmabufsrc1 = NULL;
& Z5 |1 f, w/ l4 x- R. C9 Q4 W& | - char *dmabufsrc2 = NULL;+ e0 B% `; I+ h( [: `
- char *dmabufdest1 = NULL;$ K1 Y; M& G2 e* u |0 W
- char *dmabufdest2 = NULL;; Q* y/ i8 B! B2 f( I$ f: f1 y( D0 |
- 0 g" ^+ q% w. e
- static int acnt = 512;
- {! |- x7 ]9 m c - static int bcnt = 8;( j) M5 _% |- ~6 s5 M2 \ P" @5 ^
- static int ccnt = 8;
7 G0 d7 s7 N) P7 i5 W0 J K( m* ` - 1 d! j, y: l9 P% X1 I
- module_param(acnt, int, S_IRUGO);
7 n) C; ^! T& R- s- g+ f - module_param(bcnt, int, S_IRUGO);
9 Z( U! d7 p+ b$ x5 L* k( D: E3 v; v7 V/ } - module_param(ccnt, int, S_IRUGO);
复制代码
. V- }" H9 `! ~- F) A% m H
) F' Z0 @- q+ s9 S" ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: w/ q1 A6 _$ F& j% ~8 Z3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 i7 G7 z4 m5 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ \5 |8 F9 E# J* t. ^) t* p
$ M. \, g w9 m, m2 ]# Y0 g+ u3 @1 S' k
|
|