|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 _1 v9 N2 h0 W# c$ G- [code]EDMA sample test application# y5 [6 k$ X2 O; [" ^
- /** N: A' E* F( Y2 Y
- * edma_test.c* y4 [; d1 T; h
- *$ `# M/ e3 T G9 n* G
- * brief EDMA3 Test Application
0 `, p2 z( [6 j4 S& R: p1 P% V& { - *! I- v7 B& B" i( I& s
- * This file contains EDMA3 Test code.* s3 z m, Y+ `7 O2 ]8 L+ ]
- *
- t; Y( v- @, r1 r( H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ q0 G( t! a5 w: @- G7 S4 V% }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 \* [$ b- X2 ^' o; v% w) ~ - * TO CHANGE.
' ?$ R/ o( A2 @0 I3 s7 b- u - *
/ z! Y* L1 o( P9 L9 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 h& ]- b5 \( c( C/ l - *
1 j& H5 R/ U7 p; N - * This program is free software; you can redistribute it and/or5 g& w* l6 n; c w' q( N) u
- * modify it under the terms of the GNU General Public License as" S! [% M1 @5 p# T
- * published by the Free Software Foundation version 2.0 {; Q9 O8 N) M3 {2 j5 p
- *) E7 [/ c: o4 l- c5 g/ F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% x1 {/ s, r, h( t
- * kind, whether express or implied; without even the implied warranty# V6 f: v: g+ h1 B6 O4 z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ e$ W k( k8 e& a* Q
- * GNU General Public License for more details.
E/ o5 ~; t, h. Z. z - */+ s7 ^' W- ~* c# ^, S* C$ x
9 }' ?7 J w3 P: X- #include <linux/module.h>5 y- Q: j4 @1 b- L" a
- #include <linux/init.h>
5 G5 q/ j4 h: f( d- x9 { - #include <linux/errno.h>" Z, P5 D, W5 b
- #include <linux/types.h>
$ z t8 g R% X( `$ c6 q - #include <linux/interrupt.h>7 N" ]2 V) h' Y0 R
- #include <asm/io.h>
, y( K! s1 N% S0 q& y, k8 U - #include <linux/moduleparam.h>1 c( d& }! k; f. O4 t3 M! X
- #include <linux/sysctl.h>
4 a {& n" n' q$ |' I& C! L6 a$ r - #include <linux/mm.h>: r- j' X5 b/ g7 h1 ?/ y2 z4 U: O
- #include <linux/dma-mapping.h>. \ A+ P# S1 t+ {) ~
# V: P; v$ |4 T3 G/ E7 p6 w9 J- #include <mach/memory.h>5 i# T9 V$ r) k) y( n6 Q$ r
- #include <mach/hardware.h>6 R& h# c- C; E2 @$ E( g6 |2 w" s0 G
- #include <mach/irqs.h>
( D# K% F, |- F - #include <asm/hardware/edma.h>6 j0 M/ m8 ~% Y2 v4 K
- ' m( x H) k* E- z
- #undef EDMA3_DEBUG
$ U2 G5 c1 w# r - /*#define EDMA3_DEBUG*/" O+ P; ^# X: u# J2 e# Q$ E
- 8 e6 [' Y" b5 x
- #ifdef EDMA3_DEBUG
- |: J% L# W, E$ K& x' U1 H" Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' x2 ^, c0 \9 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y% L, P5 _; S& K0 ?* k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 O; D7 `. x* t+ O D$ w
- #else
+ Z3 x+ F" ?2 q A) E: ] V) i - #define DMA_PRINTK( x... )
- o1 b( R7 X4 E: q6 T- F8 Z& q - #define DMA_FN_IN2 P% E, W/ \4 p6 \
- #define DMA_FN_OUT
) T. `5 |# H9 L4 s - #endif4 [$ O/ e0 J/ Q
1 |$ G5 B8 {0 D2 M1 _8 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( P' C, ` e t" U) O - #define STATIC_SHIFT 3
' C; J7 Y$ y5 o0 O, P% j* P - #define TCINTEN_SHIFT 20/ y8 t' p, \: I2 R, W" p R9 a
- #define ITCINTEN_SHIFT 218 s5 g+ P$ D. \
- #define TCCHEN_SHIFT 22
" C3 g) p+ i' [! m% ]& T: y - #define ITCCHEN_SHIFT 233 v" d0 C, p8 s c' X6 v; Q
- ( A, X* }6 `* G7 p8 \
- static volatile int irqraised1 = 0;7 W A8 q; C6 N) n1 C; e
- static volatile int irqraised2 = 0;
* U& a4 n2 H1 }4 U' |, P
/ q) R7 G2 A4 U- E9 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); D/ J& U1 W6 ^7 }+ X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ `& P- A) e7 u# i& j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 h8 T2 p3 m, ]
3 S7 h5 P t, m& j6 B6 W- dma_addr_t dmaphyssrc1 = 0;
6 K& ^) ]6 @5 `: R- X" ~6 O, A - dma_addr_t dmaphyssrc2 = 0;( j0 w- A+ Q5 P
- dma_addr_t dmaphysdest1 = 0;
& C1 h1 E! O$ p. o - dma_addr_t dmaphysdest2 = 0;
9 X! k/ f2 E: v. \# y
8 K! m/ F, }* W; u- char *dmabufsrc1 = NULL;
+ R/ w9 _1 w+ i% w7 ? - char *dmabufsrc2 = NULL;
4 g4 ]0 h( P7 ^6 R$ B - char *dmabufdest1 = NULL;* M, y1 k6 F3 y9 R6 b
- char *dmabufdest2 = NULL;+ m: J8 a. o5 X) ?# L
8 [0 ]& I' L% E3 ? ?4 L- static int acnt = 512;
( z, L3 ~: u4 [5 K' q - static int bcnt = 8;$ \2 G6 s6 f) C# e+ O
- static int ccnt = 8;' b- ~" G6 ]% v. M- p9 p
9 C7 y+ @8 M( f Y. T3 J6 A/ t3 Z- module_param(acnt, int, S_IRUGO);% b1 L: {; G2 K N5 k
- module_param(bcnt, int, S_IRUGO);
" i* ^2 s7 z4 R) A8 u$ C - module_param(ccnt, int, S_IRUGO);
复制代码
" M2 h6 U' j- y5 [2 G( t
* t1 i% r5 |; c$ i; o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 J$ r6 A8 M( S& g Q: v$ aarm-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 S. H3 _! L8 H) g2 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# R9 Z6 a) \: d1 A
" {/ ^/ p' r$ v- a& B4 B3 s' h. _ G S4 v
|
|