|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ?* ~0 V# p2 `* A5 s2 `
- [code]EDMA sample test application& O) L7 D: m6 y- ]% ^5 ]0 \" Z
- /*/ B/ Z, g8 g; z3 z5 l" a
- * edma_test.c
8 B* ]9 B3 u7 V0 l2 D* S8 B, Q% G, k - *( Q9 t" }2 }/ ]) ?% b; d
- * brief EDMA3 Test Application
/ F l3 X+ X$ R1 G* F+ b% e) b: N& d - *. w3 a F; c4 e. V& c! a7 M
- * This file contains EDMA3 Test code.) X9 z' q0 a6 a0 B5 l
- *8 u# z# K! D y1 H; G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( n' A) q( r, e+ } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 G6 ]; Y* u& s, Q* ~; C
- * TO CHANGE.9 F9 u1 O: v. ?; j' H ~2 Q
- *
- b6 h5 h$ L$ v# R0 N, J% d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) p& [$ P7 l+ s4 b1 {$ _( _- c
- *+ q. G) u m7 D! E
- * This program is free software; you can redistribute it and/or
* R2 K6 K$ Q' S) j" ` O8 z" H - * modify it under the terms of the GNU General Public License as
9 p9 i8 d& B k! N' P# ? - * published by the Free Software Foundation version 2.
% ~& O1 N1 B* d q3 G - *
- [) i( a1 `8 `) O* x+ k, ~, Z: ]3 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# o& T8 j% L9 c: d/ s" h3 e - * kind, whether express or implied; without even the implied warranty
4 j8 l" j8 h8 t1 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ R; [! R# e8 M1 u1 U" x9 l5 c
- * GNU General Public License for more details.
7 |# A7 t4 j/ U/ M& w% x - */
; Y8 z T- B( z c0 E; _, Y. d: A - : d$ u/ e0 F9 c8 D& o
- #include <linux/module.h>+ a/ @. k7 v0 S, a9 o: O! D
- #include <linux/init.h>% e) \ F7 ]% E3 u7 [
- #include <linux/errno.h>
+ F* {' R4 e+ G! c9 {9 X - #include <linux/types.h>* e7 |/ F. j8 i6 c5 U8 D; ]; E
- #include <linux/interrupt.h>
, [1 b! O) j% ~+ f( @ P& u - #include <asm/io.h>! w& ?# i0 H( A- z6 u" Y
- #include <linux/moduleparam.h>' I c- m) q9 x/ }: I: t3 U! n" g# t
- #include <linux/sysctl.h>0 @$ I/ X3 D+ G% p0 T1 F/ z
- #include <linux/mm.h>3 s* j* `9 g9 J7 o C
- #include <linux/dma-mapping.h>% n$ T, Y% o: W1 M' X' u, ^; S8 I
- 1 {5 M3 K' S ?+ {, {8 l
- #include <mach/memory.h>
' x) Z3 d; E' H3 K - #include <mach/hardware.h>
% T6 w: R: b* r4 w - #include <mach/irqs.h>2 c& E# J# S+ Z9 x% F0 l+ l" A
- #include <asm/hardware/edma.h>9 `4 W2 J: k) f6 v
- + Y# C% v( z% X/ b# }! l* F
- #undef EDMA3_DEBUG! V }, f7 m- b9 j
- /*#define EDMA3_DEBUG*/- }& H. e6 y9 X
/ t, V& R* K) C1 Y8 t+ J, W: ^3 F! H- #ifdef EDMA3_DEBUG- {- K. W- X o2 l u" z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 C7 [7 P. ? Z) R. u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 [6 ]& h, O& b# M% M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# B9 }) ^2 k5 j) d
- #else! O+ _- X1 F; k& _ L9 [1 H$ l
- #define DMA_PRINTK( x... )
1 n ?, v. C( ]: H2 t% T - #define DMA_FN_IN- d, ^$ ?; j# H# t9 R: @
- #define DMA_FN_OUT$ J* d) \4 Q6 J1 Z2 N$ {
- #endif. G& T/ s V7 f9 a" q
1 Y: r1 p! v$ j( z+ y7 s3 R* y- #define MAX_DMA_TRANSFER_IN_BYTES (32768), T- g" a* s6 R, W1 F
- #define STATIC_SHIFT 3 p2 ~1 V/ v+ a. ]0 ?
- #define TCINTEN_SHIFT 20/ J' w# ~4 _. e3 _; C3 o
- #define ITCINTEN_SHIFT 21: g( Y/ A' n5 `. k; @ ~: `
- #define TCCHEN_SHIFT 22) \% e/ q# C. y& n6 u; e- w8 L
- #define ITCCHEN_SHIFT 23
6 K" [; v4 F1 P
0 e! R0 }$ E4 v4 H$ V0 f) b6 N- static volatile int irqraised1 = 0;3 k% T6 w: k! Y
- static volatile int irqraised2 = 0;
: `7 X$ w& @ j1 | - 2 o2 g* Q' u. ~4 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ s5 J3 E' c0 `( p7 w" T! } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- k+ {5 W0 j- N h$ [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- O- ~5 @, n6 S; ~5 A9 d
- / f2 F+ z3 O( R
- dma_addr_t dmaphyssrc1 = 0;( R! Z4 c8 a5 b+ P7 [6 ^
- dma_addr_t dmaphyssrc2 = 0;
4 H, t% O# c E9 `- X2 N, I# i - dma_addr_t dmaphysdest1 = 0;
( s( l1 l6 t/ q* A- x - dma_addr_t dmaphysdest2 = 0;
1 P. ]6 ]( F/ d% r" l l
2 u: t4 b) h; A% C3 x U- char *dmabufsrc1 = NULL;( H3 o0 a6 f* ^4 O1 j, k% o
- char *dmabufsrc2 = NULL;% B7 K2 C- I0 C0 _$ V- U
- char *dmabufdest1 = NULL;
" T/ Z7 t, W; ?0 f/ \+ h) C - char *dmabufdest2 = NULL;
: A9 b# y% s7 H) a' H6 g - : \ v7 q/ ]) g; U3 N0 }9 @7 ^3 E
- static int acnt = 512;
# t8 ?" R8 U+ r4 b- h; \, O - static int bcnt = 8;0 T& `6 Q9 k3 _0 N; ]
- static int ccnt = 8; `( @7 u# c, m* G! ~
. v% h, s7 g( E M( N- module_param(acnt, int, S_IRUGO);
+ k2 @' Z; b4 C. m6 t5 U - module_param(bcnt, int, S_IRUGO);+ z- S" W, y. h; o
- module_param(ccnt, int, S_IRUGO);
复制代码
% H& U! _! |: k% A( L0 H( O/ o/ G5 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( w' S9 `3 [) X) v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) k: b3 J% J, ~9 t% a9 Q' y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 b3 Z X7 b: a+ M5 Y- s' I- o
6 E: q- \# W' [8 ~; T; u
- O! J/ H; j2 p8 |. w |
|