|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I( _8 K$ g6 _1 N1 u- y
- [code]EDMA sample test application
u$ S3 X+ V0 y0 C( `) l/ ^ - /*
# }4 n+ f' G6 a; G - * edma_test.c
. a* i J- {2 R1 `7 F - *
" k3 y2 n d. I( V! g0 [ - * brief EDMA3 Test Application
+ \0 S; }" P+ n* u% x - *
3 U R+ w' F* ~1 E% ^ - * This file contains EDMA3 Test code.* l- _+ Q# y6 V; X& j x% X
- *9 v9 \3 X$ \) @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& N, b) ~$ }) |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 b5 s0 L7 F) P$ `: Z( |! ] - * TO CHANGE.
# {$ Y5 n$ l6 j# Z0 K - *
V! z2 ~8 o/ `( N+ ]8 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ^$ c% k a0 e4 p, G# V+ { - *
) B$ T: ^, S% _1 t- H4 g% v - * This program is free software; you can redistribute it and/or
% L& h' b$ ~+ G7 z% R K - * modify it under the terms of the GNU General Public License as
5 T" V1 \) T4 e - * published by the Free Software Foundation version 2.5 a) ^6 \+ G% Q# a' W; r# z
- */ Y5 ~( A4 B2 K* l# O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 A% T' _3 q" f2 G" v2 i! `3 w
- * kind, whether express or implied; without even the implied warranty
2 w2 w4 r4 K% {$ ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) p1 `& U& I6 q$ z5 G - * GNU General Public License for more details.. T1 \) f; i2 q, r+ Q
- */
' P9 n: y3 [# `& g, O
9 \6 K9 d$ H4 D7 M0 G( l1 Q2 l- #include <linux/module.h>: _( E `# Z$ i/ d
- #include <linux/init.h>; C6 j9 t/ k: G4 ~
- #include <linux/errno.h>% r0 Y% F1 T/ u. ^/ N1 r
- #include <linux/types.h>: B" `0 ~. g* D, v d! u
- #include <linux/interrupt.h>0 i" |/ o( E3 s9 S, X a0 G
- #include <asm/io.h>
4 Z C9 i5 M* P/ \; h - #include <linux/moduleparam.h>* i* C: W3 k( I' B
- #include <linux/sysctl.h>' H; o3 X" w& l3 |( f
- #include <linux/mm.h>
. [8 r. F6 H9 ?1 O5 m2 ] k6 X9 N - #include <linux/dma-mapping.h>8 E: V! q/ C, g
- ) `! ?4 h @; {5 p
- #include <mach/memory.h>* s# } g3 Z. A4 @0 Z5 T
- #include <mach/hardware.h>7 u+ }" L5 A& s, w9 S9 d4 B7 U
- #include <mach/irqs.h>
) b- Y' {& g! y* X - #include <asm/hardware/edma.h>( X, i u- v$ E- g* Z/ @
- 6 E) [5 P/ x2 e! j
- #undef EDMA3_DEBUG' w7 Y1 I5 F8 |0 i8 K9 v" W
- /*#define EDMA3_DEBUG*/% l* S8 s8 z1 ~
- K* I e' _4 L$ N- #ifdef EDMA3_DEBUG7 l. S G6 P7 A$ m3 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 _$ ]5 V( }5 T. a3 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 p! |& a1 r1 e3 [0 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 {* u+ W: Z; N6 J$ P! @( v* K1 @! J- U
- #else& I! T$ H- U: P+ c9 j" r0 ~
- #define DMA_PRINTK( x... )
& E' P8 O- G# c: j8 n- _1 J- i - #define DMA_FN_IN& X, a- q& w- ^9 c
- #define DMA_FN_OUT
% c$ L! N) N! y1 _ - #endif
" \, n) m& S, `$ R
3 S& }8 q2 [- O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- u) D+ h2 x3 ` H5 o2 E, C/ e - #define STATIC_SHIFT 30 b4 n" n1 a/ [* D% {6 ]) Q
- #define TCINTEN_SHIFT 20( x/ o' W C! P
- #define ITCINTEN_SHIFT 21+ h8 O) h8 v% g+ L
- #define TCCHEN_SHIFT 22
0 t. [2 l6 p6 X) y0 v4 D8 J5 c - #define ITCCHEN_SHIFT 23
: V( g+ q! o2 Q/ ^+ d
b1 Y. C& g! S4 i6 p7 j$ U9 A' ~' E- static volatile int irqraised1 = 0; I: L4 s( n" ]9 @' W
- static volatile int irqraised2 = 0;3 P) F' \% D$ J& X$ n( Q& y6 P
- 4 ?; J# h+ ~" c0 H, W V" o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" k# u0 q p. O& v) T& q S8 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B2 w9 N, o/ Z* q- f5 q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R w5 w* e4 u" [5 p0 H
9 o% K/ E9 Z. k- dma_addr_t dmaphyssrc1 = 0;: U$ Z+ F) i) [0 ^5 M$ ~7 G( [
- dma_addr_t dmaphyssrc2 = 0;
# ~4 Y- S2 ^/ P) O - dma_addr_t dmaphysdest1 = 0;
+ U4 e. A$ J. w1 m6 x1 F+ [ - dma_addr_t dmaphysdest2 = 0;4 \$ E* K- n$ T! C
- 3 j) p1 B$ o+ G
- char *dmabufsrc1 = NULL;! K1 V& c* P9 g) K; {! w
- char *dmabufsrc2 = NULL;/ Q3 w/ ]! d6 U# y9 x6 v4 z
- char *dmabufdest1 = NULL;4 D# c+ C* }/ H! ~4 z
- char *dmabufdest2 = NULL;5 h% \. _; g/ H; ~# x2 Q9 n
; r6 s- x& v# f0 W4 w0 C, K$ d- static int acnt = 512;
# C* i$ t9 O3 {- ~" ~ - static int bcnt = 8;
- e4 M& m% p0 [8 ~+ Y - static int ccnt = 8;
7 \ p s, C- ^7 W
( L+ S5 I2 Z" v* i( ]+ x- module_param(acnt, int, S_IRUGO);- i+ F( ]7 y1 |% J3 C4 n/ B
- module_param(bcnt, int, S_IRUGO);$ B; p$ @4 R A/ M0 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 1 g# n5 J* J; j/ | g8 G0 T9 u
& g" c' X r1 D' q7 m/ }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 |% D0 W6 m1 W! q$ g( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: s2 V$ T! _7 W; x% S% B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ d+ j3 X. J% C+ J# g! v$ P$ L
( o; R& ]- @# `& d O. m( z w2 A- V g% p
|
|