|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g6 ]' Q. k( E0 c5 V. M( w
- [code]EDMA sample test application' h+ V/ E5 p h+ ?! z- C
- /** f! F; Y2 t. ], t2 `" @, V
- * edma_test.c* R. l% Q% N8 c7 x2 |1 {9 e$ o
- *
- U& I7 |. G4 `& s7 F1 h - * brief EDMA3 Test Application
; i# W: W& n. ~7 j% v. x6 O8 F: f - *. c) x+ i! ^1 Z$ n
- * This file contains EDMA3 Test code., ~9 I) M9 J- i
- *, ~1 L+ j: h: e' e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Y. G: k. a2 U& k5 @, [2 P( R- E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 A6 _. [- S' u8 {5 E - * TO CHANGE.: A/ {4 y. ]' L1 U& E
- *1 _- l, X# F' ~# L8 m% b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 q* l6 |, _* ^' Y0 M
- *8 B/ L1 J+ e% P2 m4 @
- * This program is free software; you can redistribute it and/or" j9 K) L5 O% q6 R/ X$ D
- * modify it under the terms of the GNU General Public License as
4 P3 B& D9 [0 r9 A% ? - * published by the Free Software Foundation version 2.
/ ~3 V- [. Q6 D2 j3 P7 p - *5 Y: ^: x0 z! P6 }' V0 C& ]6 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any v, Y! d9 F6 x( Q* R9 m0 {
- * kind, whether express or implied; without even the implied warranty
/ t* s7 s( f0 Q" X* } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 N4 m! c" I7 V( D: z0 ?
- * GNU General Public License for more details.0 T' e. F- |3 t6 {2 m0 z* _
- */
" ^$ k0 y! m" B& N$ M+ k* \ - % o0 \5 g: R/ t% e k5 N1 l' f/ Y
- #include <linux/module.h>/ t( j( o- o+ _- z" \( ]: o! E
- #include <linux/init.h>
! x4 F# d3 K u - #include <linux/errno.h>* Z7 y: K: B( u# X
- #include <linux/types.h>- F: X5 l( n1 ?8 ?" f) L$ Q
- #include <linux/interrupt.h>/ O$ L6 U% [/ Z
- #include <asm/io.h>2 n ~6 b4 V# b" L9 p
- #include <linux/moduleparam.h>
% V5 l5 Q4 F9 y" K4 F+ m - #include <linux/sysctl.h>2 v5 I0 @+ ~% h" h- F5 Q
- #include <linux/mm.h>6 D$ I( O/ y! i# p! f# o K/ ]* b# ^. ~
- #include <linux/dma-mapping.h>) k: n, K7 ], k% E* x" j
- , ~7 i, Y4 M: r1 l! x
- #include <mach/memory.h>6 x9 v O1 O$ Q5 H, \# ~
- #include <mach/hardware.h>1 P0 `# `, T! s4 c+ u" Z. L0 r8 l$ N
- #include <mach/irqs.h>
5 g0 \ m: \6 o( T+ Y - #include <asm/hardware/edma.h>4 W6 r3 T' @* b( S9 Z/ L
- / c3 X6 Z3 P7 C' N
- #undef EDMA3_DEBUG, C* {( Z$ i" [. O, U
- /*#define EDMA3_DEBUG*/
8 a# ^1 |) F0 E7 C* ^' f
; D( b( H9 j/ V1 I& d* e- m% \- #ifdef EDMA3_DEBUG
6 n6 W( b5 S' W- G. q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- z& K. @7 Y- z( E% H# F; x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* O8 \$ H& C( f+ i4 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), u" L) g; v ?1 D+ o& E
- #else
' }! Q0 A& e# j - #define DMA_PRINTK( x... )
5 G. g. g9 F$ R/ o0 F# n; } - #define DMA_FN_IN }6 a* H6 O9 ^3 j* E$ C
- #define DMA_FN_OUT
8 y$ q+ q' f& B/ d: r. J - #endif
* z2 R% [/ r( d; ^; B5 J& \; @
1 u; P* |1 z5 f) K4 I+ i% u- #define MAX_DMA_TRANSFER_IN_BYTES (32768) v% t% T! W o/ t# ~% P) y; y
- #define STATIC_SHIFT 3" h W/ v- a E
- #define TCINTEN_SHIFT 20; q+ G9 W& K6 k: E! z' C
- #define ITCINTEN_SHIFT 21; r/ G$ ]/ h1 ]( u; J8 L$ ]
- #define TCCHEN_SHIFT 223 D- O! g' ^3 F. ?" }+ o
- #define ITCCHEN_SHIFT 23 x c! @* q/ s" N. T) Y$ s
- + L3 s, j! q8 |9 b+ P) b( F
- static volatile int irqraised1 = 0;
, ?9 J: R3 O! Y& I# w. q - static volatile int irqraised2 = 0;
, ?0 Y( u' y* v( X) ]" }0 I - " ?! X! v' V- G1 E: ~0 \: m5 J: O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ `2 y2 b# z3 a6 q6 v$ H! f- i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }4 N& W* t, W2 w( N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: k! Y7 B9 d/ Q! s$ F- r0 r - # X8 b& a) o, i
- dma_addr_t dmaphyssrc1 = 0;
0 [& Y! I" K" ?1 j* H5 I4 @ - dma_addr_t dmaphyssrc2 = 0;2 J/ r$ ^* U8 P. D" a
- dma_addr_t dmaphysdest1 = 0;
! e% r3 K- p4 j) B+ P0 r - dma_addr_t dmaphysdest2 = 0;6 T) x- Z0 N: {6 c4 R4 d4 G* z
/ a) k3 C# w/ {% F/ i- char *dmabufsrc1 = NULL;
& M# P# X7 S' C+ i* r - char *dmabufsrc2 = NULL;
* B8 l. b7 A) M/ y( l0 T+ \- j - char *dmabufdest1 = NULL;
0 @$ R& S$ f3 h - char *dmabufdest2 = NULL;
1 @ M/ l- c6 i) v/ r5 P
! p2 t1 b; k; L/ p+ L# M' u- static int acnt = 512;
( X! j6 |5 D/ ~+ m, j - static int bcnt = 8;* a& r9 F6 R+ p1 o1 x
- static int ccnt = 8;6 x* c$ D8 x+ Y* ~* E9 e8 k+ w
; |: l( w# ]' v1 L2 _5 N0 G4 h- module_param(acnt, int, S_IRUGO);- u( g1 ?' c. O
- module_param(bcnt, int, S_IRUGO);
" H- D: ~- S1 |/ ` - module_param(ccnt, int, S_IRUGO);
复制代码
6 Y. m5 D" x" U/ b; ^1 w' j8 Y. V8 _& ~8 v: g" d7 `; S# K+ m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( r& U! f9 H; s7 x4 s3 R! ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 p5 q. u$ V8 y* z" d1 X7 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 e6 I E- |- n( V6 M! p6 m( O
; ~3 a! x) r1 p
|
|