|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' n% p6 T0 r( t3 [
- [code]EDMA sample test application9 f! t) q: n0 `" I: f; q
- /*
! Z8 z4 ?/ ]" P' G6 F+ T2 H - * edma_test.c
8 i% `0 T* D ^5 F - *
9 d) z. Z( [& H# T - * brief EDMA3 Test Application& r" r1 z. e" ]' e$ a7 b
- *6 w/ i" Q3 C! Z! t9 y2 R
- * This file contains EDMA3 Test code.* }( T" l& I. v3 g0 t3 \+ w' u
- * W! b+ i( G) l& N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; o* h4 z6 L( s% z& ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* L0 I4 p J# ^* ?
- * TO CHANGE.% w+ C- h1 o7 f# J+ \9 h
- *4 |7 j" ~7 ~. P& g1 r( D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 n3 l9 T8 I4 x+ i3 B0 l - *
( b1 ^$ i: Q' v3 }. z- P - * This program is free software; you can redistribute it and/or
4 x/ \. a9 N8 G" _. N& z$ f - * modify it under the terms of the GNU General Public License as
# p7 j- a3 ]+ y1 D* a- } - * published by the Free Software Foundation version 2.9 I% _, @) ? Q& f. F
- *0 b K" s+ W" o% H8 U! E v; E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' [% P! U( N9 y, j' W' ? - * kind, whether express or implied; without even the implied warranty
# j5 _: v, x& V0 i( r7 I; s5 v( z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 m+ X$ ]0 C! P1 a5 m' b
- * GNU General Public License for more details.5 q+ p2 ^% m* \* W. w
- */; W! K) M/ }$ c; W1 I$ c
/ c# M) [' J% L& L5 V/ ^/ x3 y" ]- #include <linux/module.h>
. w" Z( j R( G7 t - #include <linux/init.h>
( b! A; Z2 m& U! a) e" E0 y& Z" Y - #include <linux/errno.h>
2 ~3 O9 l) k4 ` - #include <linux/types.h>
8 _ w+ G3 {. [# X& s, \ - #include <linux/interrupt.h>' [; r# r( ^& p% s4 W
- #include <asm/io.h>6 V: ?6 o S0 H1 e6 g; ?
- #include <linux/moduleparam.h>9 {1 { j3 `) F" P+ \
- #include <linux/sysctl.h>
& f6 }* d; ], f# y7 g) A - #include <linux/mm.h>. E$ ^" Z# O7 @4 K7 _+ x1 H
- #include <linux/dma-mapping.h>
- y7 K5 O$ B0 q( k1 k- i% t @' Y: { - , c$ l. `$ H! @7 A9 \) a
- #include <mach/memory.h>
* Q! O& l; | p8 G7 i7 X6 ~ - #include <mach/hardware.h>1 d0 N! S* R4 }4 p% z
- #include <mach/irqs.h>2 d) q1 @8 n9 y% l
- #include <asm/hardware/edma.h>
# n; k9 ]" j# D& Y - 6 ?! x3 t7 ~2 I' v8 j6 n( j6 z4 k$ r
- #undef EDMA3_DEBUG8 S5 J2 X1 d7 ^+ y
- /*#define EDMA3_DEBUG*/
U$ @ M+ a* J) V
' l& V* }) W. `- #ifdef EDMA3_DEBUG0 e+ [. B: W9 Q' X2 g; D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' L: P0 w: Q/ H5 u' C2 j8 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, f! A1 I) {- p6 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, i- l8 t/ q7 y( I3 w - #else
6 Y$ g% C3 z5 s" Z - #define DMA_PRINTK( x... )
+ B( @ M$ H& C- ~: w1 Z - #define DMA_FN_IN
9 _& y3 @3 J1 n* H - #define DMA_FN_OUT
' G9 K7 q R, N1 _; W. u6 w - #endif6 Y8 h" ~$ ~) h
" u0 R+ K9 i: }: a1 O/ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 F4 R8 F, ^; e; B3 K! ?% Z: G, ~
- #define STATIC_SHIFT 3
6 [( Q% F, r7 U$ o5 C& W" i - #define TCINTEN_SHIFT 20
' y7 e$ b8 ~5 e, h8 C, U - #define ITCINTEN_SHIFT 21
2 z% D" u* E1 ~4 O% f; X' b - #define TCCHEN_SHIFT 22
7 p) B- w9 M2 Q. u4 M2 K - #define ITCCHEN_SHIFT 23* d& v2 U3 Y+ J+ r3 o R7 [
* h5 O! F2 X) ^& Y- static volatile int irqraised1 = 0;
' f' L A' x( q$ w - static volatile int irqraised2 = 0;
0 ^+ C" s; U7 f; i; {2 W, B
# W$ j/ u' x) Q8 j( J# |4 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" S# J) P. O! _; M( ~; A, m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L* r/ [1 m' F! x% Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j( P8 C9 H. s9 v J! K& ?
/ `1 f, ^- {& r7 W1 C% _, x- dma_addr_t dmaphyssrc1 = 0;
6 ^) k l# O2 \3 i5 W. p - dma_addr_t dmaphyssrc2 = 0;- c. s: h4 S5 e1 Q4 N9 x4 u9 _& h% U
- dma_addr_t dmaphysdest1 = 0;1 l! S4 T/ L# Q
- dma_addr_t dmaphysdest2 = 0;
# U8 U' V- } i9 \
4 E3 t5 {: C/ M5 [7 X3 O2 }- char *dmabufsrc1 = NULL;
* }* m+ q/ T3 { E+ g W4 H, g G - char *dmabufsrc2 = NULL;
0 M4 s y; @# C7 g% S+ d$ ^ - char *dmabufdest1 = NULL;6 M6 b3 i- C& A" p% W" P
- char *dmabufdest2 = NULL;
& @/ O5 V" r8 ^* k/ r/ Z& T. L2 B& t
/ w( m! o/ W+ ]- static int acnt = 512;
7 a4 e% ~7 D6 f* I y& c' y s5 { - static int bcnt = 8;2 N$ N: _6 O$ {! w
- static int ccnt = 8;' L) a, Q+ F7 M k4 ^
- , N& V& e5 J1 L* m2 s* [
- module_param(acnt, int, S_IRUGO);
3 O" u. W' S6 [# Z( B8 W9 G5 I - module_param(bcnt, int, S_IRUGO);
$ G, b) A1 _. i! m( f! ` - module_param(ccnt, int, S_IRUGO);
复制代码
8 A% Z+ _# h7 e) z# s& @$ q/ T9 i. [5 x" K& q3 D% t- o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I, ~- L* p4 i% a; \5 v5 l( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& A# w% k1 K3 E4 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H& P7 @* H0 B' E; _4 v; {( k
0 m2 J1 Z- R- T) K
6 S% j8 z4 N+ `, n: d2 f |
|