|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C% y" o' @8 }* w- [code]EDMA sample test application) G; t$ U* a% c9 p9 Z$ r# F/ y
- /*: T# n+ |, P$ O; f% W
- * edma_test.c7 u) b+ J6 n0 y" G* m: G0 E( E4 Z: e6 a
- *8 S- L- B0 J- P$ } x: c V' [4 p
- * brief EDMA3 Test Application
, D: a$ m+ }* f% H) O/ v - *
" ]- K! m; a1 w7 y - * This file contains EDMA3 Test code.
. J" M# ]" z6 A/ _. t - *
' \# z/ p0 D5 {; B% ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A! l9 I! S6 d+ l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' k9 c6 V, @; U8 z' K7 i4 u) K - * TO CHANGE." x1 a* t/ Y3 E2 i$ F
- *$ G0 f. e& m/ T/ L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# s0 Q: n, E) ~8 o1 H
- *- l, i7 X8 m2 Y
- * This program is free software; you can redistribute it and/or2 p6 G4 L( G/ \9 {
- * modify it under the terms of the GNU General Public License as! E: I2 ^" O! W+ p5 r% |/ a R
- * published by the Free Software Foundation version 2.
: G8 l0 g7 E/ a5 z - *: v$ a/ X0 H; R) G! `. j; l2 g5 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 `6 @) H* B. {8 l, G9 o# o - * kind, whether express or implied; without even the implied warranty
- F! ~3 v8 ]! z+ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 N4 \" X/ l( U$ V6 ] - * GNU General Public License for more details. J# s2 V0 y: a2 ~+ B* ?* z
- *// s& q. s, P5 [" ] Z) L$ `
- - [( K! l+ J' `- |, @9 k3 }9 n! U
- #include <linux/module.h>2 g* n2 B! ]- m }4 ]! k
- #include <linux/init.h>
$ X/ E- D9 E7 c: M. ]9 r* @ - #include <linux/errno.h>2 i( P$ g; x) ~2 D* x# W
- #include <linux/types.h>
5 p! F: o* i9 N" {& N - #include <linux/interrupt.h>) H. E6 o4 ~- B3 ?
- #include <asm/io.h>; v- @; L6 c5 R, r& `
- #include <linux/moduleparam.h>
% k9 D d, A, k7 D) a, Z - #include <linux/sysctl.h>) {2 j& r( J8 |8 U* b% t
- #include <linux/mm.h>
~$ Z7 ^+ V8 Y8 e" Y/ A2 C2 [ - #include <linux/dma-mapping.h>0 q8 J* K- _, P
: A6 t/ u& t0 J9 v' T0 q0 T- #include <mach/memory.h>
- f* W! o3 e1 A - #include <mach/hardware.h>1 F& E( J, T) `3 k
- #include <mach/irqs.h>
0 ?4 L/ U+ G5 h. I1 | - #include <asm/hardware/edma.h>
4 ~ f/ j1 r( P4 v A2 v
( W7 G1 Q. ?8 t. R' N- #undef EDMA3_DEBUG9 O: D4 I3 W7 q9 \
- /*#define EDMA3_DEBUG*/
5 s% @. Y: `/ _- u+ }3 P4 c; x - $ X$ a5 L$ g: H" E0 o# X+ [6 Q
- #ifdef EDMA3_DEBUG5 K3 W& l6 U6 C$ h( j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! A# g- S/ N. q, h' x$ D# r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K" d6 L/ B3 f0 R1 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ l6 D; q0 d; D! K8 B3 ?+ b - #else
/ w. a( e/ r2 W0 S- n - #define DMA_PRINTK( x... )! V9 G, m8 {9 w+ [4 k/ s) `' |
- #define DMA_FN_IN/ V9 C- U% \- c: Z
- #define DMA_FN_OUT
2 V! F& s9 w! \& y( M& }3 W - #endif, O9 p1 K, ^4 Z( A( o8 K/ z
- + ~, k+ Q2 h5 i0 E. t( N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ]9 S; a+ V6 B7 S% M - #define STATIC_SHIFT 3
E% R7 C) G4 ]' m7 L+ U - #define TCINTEN_SHIFT 20& R) m9 ]' C. P% e3 W
- #define ITCINTEN_SHIFT 21! C+ |3 r- s* p5 _! a6 w
- #define TCCHEN_SHIFT 22
+ O. P8 Y- f- u3 k - #define ITCCHEN_SHIFT 23
( m1 e9 N, R0 r9 L3 v; @- }
5 A8 N2 Q. ?+ p- static volatile int irqraised1 = 0;$ c0 K$ x- Y0 T8 [) Y6 ^, X. \$ ^
- static volatile int irqraised2 = 0;
4 @5 K8 M6 m% [* v6 N- u) N - : V e8 {( o8 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W8 v# A3 H& P, k. D! [: i+ L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 L0 J2 U" g R/ g% S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 h/ s3 b+ ^% F( H% U; V- A
( I" G- W& p8 S) k- dma_addr_t dmaphyssrc1 = 0;
- { _- l3 L; h J - dma_addr_t dmaphyssrc2 = 0;
5 D ]. C1 \: w; b/ x P+ F: ? - dma_addr_t dmaphysdest1 = 0;
% ]# e4 @. x4 Q7 S: ]# c" [% L7 ? - dma_addr_t dmaphysdest2 = 0;
7 ^2 v1 Q- Y6 g; ? - , C9 m" e* q" ]9 ^0 F( G; S9 M4 J
- char *dmabufsrc1 = NULL;
' I- z r f4 Y) `8 M( ] - char *dmabufsrc2 = NULL;
. C# t$ j$ b! n( l3 }8 ]% Z; U - char *dmabufdest1 = NULL;8 ]$ r# g- B$ J4 U7 g, E
- char *dmabufdest2 = NULL;" o7 T7 M3 C- \1 s( f
9 T# D2 p4 C. M; F9 A2 ~6 p- static int acnt = 512;
/ _0 }* x0 z$ F2 J4 ? - static int bcnt = 8;: d9 o- D6 _. ?% t% \
- static int ccnt = 8;
: J) l) G6 I. \& ~' z# S8 ~ - N! F$ S$ b# c; N8 G3 n4 a
- module_param(acnt, int, S_IRUGO);! ?+ e6 C) ]4 t9 b1 O# _: }. {, \
- module_param(bcnt, int, S_IRUGO);, M3 e1 a' j+ q9 t2 K. z
- module_param(ccnt, int, S_IRUGO);
复制代码
7 k% _8 b- H. {
' _- K4 ]$ b7 V# C( g2 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ?. k( |# e& g8 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; j8 _$ q9 D! o0 ?; _% @6 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ [" c( h! L: W& ?$ M8 ~
" _( Y( {) N8 g, O
; T! n! V6 X! { |
|