|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 |& B( u$ _1 N* T- R; {
- [code]EDMA sample test application6 ~$ M# w3 [: a4 J" s7 M, g* q
- /*- N: J4 R3 |/ a- U1 H5 W6 m$ ^7 u+ ~
- * edma_test.c5 j$ w% ? T# y
- *$ g8 z- h" u/ }* }; j9 X
- * brief EDMA3 Test Application- G8 y2 L% U2 g3 a, m5 g
- *
4 W+ o# i3 d$ Q' T5 U0 x% @0 S - * This file contains EDMA3 Test code.
1 ~" C- \ H, |% c9 o1 y - *
2 n4 Z% p: r6 h/ Q5 H2 x8 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; C! l* ? q* `- {' @0 ^7 r. ]3 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 {, o) W/ O+ u1 R
- * TO CHANGE.
0 v7 g8 |3 H, A - *" j5 C- o* V( H! @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P) E! ~" d. l$ P6 ]) w/ S3 R
- *
2 p5 l0 C* [1 I l) k' z c - * This program is free software; you can redistribute it and/or
1 U! {# d7 k, R - * modify it under the terms of the GNU General Public License as' b* a; S" ]3 s& a5 R
- * published by the Free Software Foundation version 2.
R) i$ Y5 |4 o+ i1 [. Z - *3 Z S' t& q6 D9 @$ `, R7 W2 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 M" p2 j, U \* g3 M. e. @ - * kind, whether express or implied; without even the implied warranty5 H! ]' G0 F; j3 E4 M# g! g. W( \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- B" W- [0 {1 i" z
- * GNU General Public License for more details.5 l1 M# {% r, S( e
- */9 L; U. g( C( D0 c/ k2 G4 X
- $ ?, {3 ?3 X8 S, Q
- #include <linux/module.h>
4 R, H: n6 i5 Z+ N L0 b - #include <linux/init.h>
5 f; K% i, r/ N+ \0 l& g! ] - #include <linux/errno.h>
; Q. @, M) }% U$ h8 Z' ?- B - #include <linux/types.h>
2 n( p y' v8 e9 u - #include <linux/interrupt.h>/ L7 [0 Y! L+ s! T! m1 G
- #include <asm/io.h>3 ?6 r I; c$ q* O. P0 V8 [, D# S7 k
- #include <linux/moduleparam.h>' M0 t! ?* B- S1 I9 ]. J1 R/ j( ^6 f
- #include <linux/sysctl.h>
! l3 a `4 f( v3 O/ h - #include <linux/mm.h>0 c1 _8 ?8 @$ B" |+ S E
- #include <linux/dma-mapping.h>
6 H8 f" \2 D$ N+ t7 e - 3 l ]+ y) n7 F* Y8 C1 r) _+ S
- #include <mach/memory.h>: T# d" g2 V4 W5 w
- #include <mach/hardware.h>1 |- {9 g( P# D/ A+ u0 |+ B
- #include <mach/irqs.h>
# f$ n$ \3 t! |5 v% t - #include <asm/hardware/edma.h>: L' _) K+ [* _+ o
- ; ?, i0 f# J) T
- #undef EDMA3_DEBUG4 N4 P) V1 E0 ?* m0 Q6 d
- /*#define EDMA3_DEBUG*/" \7 R& x q5 e0 ]1 w+ l. G8 u
- , }- X! k! j/ {" N
- #ifdef EDMA3_DEBUG
' \' D- s4 M- l0 q4 Z) r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 I8 A- {" k7 f1 J: E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ]4 V) L! } s/ B5 F) w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 S; Z, C# D- C
- #else- o- A; f+ Z- J; z) m
- #define DMA_PRINTK( x... )0 T4 q: e! y2 Q4 o
- #define DMA_FN_IN
1 l$ H* Q% Z3 Q' u7 }+ i - #define DMA_FN_OUT6 M$ Q X' B- `$ V/ W; C5 N- ~
- #endif* h, {0 I% J M( j, E
- : h6 ^5 G: R1 r* H6 H7 U( M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 ?, Z5 _ m% k! { _$ [
- #define STATIC_SHIFT 3" j+ s' x, a0 n- a5 a1 a
- #define TCINTEN_SHIFT 20
5 t- v( W& o0 y; X - #define ITCINTEN_SHIFT 21
+ L9 ~( e) Z5 ~% h - #define TCCHEN_SHIFT 22. F# ?9 v1 Z" p4 f2 E' K M: z
- #define ITCCHEN_SHIFT 23" Y7 A/ A) y0 w3 ]
3 D' q; f* D7 Y$ y m- static volatile int irqraised1 = 0;0 O8 `, [* j6 v
- static volatile int irqraised2 = 0;* w3 G# G( g& _, G* }9 l' A% v
0 z) w4 M% {7 r3 X/ O$ Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a. |4 U& I# N; r' b5 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~' D8 q/ D( p7 Z- a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& s8 M. U8 [& f0 f" y5 O" ~! Z, A5 R - 5 K8 h# k O7 O6 K6 D% C! o
- dma_addr_t dmaphyssrc1 = 0;/ u- J' b" i" Q5 `% {9 n
- dma_addr_t dmaphyssrc2 = 0;
& S+ q, \) c/ V; R1 }0 } - dma_addr_t dmaphysdest1 = 0;
: \* b; I9 s2 t: s, j3 T - dma_addr_t dmaphysdest2 = 0;( _5 c6 z) [! m7 w; z& o( {( r) A
: g/ c9 P) u- [3 |/ X- char *dmabufsrc1 = NULL;& e4 I0 Z, N1 X: x+ i9 @* G
- char *dmabufsrc2 = NULL;6 }' g5 \4 g7 {5 @; t1 J
- char *dmabufdest1 = NULL;
* M1 Z; y1 I" A& t X+ W3 R! s - char *dmabufdest2 = NULL;6 P' ~% X1 P) }, r5 O! x
Z2 ^( c. j# r4 [7 g- static int acnt = 512;
: C2 ]% I# l5 E - static int bcnt = 8; r+ _9 W) ~' z4 K
- static int ccnt = 8;* k$ q/ v" V) i4 A
- + S% k4 z' H* Z o8 [7 F, `( [
- module_param(acnt, int, S_IRUGO);3 u$ V7 r( V2 Y! ~! I$ Q! k* g5 Q
- module_param(bcnt, int, S_IRUGO);, u( n) B2 e3 ]5 i0 m2 S$ F
- module_param(ccnt, int, S_IRUGO);
复制代码 3 {4 i, C0 u' x& ]
1 t7 s0 \0 B0 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 y$ {. f; h+ T" y) b! F& ]* Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) j" w- O! {3 Q6 k [$ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ~5 ~! c+ s! M0 a4 I
# t/ b; r% Y$ n* q4 }) W
8 J5 @2 H) i# j d! z |
|