|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D' \" G% q3 j" _
- [code]EDMA sample test application
7 S5 y/ D- F% {" \, J - /*
& w% _. O4 t; N+ q0 E B# L - * edma_test.c, J) z6 U7 Y2 a0 @. }3 p
- *8 o5 S5 g# n: e! g6 c
- * brief EDMA3 Test Application
- t Z- `1 O) Z; f2 W7 c6 m - *4 i$ s7 k) {( u E& F
- * This file contains EDMA3 Test code.: ~+ [2 |8 G8 O7 p; |
- *5 y7 \0 r4 Q* b2 Y1 V. w( a z5 `7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
_( b/ B( l; ^% P2 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 w$ ]( R. A' V7 Z3 h% D/ r
- * TO CHANGE.& ^# `! E R' B
- *
* Y; x4 j6 M4 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 C6 e- m _) K8 F5 ^" u3 w' P - *
+ E% i7 K/ E8 J' E3 H7 e, C: E - * This program is free software; you can redistribute it and/or# r, ~1 V4 c. m+ L- U. J0 {# B
- * modify it under the terms of the GNU General Public License as
. X1 S6 j1 S" f - * published by the Free Software Foundation version 2.
& z6 E& H/ W- G/ k - *8 b& h. ]0 _1 X" _/ Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ O" b4 q- Z2 i6 R9 m/ L5 X - * kind, whether express or implied; without even the implied warranty& S* k+ w0 i5 U9 Q6 d2 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! X' J9 s9 j' l6 R - * GNU General Public License for more details.
: C o) F0 C f8 Z, c, [: {* q - */" T) B& d- o% ]+ I# ]
2 v% ~+ e& S' r! r- #include <linux/module.h>: u9 N, i, y1 w/ N0 U# E
- #include <linux/init.h>
% B/ }# ]* S2 W3 O2 C- o - #include <linux/errno.h>, c! I4 i5 w, l: V% E2 v' @" X0 Q5 \
- #include <linux/types.h>
# q( P: ]: y6 ]4 E - #include <linux/interrupt.h>
2 x5 |, ]4 k7 S; t: B3 v - #include <asm/io.h>
8 \; J0 t n' z* }$ g& g: Z - #include <linux/moduleparam.h>. J- \) q- p' ?
- #include <linux/sysctl.h>. \, t5 g+ u: D
- #include <linux/mm.h>4 Z9 Z, A& X: f1 G$ ~6 n; A' Q. q
- #include <linux/dma-mapping.h>7 j, T4 W( ?( D4 V
- , ]# J& a4 W' u3 k P" I5 x; A$ e
- #include <mach/memory.h>* ^; c) y# g: @. a: P( b7 a& o7 Q0 g
- #include <mach/hardware.h>7 |+ }3 q* t9 [4 L
- #include <mach/irqs.h>- w$ A2 u* k$ y# w4 _
- #include <asm/hardware/edma.h>0 X% Y: @ `0 D1 Q% v7 b
- * N- y: \ B" `( @
- #undef EDMA3_DEBUG
, T' t; n( l/ ^: u - /*#define EDMA3_DEBUG*/9 m8 \; w: |& e2 G. b
3 O6 V/ t% k* H; e0 c/ p1 y- #ifdef EDMA3_DEBUG
% c7 s o" @7 ^0 o, P) g. K; Y% J- x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): C6 i: n% s1 T+ z; F) w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) o! n# ~# G$ W* ]4 g. V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 V) X1 ~, \, a/ _+ F - #else
/ h( @; O& E' v- y/ h, t - #define DMA_PRINTK( x... ) O$ i: u3 j% R
- #define DMA_FN_IN
* s4 ~+ u. |2 o, {1 g6 s( _ - #define DMA_FN_OUT. H5 ?0 v" E: \; ~% N& ~
- #endif
9 G/ Z. @5 V) O$ p: S5 d' x
9 z% C2 Y; {" Q- |6 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% s+ n) C7 u" ^6 `& E- E+ B - #define STATIC_SHIFT 30 P$ V8 k# O3 m% `& z* E' a
- #define TCINTEN_SHIFT 20! L' h9 P7 a+ {; }
- #define ITCINTEN_SHIFT 21+ M; F' f: Y$ {: W1 N( o. f
- #define TCCHEN_SHIFT 22) X! z( S; C1 G- l( Z
- #define ITCCHEN_SHIFT 23
: @6 G0 j- `( j/ r8 y - " L' a1 a# C, r( W' _! {0 s' N
- static volatile int irqraised1 = 0;9 O$ F, k J7 t
- static volatile int irqraised2 = 0;
' D5 D0 Y4 X9 E# w
* H2 k% p. C s) A: L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K9 K$ H, G8 p3 `) L7 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ v- I4 G3 @3 |/ P# e# b4 y: x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h+ W9 H- I) L- N
- " v _& [& ]" i3 M- \. S4 a
- dma_addr_t dmaphyssrc1 = 0;4 U. }2 G( H* F, m8 a- x
- dma_addr_t dmaphyssrc2 = 0;- X3 i/ _2 p" J4 I/ f
- dma_addr_t dmaphysdest1 = 0;
; u9 ]5 r s: |6 A* @& a h! J - dma_addr_t dmaphysdest2 = 0;% P$ w" }$ M( |& [% Z7 L
6 ?; j. O- [ ^9 X0 B# {1 e0 y, a- char *dmabufsrc1 = NULL;
5 N* H5 r7 \, b3 B/ v; b: |' f - char *dmabufsrc2 = NULL;5 W9 m7 O3 z4 v- j% n
- char *dmabufdest1 = NULL;- B3 N0 k, x& y9 t2 s% \
- char *dmabufdest2 = NULL;
" ~/ _/ N- z6 y+ l
; [% o q7 R6 k- static int acnt = 512;
1 F4 o5 U% \+ Q+ P+ E# L2 @ - static int bcnt = 8;9 S: w8 U5 t) C8 b5 p- G, y
- static int ccnt = 8;4 I9 K. R1 m' c& t6 ]) g' L
/ j: e# ~' R+ x! ]! ^* {3 P4 `0 T" {5 S- module_param(acnt, int, S_IRUGO);
! e+ }2 c% W. v - module_param(bcnt, int, S_IRUGO);0 ]/ g" N/ A0 e
- module_param(ccnt, int, S_IRUGO);
复制代码
$ M- s. Y9 ?9 e# F8 g& O, M& ?0 a: z. s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T3 s/ i& O% Y8 g! P6 X. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ G1 E# F- r' g+ A7 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^2 X$ _( h) z* y$ k, N$ V
( j: T+ u3 }' d' `! [0 g( A
% \: p' V: ~' o' G
|
|