|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 R% Y5 y/ T7 ]$ l9 ]- [code]EDMA sample test application. g5 E9 Q- L& }5 v
- /*
8 [3 C" Y; ^' H6 }) j" b - * edma_test.c
- Q& I/ z7 v. x8 \ v - *
# C t- b& H! C; m& X; v - * brief EDMA3 Test Application
, J, e$ _ c1 d4 E/ P - *0 {3 W4 g+ N( _4 d
- * This file contains EDMA3 Test code.
5 s* e1 `8 l$ @* [0 S - *
( X9 @! x( b+ S s6 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 |5 J' L+ C O! ~& u( u1 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 O/ } T6 Q0 _4 s' x
- * TO CHANGE.
( F5 u T# i3 N( y" g! J% T, ^ - *
: c w3 g' c" t4 x& t( R8 G% [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" B N9 y0 d' r! L9 L- e, N - *
- v& t/ Z R t y! e! U; r1 ^ - * This program is free software; you can redistribute it and/or$ m+ n# _- k; I3 t4 E) B! ?' O8 O
- * modify it under the terms of the GNU General Public License as
1 [. l: v. r5 h2 A - * published by the Free Software Foundation version 2.
0 y; U( T& j3 N& J$ o5 F - *% ^% R2 z% a i- m) \$ r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& h3 B9 _0 k6 y: W$ i$ p0 x9 W; M0 } - * kind, whether express or implied; without even the implied warranty9 A# {: r q0 J# R7 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! c6 r8 P/ R- ~, n, }( \ P - * GNU General Public License for more details.; g4 o0 t9 i- Y P1 k
- */
% g. y9 m* j. x5 y: h - * o6 b( r8 P8 ^9 |
- #include <linux/module.h>
8 j$ l N8 v$ Z5 q - #include <linux/init.h>
- \, K! Y! X3 r( ? - #include <linux/errno.h>
- t5 t3 j, u) o8 G" y0 F- [8 P - #include <linux/types.h>8 J* `( _+ p5 i! e1 N+ _- B
- #include <linux/interrupt.h>
: y$ J3 U8 I5 U) F7 D) A6 r - #include <asm/io.h>* r; _ g v- T) f8 e$ }" B5 G
- #include <linux/moduleparam.h>
9 q- X% j/ a! f$ s9 t7 I7 h0 x - #include <linux/sysctl.h>
% p% m# s& B/ F( d8 S0 ? @$ W! Q - #include <linux/mm.h> M# q, G6 X$ j$ g
- #include <linux/dma-mapping.h>5 q% c/ b" a, k7 i) b1 X- t
- 4 b4 I: y% z8 ?1 a7 Q( D: ]' H
- #include <mach/memory.h>
7 S9 t) M" h0 a6 h1 O - #include <mach/hardware.h>2 A& h$ E' `, ^4 Q$ x" R
- #include <mach/irqs.h>
. ?, `& ]1 ? V" ] - #include <asm/hardware/edma.h># @5 o# B( n F: p) k0 [; W
j+ m- Z" D) s, K. H+ G6 j1 L- #undef EDMA3_DEBUG# X- w2 i( u7 J1 b: ~3 ^9 ]) y
- /*#define EDMA3_DEBUG*/4 C3 y" E1 h6 q8 k, H
2 |0 q, J" C5 I' g- C+ A! ~- #ifdef EDMA3_DEBUG
& l: Z& N8 X; B0 g/ H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) h+ Z# h( L5 ^& i. h4 X+ t) N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 j/ V1 u; E1 ^2 B' T! { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ M, J; C: }. G- ]6 j
- #else
2 I3 r Q# z3 `! m/ U8 O - #define DMA_PRINTK( x... ): M" N% i; _0 V2 u
- #define DMA_FN_IN
" z. B" q5 Z( S - #define DMA_FN_OUT
3 ?9 ]" S; P% y1 P/ C) S/ i5 _4 ` - #endif
5 P8 l# x) |/ C/ R - ' ^" j* P* G7 P) a, r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 g7 j8 ?2 P4 C) b
- #define STATIC_SHIFT 3
" L: z5 T2 a( G( s6 c+ n) t" u! o+ ] - #define TCINTEN_SHIFT 204 g5 y7 P8 O; {$ z" U4 P" Z
- #define ITCINTEN_SHIFT 21
+ @7 q: m( O) u9 Y2 m - #define TCCHEN_SHIFT 22
4 D: L4 ?) G- S5 c$ W# | - #define ITCCHEN_SHIFT 23; C; y N" k) \( k
& ?4 ~. s2 T7 w! j. q3 A5 x- static volatile int irqraised1 = 0;9 E! V9 a' t$ d3 N& I
- static volatile int irqraised2 = 0;
" Z5 h; o& U- B+ F* Z - T7 Z; x* v8 ]+ _. L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o' A& f: X u5 F' ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& { {9 e1 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G$ R* i& C! ?8 }2 l0 u
" d2 z f+ W5 n4 }' s. T- dma_addr_t dmaphyssrc1 = 0;& M" ?4 k* u; S7 G, p$ C4 j3 z
- dma_addr_t dmaphyssrc2 = 0; t7 c( B. V7 |! V& L" Q
- dma_addr_t dmaphysdest1 = 0;
: O, U& v) j) y8 ^7 N* W& d - dma_addr_t dmaphysdest2 = 0;8 I) `* W3 [4 E
- : ]; E5 V" l& {/ B7 v
- char *dmabufsrc1 = NULL; L s$ C4 Y6 r2 C* L8 ^. }
- char *dmabufsrc2 = NULL;
; C$ y+ K. _9 h/ ?, J - char *dmabufdest1 = NULL;
/ R0 t' V6 @+ F2 P* k - char *dmabufdest2 = NULL;
* L" |) k# l6 ]2 s
, F/ e3 ^; v& t/ M" X4 h7 p- static int acnt = 512;* ^" c5 `$ q6 ]' X5 H
- static int bcnt = 8;
. d _" w9 B' |& r) Y5 k1 } - static int ccnt = 8;+ P% Y; i% k: t/ ~2 t! U* E/ P) _
- 1 F" h( I* I) Z' r. L i7 n
- module_param(acnt, int, S_IRUGO);
$ B/ q2 ]4 ^. G. O0 X& _7 Z - module_param(bcnt, int, S_IRUGO);8 k9 R" c2 Z5 M) u# l
- module_param(ccnt, int, S_IRUGO);
复制代码 8 }2 N9 y% p* S
0 c5 s; s8 m) T+ W+ ~9 c6 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. V5 [! q4 J( |9 u! ], garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 U1 c6 c2 j! [ b h- q, O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& R* m! h+ [1 Y, V! e0 |) H( _8 p* Y8 U* S
2 n7 ]" P1 Z% F' x4 W! x |
|