|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : E! b: M H3 ^8 B. S C j* ]% y3 P
- [code]EDMA sample test application
, O2 X, Y& c* [ - /*, e! N6 Z3 z/ x. \
- * edma_test.c) F2 S I' v" n
- *1 P0 y# K: |0 G6 ~5 N! t Q
- * brief EDMA3 Test Application4 h2 @- h) M% T
- *8 ~/ V- X7 h) ]
- * This file contains EDMA3 Test code.- o1 q- C8 J. v- T" R% }
- *
4 N6 Z# U1 R' I) ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 z- b' }; e0 T; s4 x8 ^' c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 y& m7 G% {; T; h4 a' n. V4 s - * TO CHANGE.
4 o: g0 q! Q2 K4 a5 y6 p - *
6 Q0 y1 Q( a8 p% S6 N; D7 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 X; p: G' q# P Y! U
- *
* R5 p! I) h7 C% L' c( X - * This program is free software; you can redistribute it and/or
7 O) v# Z. ~2 t; {" e - * modify it under the terms of the GNU General Public License as( s; E. j6 p5 {, M( D i% Z/ O
- * published by the Free Software Foundation version 2.( W) x& K2 a7 V* C# `. j9 ]3 }
- *1 s1 t; ~1 q. \0 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) D4 g6 D* }$ H7 ~5 r - * kind, whether express or implied; without even the implied warranty% o# T N# h* D" E! A9 z4 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ f- f3 s8 a; E/ F - * GNU General Public License for more details.
+ F# j- E- y% b - */
7 i5 N5 V0 P, G& z
. s Y9 e+ \& E4 J/ L3 E- #include <linux/module.h>
/ i0 q" |* D: y' _! W3 v) \1 l - #include <linux/init.h>) I/ f5 L. _( j# S2 w
- #include <linux/errno.h>
?* `' p" C2 Z e - #include <linux/types.h>
4 l6 F; |$ u6 M. @ - #include <linux/interrupt.h>
0 {. k5 x. j9 I Q; D8 g' c7 m) a. | - #include <asm/io.h>2 c( v9 @, J+ w" j
- #include <linux/moduleparam.h>
8 g4 _( n7 u$ B0 c - #include <linux/sysctl.h>
( U/ G, V% a) L! g, T* V - #include <linux/mm.h>. t' _& q x( d/ g' [
- #include <linux/dma-mapping.h>
8 x! R8 a- K% Z+ ^3 b. o- q
9 ^3 j% D+ e2 A6 b. O) {2 F- #include <mach/memory.h>
( h f G+ ]/ U9 D5 J - #include <mach/hardware.h>
& N) s# s, U: A, D: z. }6 Q - #include <mach/irqs.h>2 J1 K7 P1 W8 ]; l! w- C
- #include <asm/hardware/edma.h>
0 z k/ z+ R- q4 ^
X# t% V) C- @% |% J3 o- #undef EDMA3_DEBUG" r6 X9 @+ X& Y7 p
- /*#define EDMA3_DEBUG*/# b# x ? j, x7 y
- 6 z8 h% G/ g3 W* l' y4 ]
- #ifdef EDMA3_DEBUG1 U& @/ }" L1 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m, [& v# `% h# N% @9 O% l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J$ P2 F9 l* U( f2 B o+ e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' E2 x) s. K* b0 i! A) W
- #else
" D( E1 V8 S: h, y2 G& X - #define DMA_PRINTK( x... )
R8 \' w# k1 m6 p - #define DMA_FN_IN! D& }9 n4 @2 z7 b6 }8 ~3 |( e1 J
- #define DMA_FN_OUT+ y2 F. {( t1 Z t- T
- #endif' Q: A9 _6 q) q- ~/ d1 m4 | p
) c1 e4 H) P y9 O3 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( J- @4 J# |# [# \5 X7 |6 ? - #define STATIC_SHIFT 3( K* D% g* b- O6 c- g K
- #define TCINTEN_SHIFT 20. l& \) O: o B! A" z2 p$ p5 a k
- #define ITCINTEN_SHIFT 21
% b% m$ {5 X/ n1 k - #define TCCHEN_SHIFT 22
: b, w" z& `1 G3 z2 ] - #define ITCCHEN_SHIFT 23
( c1 D& r- Y3 R
6 C% }# @& g% ]% v, k1 z- static volatile int irqraised1 = 0;& F6 F5 U* C, W, m7 [$ p/ o8 s
- static volatile int irqraised2 = 0;" Q" u1 W* [; i9 b: W" p! I' w$ ~
( d0 i# }5 u% B3 ~6 w5 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R' Y" d1 l9 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j8 m) G, H- p% s% x+ |5 B- T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P A2 ?7 g M5 L% Z
- ; y6 p0 y) D0 A' ~) E& m; D5 g* I
- dma_addr_t dmaphyssrc1 = 0;/ A$ R: I2 p1 j7 E
- dma_addr_t dmaphyssrc2 = 0;. v& M6 t: a! v/ b( U
- dma_addr_t dmaphysdest1 = 0;' U7 n4 p5 \3 C) Q0 p$ \
- dma_addr_t dmaphysdest2 = 0;
. m( \ `8 u# u- N! Q
$ Y _" `1 Y/ G6 x; ?+ p9 s# ^- char *dmabufsrc1 = NULL;
- @& j( N$ Z" ~. S - char *dmabufsrc2 = NULL;0 j* f6 \/ c; T( i4 n6 r6 c$ K
- char *dmabufdest1 = NULL;: n) p# o o, C4 K D* P0 |$ N6 R
- char *dmabufdest2 = NULL;
: l& Z% m2 z8 c+ n2 t- ?8 L! W
* |( N2 b' i" Z ?& P% E% b" i, R- static int acnt = 512;% ]6 t0 E4 e3 g4 G+ t8 E
- static int bcnt = 8;8 q8 S0 Y! x! H
- static int ccnt = 8;
, Q% ^4 \' Z' _$ ^0 d6 m
# D% r4 j; E1 I- module_param(acnt, int, S_IRUGO);
( H! S* A; |3 | {' P! @! a: x( P - module_param(bcnt, int, S_IRUGO);9 E+ T( c7 E- k2 Z/ h, v( t
- module_param(ccnt, int, S_IRUGO);
复制代码
$ `/ O9 m3 J* l2 [3 y& r7 d" m9 a2 ]( k9 u4 j! ]; E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 t3 Q5 ]6 F3 h6 |3 |4 i+ z& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 y+ ^& _! z2 F6 W4 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! w% k+ ?8 Q: A& A4 Q8 ~- `& \ T
3 F' y, t" E, x! ]) L
2 ]- b* s! j2 w5 {8 R1 H |
|