|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: a6 l2 q2 m. M' H4 L' l; x2 l- [code]EDMA sample test application2 L/ ~+ W5 P9 w
- /*3 P' _1 b, F. }7 A( c; e6 v
- * edma_test.c6 E$ k+ t! u L' m8 T$ e
- *. X; o( v. Y. \& n/ t
- * brief EDMA3 Test Application
5 o4 \, q4 t: j2 L3 A( y5 ^ - *
4 ~$ n, y( ]" T! g) E" J! b - * This file contains EDMA3 Test code.7 y' T7 K' `5 `7 [9 K, M) a
- *2 J0 g6 w( Z& w5 R) U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# r" b; {. t9 i+ z3 `3 f" Y0 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 w; F! d: n3 ~0 G. J! I* \+ Y - * TO CHANGE.
9 L9 x- ^; o; Y7 m; R* D - *
z5 i) \" b9 k9 p: D ^% X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ J: R, G6 J' @* K: S) j6 h - *
/ O( S3 x* D& [9 F4 {3 D - * This program is free software; you can redistribute it and/or
$ d9 C4 a! Z6 ^4 @ - * modify it under the terms of the GNU General Public License as2 m5 \* b; {9 Y K3 O
- * published by the Free Software Foundation version 2.$ _9 G# W8 q! @
- *
. b7 F4 A' |1 j' W9 x H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 I3 n/ U; E; \. B - * kind, whether express or implied; without even the implied warranty3 U5 R3 u- B7 g% b P1 A5 k" R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' o! e6 w# e4 L8 p8 X1 i. j - * GNU General Public License for more details.4 l1 A# U. P9 y8 s0 W4 I
- */; F1 `0 S; u' r% B7 y6 @
- " V/ m, a+ B- `* U$ c9 l% ]. L, L4 l
- #include <linux/module.h>
9 v: M+ x {4 W1 E5 O$ H) ? - #include <linux/init.h>, w9 @( K- l; \
- #include <linux/errno.h>
8 N7 v" x+ [. I& L6 Q) H - #include <linux/types.h>4 }: g+ a# {' q" B3 y0 A9 v
- #include <linux/interrupt.h>
4 G$ e) `0 b. }" j - #include <asm/io.h>
/ _6 U& D! L1 J7 A2 ] - #include <linux/moduleparam.h>4 N+ O5 X: w$ p% a/ {2 v5 t* P: y. Y
- #include <linux/sysctl.h>- e2 v$ n6 ] u4 @; \
- #include <linux/mm.h>
7 G T+ ^+ V5 } - #include <linux/dma-mapping.h>
7 t2 Z |+ ^& K4 }9 z
/ ~2 o. t }& ~ Y2 x- #include <mach/memory.h>
7 O( G0 C3 J" w. x5 V2 y! ?4 R - #include <mach/hardware.h>
4 x, H- s, T, h% o/ O - #include <mach/irqs.h>
7 k+ R( y6 z, z v2 y1 x/ j - #include <asm/hardware/edma.h>/ E% @4 s5 u# x; u& v
" S$ E2 s6 b0 [, [ y: E* G- #undef EDMA3_DEBUG3 D, }2 V* O" S3 d
- /*#define EDMA3_DEBUG*/6 O- L' P) \: ^' O5 i) y; [8 H
1 _, C a6 M) X3 r- #ifdef EDMA3_DEBUG0 O, e4 U/ f' w( V: A& y, E8 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). @0 w0 k F2 A- e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 I& k% K+ q4 c3 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 N; c% D1 p3 c% P T; V& \ - #else+ K; U- r# V& j i0 U) l* {9 |
- #define DMA_PRINTK( x... )- p+ r! {' K/ g: i
- #define DMA_FN_IN& I T8 @$ @3 A/ ~' p5 O$ A/ P
- #define DMA_FN_OUT' U1 P# \3 K) w% ]% I) {. c
- #endif2 L6 x2 q2 S# p6 N, `& P
w/ S2 o6 c8 L( J+ p/ \6 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" g, @( ^- t% m4 |* w' k
- #define STATIC_SHIFT 3' X5 x) @: l: v+ b. q3 M
- #define TCINTEN_SHIFT 20
, p. ~ }! A0 }& Y* E6 d - #define ITCINTEN_SHIFT 21
: K7 \! A: r. U3 e3 i - #define TCCHEN_SHIFT 22
3 r$ Y& V* @7 |; x9 z. L! h - #define ITCCHEN_SHIFT 23
1 f+ d! [) [- L6 O4 o* {! ]
2 `' N2 ]- q I8 ~* n6 m- static volatile int irqraised1 = 0;1 ]: v$ k+ ~: O2 K3 \/ C' N
- static volatile int irqraised2 = 0;! D, x! Q3 h1 J+ ]" u
0 U, F8 s0 ~% C/ t+ A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T+ j: l% u/ L) c+ B) ^5 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~0 X" Q' m/ G. D9 @4 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); D1 I9 \! _# b0 M1 p$ S
. ?* X2 [6 E2 `3 l- dma_addr_t dmaphyssrc1 = 0;* B% J) w3 ]/ [% }3 Q6 ~ K& q
- dma_addr_t dmaphyssrc2 = 0;
3 ]7 B# J; e% n - dma_addr_t dmaphysdest1 = 0;
- X L g, [. _" u3 D5 K! `3 ~ - dma_addr_t dmaphysdest2 = 0;: W9 K: R+ ~# e" T! h3 [8 o" E
7 H- O6 u1 [% C0 H1 c2 Y/ ^5 h- char *dmabufsrc1 = NULL;
8 \1 \7 }$ c8 q$ E - char *dmabufsrc2 = NULL;" A* v H9 X4 R3 T% E! A& G' _- W% q: q
- char *dmabufdest1 = NULL;
( Y/ F& s- N% U! z; j - char *dmabufdest2 = NULL;& C. {8 c7 b% V, G# r w
% e- A- J. p% z3 H( T- static int acnt = 512;
' m4 G! [/ Q0 _8 g$ ]3 X; | - static int bcnt = 8;$ P: b8 g! H. v/ _" |
- static int ccnt = 8;1 A7 R: s2 e8 m f
- 5 D/ w, U' e, a* E8 y) a+ J G
- module_param(acnt, int, S_IRUGO);
+ o! p, X1 E' p3 r" M% r$ Q - module_param(bcnt, int, S_IRUGO);( _, |# f+ N7 r8 r
- module_param(ccnt, int, S_IRUGO);
复制代码
. a1 ?' ?- \/ D2 j2 y r$ X0 w( \" s0 t; Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ], K, K. |, @4 m& K: K1 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w; U2 `! N) o/ B4 c3 b4 W5 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 D$ l" M6 B$ b0 c% b
. s; Y: t( B- i; h( j6 k
* ?( j8 d' O9 @- ^: J/ t7 r |
|