|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C7 v" U+ M# W& v
- [code]EDMA sample test application2 D$ n2 D) T$ }+ {& @. k$ }
- /*
3 v& G# [0 L! ?# N9 l - * edma_test.c. T" Y8 C. @2 T% W- {& K
- *
; _2 A! j& t! R# M* Y0 `4 @! V7 _ - * brief EDMA3 Test Application2 C$ O: i) G1 X1 K" l6 |* T
- *
8 k2 x7 ?9 H/ P - * This file contains EDMA3 Test code.7 x* v B, U8 v2 h( Q' D$ R. q4 z, e
- *+ d4 \4 n# q7 X U6 `& c& J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, n7 }* N) `8 _# ~8 \" H' v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 A6 v+ o# }5 [- g9 C8 m4 F# } - * TO CHANGE.
+ ?- m$ y/ }0 B, w3 K - *
6 V6 ^* i- ~ k8 |5 X+ U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ P) I: W0 v1 y5 `& B
- *6 `" j) L1 ^1 ^& G5 }
- * This program is free software; you can redistribute it and/or
5 p |% E+ B7 [: c - * modify it under the terms of the GNU General Public License as
/ Q( \2 I) Q* e5 r6 l - * published by the Free Software Foundation version 2.
* A" b' }6 @% x5 y9 v o+ s! k - *
% P) S# X5 Z3 f+ S' L7 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% s# X" R* E: r - * kind, whether express or implied; without even the implied warranty
$ }8 b. y& X3 P8 Z! s2 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& w6 y3 J; d( t% ~ - * GNU General Public License for more details.4 [- R1 Q; p" Y- ]* A
- */
/ b+ T8 z% B/ c+ r3 \. O - - `* b8 D$ z" ?1 Q5 f- Y
- #include <linux/module.h>. g' D' D4 h% V) x6 Z( G9 B$ p
- #include <linux/init.h>
! D+ [7 b/ \' M B. E - #include <linux/errno.h>
' ]- u# d4 O n% W: k' H+ K1 v7 Q - #include <linux/types.h> F- T, R9 F* m% p: k
- #include <linux/interrupt.h>
% M5 e5 x l0 F' U& Q/ B$ _) m0 @/ V - #include <asm/io.h>
" V; B1 p: Y; ?4 E - #include <linux/moduleparam.h>
% [# n8 C$ `4 S( n1 ] - #include <linux/sysctl.h>6 @/ }7 x, L; S ~# E
- #include <linux/mm.h>
6 @6 n- D. ]+ ~# }# I4 r: V - #include <linux/dma-mapping.h>
; o4 f( ~ f+ z C9 {
; x1 `9 W7 o. i, U+ q- #include <mach/memory.h>
$ ]$ }9 \4 { Z5 n* G& O+ T+ Z4 k - #include <mach/hardware.h>) n8 [+ w9 R, f& _# R: a+ o! n
- #include <mach/irqs.h>7 M0 h B: [# r7 W. C$ [3 I
- #include <asm/hardware/edma.h>
, B8 \7 L8 w6 {, H& r( Z7 N1 f - " q2 d, g7 u: L. ?# X; }; p( i
- #undef EDMA3_DEBUG
0 B; H8 W# p5 l - /*#define EDMA3_DEBUG*/
# u% S# Q- ]9 J; k6 }/ l" f0 O
8 r4 m; h- H# Y( v, r. P6 U2 E- #ifdef EDMA3_DEBUG+ {5 Y8 _+ e& h3 a# ~8 P8 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( U4 E3 l6 x3 y8 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 m W* n' j" K/ Y# W& h* U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 Z; s% O$ X+ {( } - #else
% x6 Z$ D1 |. B- K& e - #define DMA_PRINTK( x... )
) V" Y' k$ x$ A. \' Z - #define DMA_FN_IN& x. p/ h( J ]9 W4 N' h w# H
- #define DMA_FN_OUT% p: R; ?; Q7 i9 o2 o% S" S$ f
- #endif
# {- o1 d3 m' o \& @3 I - * L( J2 Z% G8 H2 z7 ]$ s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) A1 u7 q9 A" a- q7 E- e. c W
- #define STATIC_SHIFT 3
% \! g+ |' `' c+ D% U- E7 |( }3 l$ O - #define TCINTEN_SHIFT 20* S9 D9 e8 q1 N' I7 J' d6 p: t
- #define ITCINTEN_SHIFT 21. i" @2 _3 C- K% Y8 G1 p6 B
- #define TCCHEN_SHIFT 22
! C. a( ~" R' @$ d" N - #define ITCCHEN_SHIFT 23
: |: F6 l/ Q% k3 C# M - 4 Y# j0 v$ k: |9 s+ y* J
- static volatile int irqraised1 = 0;8 G, u- u. l3 e I8 \/ U3 {
- static volatile int irqraised2 = 0;
$ N) y' e5 d' [6 f$ g
/ c, J, Y* z: n _8 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 K( ?& D1 q% l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: A* f( m$ \& }, b' m8 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q+ q1 d. t) Y1 D& X3 e' |8 Q
- / a2 x! X* Y& w4 i0 J5 M
- dma_addr_t dmaphyssrc1 = 0;2 F9 o+ I+ _- V. c& J& E
- dma_addr_t dmaphyssrc2 = 0;' g5 v* \! B, |
- dma_addr_t dmaphysdest1 = 0;
" j$ r F3 S1 ]5 s g - dma_addr_t dmaphysdest2 = 0;) G( D5 J5 |. W s7 s* e
- 1 p6 [( v( `8 {- l: r
- char *dmabufsrc1 = NULL;/ G0 Q6 o8 {9 p1 }
- char *dmabufsrc2 = NULL;
* t4 J3 t1 ~0 z+ Z4 l- N# j - char *dmabufdest1 = NULL;
$ i; q: B3 }5 g8 K: c5 K, ^5 W0 C - char *dmabufdest2 = NULL;
; B6 z2 V8 y% K0 X4 A* I, j6 z
; K9 j& `0 f0 l) P$ ]+ \0 e- static int acnt = 512;
- v2 y! U7 F3 o) I4 O. T - static int bcnt = 8;
! z( @+ d' o8 d- W* O2 I1 {; N; Z2 ~ - static int ccnt = 8;
: m3 f7 g2 e) }/ E - * s+ E% h: @* R3 F5 Q
- module_param(acnt, int, S_IRUGO);
9 ~2 F2 w$ I6 ^9 G4 J o3 } - module_param(bcnt, int, S_IRUGO);
5 L2 ]5 \' [$ ^8 I" @9 u: ?+ w - module_param(ccnt, int, S_IRUGO);
复制代码
W0 [+ u( k( ?% C7 R! w
5 y; D$ k6 P! v! s+ u. A! X7 q! G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c4 N' L+ ^/ k- T- V+ I+ E2 {9 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 L/ | @# s" K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: m2 Z0 n/ ^" I* j5 p7 a+ i, e
: i/ P8 l6 x2 r& A: L) h& }" Z" Y5 N3 I% `9 H4 i
|
|