|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Y) N$ P% j! N7 {8 ~! R- [code]EDMA sample test application
% ^! n8 w) W/ o) K8 E - /* T- q/ Y$ T# W2 f
- * edma_test.c; k k! h9 R% o& ~$ ?% x
- *
* [% P( @, c- z# p x& S - * brief EDMA3 Test Application+ l8 B, s# I- X
- *; t6 P3 \! X) C( k
- * This file contains EDMA3 Test code.
! \; R- e: r8 c5 B - *
+ Z" D5 C7 G/ U% f/ M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 G. [* `! c. V& k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
X5 f6 h7 z1 s9 f. B3 c - * TO CHANGE.
& F6 R. R; {- s m - */ B0 O' n% ]; j' P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f* Z$ h8 o5 y5 s" S& t2 Z
- *
: U. N% K1 k+ L5 t6 S+ {; ^8 t - * This program is free software; you can redistribute it and/or4 ^! c% _7 K& \; h
- * modify it under the terms of the GNU General Public License as& ]% c# _& }& B' S' B
- * published by the Free Software Foundation version 2.
1 f% V# r7 f1 ]; e! K+ X - *
2 H/ Y! z0 l6 [0 U/ o0 R) Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! @. x( R6 V. `1 l3 Z! L" ]0 v - * kind, whether express or implied; without even the implied warranty
7 |, d" ^/ p+ z ~* G7 ~% r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% }, ]( [- e& v8 { - * GNU General Public License for more details.
" f0 k1 S' t, s( a' |# l6 y - */
( p+ {$ O6 d' o5 Z4 R# a8 K# Q" \* j - 9 G( a1 {0 n, a8 Y
- #include <linux/module.h>
4 g; s3 ^/ T" Q - #include <linux/init.h>
( _, i* z& K; x/ v9 w6 P3 O - #include <linux/errno.h>9 K e, b# K+ U" r. F
- #include <linux/types.h>
* P' J/ o! ?$ f/ W6 G* H* O0 g H" ~ - #include <linux/interrupt.h>/ Y7 ^$ k- H8 R
- #include <asm/io.h>
1 H* g/ n: V |1 [% n) H$ @. H: D3 @ - #include <linux/moduleparam.h>( w! h% A1 y7 a S/ O0 L$ |8 T
- #include <linux/sysctl.h>
; j5 ~* O5 x: @$ y8 ] N* I - #include <linux/mm.h>: s; r0 |! J( o
- #include <linux/dma-mapping.h>
~: S* x8 }; `: n
( {% s1 [1 Y- k5 p. u2 A! c0 P- #include <mach/memory.h>9 q: J. x7 Z; d2 Y
- #include <mach/hardware.h>
1 K9 M3 _9 ^ M; h8 Y$ \ - #include <mach/irqs.h>7 ] D E* B u9 D- A" x0 E
- #include <asm/hardware/edma.h>
' R& q) p6 e: i" u - 8 L% W! D$ d2 G Y" h+ V* m
- #undef EDMA3_DEBUG- @' R/ F& g8 A# x
- /*#define EDMA3_DEBUG*/; G( Z' `+ E! s& B- B* B" R
- ( g) _2 V$ S* i2 L' V
- #ifdef EDMA3_DEBUG2 B! a. G' i9 c( o! o+ X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 J; v% k. R! D. u' @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n u% Q/ l9 r, y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `2 `% ]9 @& o$ U$ Q) l
- #else- o" Z# @' @) g* ]' m# V
- #define DMA_PRINTK( x... )' e3 h+ O. M7 C' B4 K5 u
- #define DMA_FN_IN: e; ^+ A! F! F" d# ^, C" \' O& `
- #define DMA_FN_OUT
$ @5 @1 I1 Q7 \9 s* q - #endif
) t/ r V: d _2 a. d
$ r: s" B4 i. C/ |6 }- V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' q1 U8 g& l8 [# L6 V
- #define STATIC_SHIFT 36 |9 z) f3 p3 A% V: ?
- #define TCINTEN_SHIFT 20
9 g d9 [. r, a7 ~ - #define ITCINTEN_SHIFT 21; s+ P* A$ a4 P) k# [* g
- #define TCCHEN_SHIFT 22
2 H& E# r. G6 X; X& S - #define ITCCHEN_SHIFT 23. [0 u7 x1 Z: r' [: ]# k# @
- - y: t) ^/ R4 W8 U0 W) Y
- static volatile int irqraised1 = 0;
2 _. i" D; g& E3 O; n' |3 [; V8 o - static volatile int irqraised2 = 0;
* a: Y5 C& j# x _: s
- f+ V- d$ }. {+ z$ }! }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W% _! Q. b0 b$ x# u) X! f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); o! R5 j0 b& s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |! B0 \! {2 M1 W, d% L4 e
6 |$ h$ u) J/ P- dma_addr_t dmaphyssrc1 = 0;0 k5 N0 G7 ? W3 g* D
- dma_addr_t dmaphyssrc2 = 0;9 P3 C# \' I+ k1 ? V
- dma_addr_t dmaphysdest1 = 0;9 U( |& t) z' e
- dma_addr_t dmaphysdest2 = 0;
& k& f: Q1 s) |! J8 Y7 U - / V) B* Q2 o$ ?- k& P5 M. V
- char *dmabufsrc1 = NULL;. C+ j+ b" \/ _
- char *dmabufsrc2 = NULL;
- _8 ? E3 W6 {! N) M/ g S - char *dmabufdest1 = NULL;" W! c* {4 d" I6 U, S8 ^
- char *dmabufdest2 = NULL;/ F% P5 P; \/ N' O! Q/ \
S. D r) e( J* i6 v- static int acnt = 512;) l* i1 S' s. V! {
- static int bcnt = 8;
; ? U' b" V; `1 L - static int ccnt = 8;3 {: A, \9 R$ n+ n# a* E
* @- O8 l, n0 S/ z; Z- module_param(acnt, int, S_IRUGO);
, b7 Q0 T' W' g. B - module_param(bcnt, int, S_IRUGO);
( D v9 F* W" a3 k% y - module_param(ccnt, int, S_IRUGO);
复制代码
; T' f8 s9 d0 Y$ L" H$ Y$ k
5 ~# c! P7 ~- b9 H$ c3 ^+ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 G* B7 [& H& S7 P% C* M* Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) X4 a1 \# d, u2 ]3 e3 R5 i! w4 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) H0 m1 H. Y6 U: l
`4 N% ]2 I5 ?/ b( {
: m) h2 s2 e# C. _* E5 N, Y
|
|