|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) [2 M- @8 o# J3 c! |- [code]EDMA sample test application" e: G* E, T& v: f
- /*6 D, V" e* k4 o# F% q* U
- * edma_test.c
+ C/ c% f) X9 _ f) U: o - *
- f, W5 H7 O" t" h! _7 T- G# B - * brief EDMA3 Test Application
+ i. g7 Y, Y$ c1 g - *: y( |- p2 T$ U; C% i' O% h' D
- * This file contains EDMA3 Test code.4 ^6 p2 ^ p& N# U
- *% M5 C. F) }( v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 S! D& z t1 R" a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 C4 V9 \" X2 O r, b
- * TO CHANGE.: s. y0 W# k) e) ^% S. |( x
- *2 z' p, K. L% t+ U% ]$ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
t/ @6 ?! h' e5 h4 T( t% Z. _& a - *9 [" U: w: K) B) x" J) X) a3 y
- * This program is free software; you can redistribute it and/or2 C& `! _- Q, b, v5 D
- * modify it under the terms of the GNU General Public License as, T* a: |8 E& v2 F* Z5 T
- * published by the Free Software Foundation version 2.8 r2 d) \- X) C+ }7 l* j
- */ b6 |% x: h/ R/ R" I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% y+ Y8 S/ P% M; w
- * kind, whether express or implied; without even the implied warranty
% q/ o! p* `1 h4 T8 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) d0 c4 N7 W- L& X0 l - * GNU General Public License for more details.
% P1 t: O' {0 r; Y+ q o+ u2 F - */
1 I4 w5 w4 m5 Q' S( q V3 R3 g2 @2 C - ! `' E3 B3 h& J0 P- n! p
- #include <linux/module.h>8 D7 |" P6 j6 N) q* m7 I* F' C+ J3 n
- #include <linux/init.h>
1 g, C. Y3 W; y0 `; {3 h* } - #include <linux/errno.h>3 U7 ]4 Y! g* ^$ b; j: B7 I
- #include <linux/types.h>
, U6 I5 w' o0 O# _1 ]) \ - #include <linux/interrupt.h>
8 M( S B D) s. G9 [7 X - #include <asm/io.h>
4 @; J% n( ]7 ?0 |3 G9 S/ r9 a: p - #include <linux/moduleparam.h>* z' j5 l! s$ u) q# D; V% R. U: v2 I& H
- #include <linux/sysctl.h>8 W+ x4 e9 e! T3 o- o$ \3 h: C
- #include <linux/mm.h>
' J4 k# { f: f2 I; i - #include <linux/dma-mapping.h>6 O: R3 s) k/ n
- B. H' |2 D, y9 y- M- #include <mach/memory.h># ^& L8 ^( I8 C& e0 Y2 x
- #include <mach/hardware.h>
: p0 s {2 D, J* u: x2 u1 m# Y - #include <mach/irqs.h>
7 F4 w; j! ~ @( @ - #include <asm/hardware/edma.h>
- c4 n+ H" l o) `0 J4 M, T+ r( c% N
& m: g/ a ?- ~( q1 e- #undef EDMA3_DEBUG6 U/ F$ t z9 @. T Z
- /*#define EDMA3_DEBUG*/
. d I) ]5 Z3 b0 O. o& B
/ s, |+ y9 v! e4 X9 ?- E3 y" z- #ifdef EDMA3_DEBUG
" W1 U. j$ Z- W. G8 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 o' u2 U, T3 S# N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, q7 Z: g7 y8 a; P9 p! R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Y1 E, z! \3 f' R& Q
- #else
' }: |8 @) d) h5 O7 z - #define DMA_PRINTK( x... )
8 l0 |- q3 P6 T' y) N - #define DMA_FN_IN9 x: }) v( F+ t0 I/ y) }* f
- #define DMA_FN_OUT
# h) _. M4 N' X8 \5 h' Z - #endif
. ^$ R! E" t7 R- d' a - * F! ]. t6 ^# r$ O4 C( u& _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% W) m+ F0 Q: S' u5 r - #define STATIC_SHIFT 3
$ [, s4 m; F3 ]# w0 L0 ] - #define TCINTEN_SHIFT 20# P$ ?9 p$ E6 S: s+ c
- #define ITCINTEN_SHIFT 211 d! y$ W# s2 R
- #define TCCHEN_SHIFT 22
6 `* L/ F3 a& q - #define ITCCHEN_SHIFT 23! d. _9 P% ~1 o w2 E, S
- ( m9 T8 X! }6 K8 k1 J
- static volatile int irqraised1 = 0;. C5 k; r3 S+ X8 T
- static volatile int irqraised2 = 0;. ~( v# z( k# c& y8 [! C" |
Y, G3 w- q! p2 c5 }% @) H. a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \" x1 m N" P; l( g# s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A5 u( f1 i* @* `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' G2 h- J6 c6 N2 ?5 m# w0 y( W - " A7 k) s @2 D8 D/ R/ U
- dma_addr_t dmaphyssrc1 = 0;
1 t5 Z% X1 l- y5 K8 z! \ - dma_addr_t dmaphyssrc2 = 0;
8 {( ?- `7 M1 b* r+ R7 i6 f - dma_addr_t dmaphysdest1 = 0;, A$ }% J/ j# N6 i
- dma_addr_t dmaphysdest2 = 0;
' `" B& c. }% F
) C- f5 e5 L8 i1 |) a4 x% K- char *dmabufsrc1 = NULL;8 f) q$ ^2 h$ s( I* k
- char *dmabufsrc2 = NULL;: B1 z' R& _, k$ M9 O! x
- char *dmabufdest1 = NULL;
" R) ~# d0 ?3 P6 \ - char *dmabufdest2 = NULL; ~$ ?( M* g$ [1 X
: @% \$ K! L" B6 w; T' z- static int acnt = 512;+ e3 ^9 Y3 B) Z, H3 U; U
- static int bcnt = 8;6 u" h$ N( N/ T
- static int ccnt = 8;
7 Y3 r0 F: K6 ?7 j" i6 j
' b& H! C s5 D" {+ j- module_param(acnt, int, S_IRUGO);( I* ?$ `4 e* v6 x# U8 n( y
- module_param(bcnt, int, S_IRUGO);' b n7 k4 t- l
- module_param(ccnt, int, S_IRUGO);
复制代码 9 U" i. u2 `# m4 [* z% q5 z. }, L
/ u K( [1 U" n) V, H" O+ r; m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 K7 O/ W: _# p. a8 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) c6 I3 S9 ]. W3 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 k8 w4 K: i* `/ C/ u+ w
t7 `: M! j5 q7 s0 j
) c* I+ {, H* a' G# t8 g
|
|