|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; _% t6 b: [7 q G- ^% C- [code]EDMA sample test application
8 Q+ x2 x0 W2 z1 O* F x2 l - /*. O+ L' F2 N6 M3 e( n! i
- * edma_test.c$ d$ V- e/ U. |9 X/ M% r# K N
- *
9 Q' A8 a; A5 u# \8 \( ?0 w* O - * brief EDMA3 Test Application
9 B% v4 W* q0 G- g - *0 L2 k i3 B' a v% \. U: i+ d1 i
- * This file contains EDMA3 Test code.
. \! t! G/ M# T- h# x - *0 D$ r5 [1 o0 ?0 ?$ X% E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ b) Z3 c8 g( F$ u- @$ s7 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. y- v; C2 R8 m - * TO CHANGE.
( w; s% |3 E/ c5 A - *# ?/ |9 ^9 K/ b3 R- k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. }3 k! @) K6 ^7 K( F
- *
% A$ ]: [/ s* e' W - * This program is free software; you can redistribute it and/or
8 i4 m7 [" L: K5 ^6 U9 n - * modify it under the terms of the GNU General Public License as; S' S# O& X3 R: \5 B7 J
- * published by the Free Software Foundation version 2.
: o7 _, t8 w8 b- E9 k, p" s* Y - *
: T1 |5 F7 H' b& R' | g8 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; o2 d: l* e6 j! c; C' n4 g - * kind, whether express or implied; without even the implied warranty6 _' H& C( h( z$ x; C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' V, N5 R! P& K - * GNU General Public License for more details.1 q1 q, f* u3 p0 g8 A ?: |
- */
$ W* s0 b1 p. o" B/ a - $ k/ j- Z) N5 K' a
- #include <linux/module.h>( k& e* p' V: b
- #include <linux/init.h>
, d4 f/ E, }2 D5 [ - #include <linux/errno.h>) W) m+ Q! b# a, d" {* ~, Z
- #include <linux/types.h>( S) j+ [8 I5 L l3 V
- #include <linux/interrupt.h>$ z, Q" V! L6 `9 G+ z1 L& y
- #include <asm/io.h>+ X A2 ]5 k( P. J
- #include <linux/moduleparam.h>
$ ^$ ~' v& e% \; D* c: Z. K' k - #include <linux/sysctl.h>+ U5 h9 _2 [9 r" B; f
- #include <linux/mm.h>( k0 O* ~+ T/ y6 W
- #include <linux/dma-mapping.h>
4 f* o1 Q$ G" C* `6 e* ]
2 x$ i4 d- {+ x- #include <mach/memory.h>
( L5 k# A6 t3 W! ~& | - #include <mach/hardware.h># e3 u/ Q! t p0 N
- #include <mach/irqs.h>
6 P. E# }. S) } - #include <asm/hardware/edma.h># i% H/ C- c% Z" a* c2 N: d
& b: b' e# R& n+ j& ~ M& V- #undef EDMA3_DEBUG
3 i( y0 ]2 b: u6 }4 W. X - /*#define EDMA3_DEBUG*/
7 s8 @* N8 O. w2 e, p6 B - " N6 E3 p% T2 i& N4 ]4 P2 D5 w+ i( A
- #ifdef EDMA3_DEBUG( \0 V; x/ S& L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% N/ `7 ~# p C( ]" J! G& t0 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! S _) z4 H4 T: D3 a- A' ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), w. v6 r8 J% u; V" K
- #else
1 N/ `6 r8 V$ K. n+ b0 X6 g( Y' F5 [/ V - #define DMA_PRINTK( x... )
" w& ?1 o+ a) M4 t- X) o - #define DMA_FN_IN
" W( v8 K# ~ x, J @( E7 u - #define DMA_FN_OUT
+ b9 e6 j. |$ l6 O: D$ W+ w0 } - #endif
5 l7 U+ i' P' G; M' k1 b7 f - ! C! _0 r0 \5 t Z: ~0 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 Z& w' U* Q/ ^, b+ R7 V) y4 L, A - #define STATIC_SHIFT 33 j7 s3 W! k+ i2 q
- #define TCINTEN_SHIFT 20# f# D! q: u8 k$ v# w' ~7 w
- #define ITCINTEN_SHIFT 21& [6 O, s3 @+ H4 D% R
- #define TCCHEN_SHIFT 22' D5 O: P4 ]/ z: ~+ H2 g8 I3 N
- #define ITCCHEN_SHIFT 23+ h# n7 B0 J' m+ K6 Z. g
* t- ~2 M" o- s: t: X- static volatile int irqraised1 = 0;
' `( J, h! }6 \7 }4 A: Y! l2 q/ w+ X - static volatile int irqraised2 = 0;, d6 y- R( t8 G9 s
- 4 d. X. n7 |1 u. t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C, y2 y" ^4 v* ^: U! t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J: J+ g* U* D# [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
}" ?- g* z, l( V0 D" h - 5 \/ q4 Q5 X! N# f
- dma_addr_t dmaphyssrc1 = 0;
4 M k! H7 x( x, S& S+ q - dma_addr_t dmaphyssrc2 = 0;
4 A7 Q% u7 M2 m: Q- f2 S- t. L - dma_addr_t dmaphysdest1 = 0;
& d/ Y1 y4 k3 F7 x - dma_addr_t dmaphysdest2 = 0;
% d% q! M: y) \ - 5 P+ q7 Y. c* ^
- char *dmabufsrc1 = NULL;3 j+ @: o& D0 S2 \; Z- |- [
- char *dmabufsrc2 = NULL;
# E; y4 l# D9 L# ?4 b+ e, x& a. e1 l - char *dmabufdest1 = NULL;
2 @) d) D& K* D/ W' B - char *dmabufdest2 = NULL;, o' T- u3 Q, Y1 S7 q4 ?
- - ^' d% ^3 S. G! ~8 U1 Z2 N# y) K
- static int acnt = 512;
- a5 b; K; ]3 ]0 T ` - static int bcnt = 8;
, b% f) |3 E/ s - static int ccnt = 8;1 t) O% L: c h9 i/ ?9 v0 a ?
- 6 g4 H/ K, E' c* T
- module_param(acnt, int, S_IRUGO);& x/ a& k1 ?$ V4 G+ v# f4 C& l
- module_param(bcnt, int, S_IRUGO);
- e4 R) f0 V2 H. Q5 u - module_param(ccnt, int, S_IRUGO);
复制代码 * U( Z: `3 [: o4 g2 s7 X a# W: i
' n/ w! V5 y9 X$ S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R& f- ~5 L( y$ a marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 s8 S2 _- m$ }4 l e. I, ?* I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Y# q- Y) [, [. e) e) H" e/ {3 z
b5 F% s1 n0 S+ B* a
0 i) B, m* I) w- C0 B! c7 y |
|