|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! @$ D1 K3 ~' c- V$ E, K) T% G, t
- [code]EDMA sample test application
; c0 X. b% d. }) e$ l9 G - /*
! b4 w2 v0 ]; ] - * edma_test.c7 q6 @+ T9 X, I' c
- *
% C" ]4 z, w7 o$ q! n - * brief EDMA3 Test Application
# F1 V$ h0 O7 V) { - *" l1 z2 \( x, i! L5 e: {6 |- }
- * This file contains EDMA3 Test code.
: h) c4 r: J; ]9 l& N- o/ n - * Q& k: A5 R7 T: i) j. W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( }+ b( w- B/ A- E! z( v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Q6 v5 J* \3 H) B7 s - * TO CHANGE.
$ _9 X7 p7 n/ p, Q% S - *
2 `8 j) H# M/ p# q2 K1 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 o: u3 {* ~( y - ** y W: u5 i' S8 K7 ~' M6 @1 J' L
- * This program is free software; you can redistribute it and/or
1 ^% j. p) f! a0 C. Q7 d6 O - * modify it under the terms of the GNU General Public License as) p4 A! v. ^: C# k
- * published by the Free Software Foundation version 2.+ Y( w( H- d3 C& ^4 ?! ]) E9 E
- *
, @: @/ c. F: _5 y/ r! p: E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Q! h. M) d/ X0 I8 |" N/ c
- * kind, whether express or implied; without even the implied warranty
. O; Q6 r+ @1 R" |) g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 l- Z5 c$ I1 F, H; j! V# a
- * GNU General Public License for more details.
: H* l, A; ?# d: O v- C8 s5 z - */3 r5 d& _0 d$ s7 w6 U2 O) X: _* J
- # {9 [3 d/ s# |# G/ t8 Z3 ~3 Q. |/ x
- #include <linux/module.h>" V, Q, ?) a4 {! F3 o
- #include <linux/init.h>
4 T# x4 J6 R. P; D) k - #include <linux/errno.h>
6 Y- B' q9 L8 V0 Z# @- p6 ]2 m - #include <linux/types.h>
' z( w# X& F- l" U ` - #include <linux/interrupt.h>
1 c1 W. S/ e+ b/ { - #include <asm/io.h>* `6 n* p: N/ [- Y2 l
- #include <linux/moduleparam.h>) ?1 X4 m4 T$ a& _& S3 q) I$ C
- #include <linux/sysctl.h>4 i- i4 H8 d4 O* f$ f% [8 N
- #include <linux/mm.h>, j: k. q/ W4 x' t1 J5 {* w
- #include <linux/dma-mapping.h>* W# P. y' [% G, { E y$ s0 `4 p
' }' G8 g2 @5 h3 s7 A$ _- #include <mach/memory.h>. b4 X+ [4 E- U5 C# w1 I" f1 f: I
- #include <mach/hardware.h>
5 h: g6 c1 j- z4 a2 ? - #include <mach/irqs.h>
0 f5 @% l! u0 V9 d) C1 g; \ - #include <asm/hardware/edma.h>5 O+ o3 K; z$ a8 z
- 7 P) R& H5 H- {% L
- #undef EDMA3_DEBUG1 u7 G+ v& E" F/ Z/ o
- /*#define EDMA3_DEBUG*/
$ H! V# s$ K% g9 W. w5 Y* `. [ - * ~2 \" O0 ], N1 T0 G
- #ifdef EDMA3_DEBUG2 _( o0 w4 I$ b, v: q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 _$ U; B0 f0 G9 g8 u" p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 g, i5 I6 }9 t8 p# @* @' I/ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 B r- m0 |7 \! f) ? - #else6 d* B0 i6 M `# J6 |5 _( z/ J
- #define DMA_PRINTK( x... )1 }4 X& s+ @) {! @
- #define DMA_FN_IN$ D9 N3 M. z; x' T
- #define DMA_FN_OUT
$ g, p4 t: M: a2 { - #endif" J/ g3 R1 q" _, o+ x6 s }
- ) c B1 A A" [* i5 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) r/ R/ `4 [) f& v1 G% M- B7 ~7 [
- #define STATIC_SHIFT 3% m7 K3 G5 K- H0 y# V. Y
- #define TCINTEN_SHIFT 20
3 ^9 D, |- L$ [ s: T& K2 Z - #define ITCINTEN_SHIFT 21
; v' n) N3 P5 Y - #define TCCHEN_SHIFT 22
$ ?$ y) |. J9 `# @ - #define ITCCHEN_SHIFT 236 ], D( F% M! i3 i i& t) l
% _5 f' {/ g8 R3 D/ D7 _- static volatile int irqraised1 = 0;
. ~: k! S. K5 W- U& Q5 C - static volatile int irqraised2 = 0;! K! v: P: _: f& N- k Q( m
/ ?$ q- A. W8 Z: I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ s# W' {4 g3 E, z2 Y# S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E; i- u, v% |9 J9 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 M4 E: t, H' l( l2 W1 Y6 t4 Q
# r7 M2 t4 m2 u m) E5 O- dma_addr_t dmaphyssrc1 = 0;* I& B5 K N" g1 f# |4 x6 R* K
- dma_addr_t dmaphyssrc2 = 0;( F& F& r9 p7 j9 l6 m
- dma_addr_t dmaphysdest1 = 0;
6 s. C N; Y% |( L- O) ~ - dma_addr_t dmaphysdest2 = 0;
# V( E: f: R& N8 x
- D* N% z# F3 D: k( ^- char *dmabufsrc1 = NULL;
) f( `0 W3 b, Y/ Q* v0 E - char *dmabufsrc2 = NULL;& { D8 l6 f" o; M6 X
- char *dmabufdest1 = NULL;
! f% _: n3 O1 t) Z( P9 s - char *dmabufdest2 = NULL;3 [$ d! ^- z5 }
9 }$ b+ z; k. k% h- static int acnt = 512;% W q' y5 T0 E$ F
- static int bcnt = 8;
- |: G$ B8 ?' q1 M) V - static int ccnt = 8;) [/ o0 q! S9 h0 U$ b+ b% K
( s9 x/ L6 Q. ]4 x6 k' K1 H7 y7 Y- module_param(acnt, int, S_IRUGO);" b5 B5 W3 |; Z( g# L0 ]
- module_param(bcnt, int, S_IRUGO);3 |6 [- [! ^0 V( k9 l) A
- module_param(ccnt, int, S_IRUGO);
复制代码 ' `5 _% Z& V& u% q
& q! H* e R6 i7 D) H1 ~9 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 `) c2 u; b' y' l; r. farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) z" V6 I( m7 z3 g8 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 Q5 O0 z1 D0 V9 B
% Y f, R. P7 O0 W3 P# f* a0 Y. x+ S* Y) j
|
|