|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k, q) }) D6 B- z7 J
- [code]EDMA sample test application; g3 r4 X6 h( t! b
- /*
2 V0 i4 X( n9 M) e. z - * edma_test.c" J" I# j& I! \
- *9 j. S4 I- H" @. F
- * brief EDMA3 Test Application
! d' y8 K) T/ P2 l- T - *
& U, x- S8 p* v5 F' m3 D7 n( } - * This file contains EDMA3 Test code.
6 E0 o6 W) W& L' S: h - *% w1 R9 K; n$ V% D# m% d' v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' L6 E- m. i2 h. ~5 H. j, H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 j4 d6 E i4 D+ a }" T0 G - * TO CHANGE.
/ ~, Y! c$ u$ U( K0 v - *
/ V7 T O% k* |5 d9 B8 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Y9 r9 @. N, b h z" x: H' r# L - *) Z/ f/ A' H6 O: z9 z4 @
- * This program is free software; you can redistribute it and/or
9 o2 y7 \% d3 O" |5 L. H - * modify it under the terms of the GNU General Public License as, u. |0 U8 i+ t' ` N. N* ?
- * published by the Free Software Foundation version 2.
) s5 o$ t2 i5 e& P: U* G/ o - *
) R$ H5 o3 O% E9 t5 A+ r$ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p4 A- b7 x; V4 {% e2 b1 ^
- * kind, whether express or implied; without even the implied warranty/ b: n! K2 S; h. R9 B( _, G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' d+ B! ^. U9 }$ H7 }
- * GNU General Public License for more details.
7 K$ \& E) j/ _8 z& |3 @ - */- l4 _) x/ r) [: @
3 p* u6 |0 `9 Z: X- #include <linux/module.h>7 s/ |2 s* l; t
- #include <linux/init.h>
; u' Z' l& ]% h4 r2 M - #include <linux/errno.h>
" v5 J2 s) } Q: ^2 b( [' C - #include <linux/types.h># w3 Q$ a# \8 f$ ^# }' j6 K/ J4 J
- #include <linux/interrupt.h>, Y4 Y6 H+ c4 h$ h- G# t F
- #include <asm/io.h>' {: d' v5 s* `* F
- #include <linux/moduleparam.h>) K1 h! s) b( D1 N$ @
- #include <linux/sysctl.h>
b1 C8 }; w, O - #include <linux/mm.h>
# ~% g {. O0 ? - #include <linux/dma-mapping.h>
- F# b; N4 G9 u4 D F; V; L - 9 D) e9 w* `! R8 Z
- #include <mach/memory.h># ^! N# e4 T2 }5 X$ W
- #include <mach/hardware.h>
^% L8 ^+ x# r - #include <mach/irqs.h>1 M! o* k! D* N9 D! Y% c7 [0 Q9 C
- #include <asm/hardware/edma.h>5 _1 R: O2 n3 H, X, V/ O: V
% [' c9 b1 t; v1 {0 r+ X% j- #undef EDMA3_DEBUG8 `8 s2 U6 [- H& M; g: m; H( [& G* |
- /*#define EDMA3_DEBUG*/0 h; @- w0 S; Y% {# Q s# P7 ]
- % _, F5 ^2 p2 u4 j3 S: x
- #ifdef EDMA3_DEBUG. K+ K2 t2 I3 b: q! K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ^: b% p) s$ `& Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( h" G. @; a1 g H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 d9 C0 {( N, U; Y! L& m s& ]/ t - #else3 } H" W% T% X {& Z( w S
- #define DMA_PRINTK( x... )
q* p. }% ^6 V0 {. L: W - #define DMA_FN_IN
0 C9 L/ L. `* e6 O) y2 H; @) z - #define DMA_FN_OUT
; I |1 ?& [6 o, S( |& z - #endif
6 e& V' A e- s. n; w - # T6 c- Y p* B" {* w$ Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: ^) H% F+ k2 ]$ F1 L, \ - #define STATIC_SHIFT 3
2 D! `; I2 h% }6 G% F - #define TCINTEN_SHIFT 20
" n, D2 W+ O, I* n& V - #define ITCINTEN_SHIFT 21
. Q) O6 N) C+ G6 v: X2 b - #define TCCHEN_SHIFT 22
- W2 c1 _2 ]( X9 B - #define ITCCHEN_SHIFT 23
8 |8 @; `" i7 c$ ^& o; X' D
+ n* @, S6 r! v& S6 E7 u- static volatile int irqraised1 = 0;5 e* i; A% T5 M
- static volatile int irqraised2 = 0;
& P, `: a+ l# D3 S6 u: m
. F' y& x* @1 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* x" k: q* ~4 C. v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Q& R, y5 b3 J6 Y" ^4 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w" Z$ }8 O7 a5 ?) a( l
- ) z- A1 T3 k' N# `/ n
- dma_addr_t dmaphyssrc1 = 0;3 Q Z0 Q# c0 h9 ?1 b3 | B
- dma_addr_t dmaphyssrc2 = 0;5 a1 M7 b3 P* a8 Q% m8 n' {
- dma_addr_t dmaphysdest1 = 0;
# ^1 b9 {, z7 D: |7 P - dma_addr_t dmaphysdest2 = 0;- _/ c6 V% T/ M r
- 5 }* g1 c# ^# w, Y0 }, ^1 ^. f& q$ [
- char *dmabufsrc1 = NULL;
+ B2 L4 a$ Z) [8 B) o4 A3 P4 v- G d - char *dmabufsrc2 = NULL;+ o3 q/ G7 m9 p. F% f7 g* Q
- char *dmabufdest1 = NULL;5 n9 t+ ]1 V: S
- char *dmabufdest2 = NULL;
. |$ V t8 E; y( f0 m& K: ? - 4 j4 y1 \8 z9 _3 g5 H4 H N9 N
- static int acnt = 512;- s3 h) {: O7 ^/ Y
- static int bcnt = 8;
" B& I E5 Z6 }: I* @# W8 u! v4 `6 v - static int ccnt = 8;
% I1 \" I: T, n; C0 `" Y: Z& \ - + a2 w$ y- m2 b
- module_param(acnt, int, S_IRUGO);/ a- r; U" q" m( j/ \
- module_param(bcnt, int, S_IRUGO);; r- n- I$ V a) s
- module_param(ccnt, int, S_IRUGO);
复制代码
9 m! B! x2 |+ I9 B- @/ t, p A- d# l e: p; O7 [8 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 v1 T+ \$ R6 w! q$ S3 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ d, v e- V7 R6 m2 [; i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 s/ U8 K3 R: d6 T" w z
. I2 e. i, ~" ~/ o* g
/ u7 Z$ o' F0 d& [, A4 T- c |
|