|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; m6 B" y- c& @ ?+ ~; J2 h6 b- [code]EDMA sample test application
, B$ t" s/ J, i, ~ - /*
% Y6 B' s% D2 H3 R4 k - * edma_test.c
$ ^6 ^+ g( H; ~ - *+ K% \% G+ g' B/ a$ Z# Q& k
- * brief EDMA3 Test Application4 H/ n- q. Y0 p) O& [7 n
- *
! w0 v8 U6 @0 W. R( i. n - * This file contains EDMA3 Test code.
) Y, E- |- W% g - *
. j9 R% |5 ]5 C5 d* c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' C" j: R9 D6 j% j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: F: @& ^0 p8 h8 B( j1 H
- * TO CHANGE.
% Q$ `3 f8 l3 e$ B0 X; \ - *5 a+ l9 z3 j$ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: y6 R9 r1 h0 Z9 T3 o8 W/ T
- *, D$ \6 N# j; I$ |# D
- * This program is free software; you can redistribute it and/or+ e5 m; y) A4 Y W# z6 x* P p0 I
- * modify it under the terms of the GNU General Public License as- t6 t$ P8 W& H" _8 T4 V2 f, l
- * published by the Free Software Foundation version 2.
, ~( y" m4 T0 [! ]8 _5 { - *
! m. O6 r' E- G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, t: \3 a$ p1 c' P/ `8 J5 q1 y6 C% E - * kind, whether express or implied; without even the implied warranty
# ]9 e8 l/ e" x/ l9 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) O4 a8 U8 s( a - * GNU General Public License for more details.- w9 t. F2 j) C: ]+ {% ^
- */
; V: F- ?8 P' w5 i; u7 L$ q1 I4 s - 6 A e: a* E. @1 n: M
- #include <linux/module.h>) C! O# R! Z5 D3 S7 q3 z- Q% R6 u
- #include <linux/init.h>
8 {0 L0 {) f1 L8 \7 G! v - #include <linux/errno.h>
8 K: e9 z8 N1 K1 _1 {8 ^' w - #include <linux/types.h>
8 m$ w9 H; v/ t1 ~& N7 w. r - #include <linux/interrupt.h>
( D N0 K3 R; F: z4 M - #include <asm/io.h># P# ?" K7 |, m: \( b
- #include <linux/moduleparam.h>/ Q) p' C9 i- O" y! o1 ]8 z; s6 @+ Y
- #include <linux/sysctl.h>
- t& ^0 p/ j* Y, O4 h6 X4 e: F - #include <linux/mm.h>
6 c, @/ d' `8 ?; R$ }) G: ` - #include <linux/dma-mapping.h>
8 q% O$ X) F: W" B# R) A
0 T/ c( j6 e3 F2 B! h6 p- #include <mach/memory.h>: o1 I' g) W* T1 _- B9 _4 x
- #include <mach/hardware.h>: S2 T" R8 p9 f' L Q4 h* l
- #include <mach/irqs.h>
$ j/ h. G" G# X' F6 j* D - #include <asm/hardware/edma.h>
I3 L1 @+ [; E" V& T5 L+ a
# y6 ]- K% n8 M. I' s/ r. x8 _- #undef EDMA3_DEBUG
' q+ \$ \* ~( E: g7 R9 [ - /*#define EDMA3_DEBUG*/
% ^0 N4 f, q% M2 g2 r# {) j$ I
% \# o% ]" {6 P; W8 [# O- #ifdef EDMA3_DEBUG
6 z2 C% N( g6 t4 h* P5 ^1 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ] a3 }) H }9 H9 o, z0 q2 X! s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 j' l$ v! M- O5 @' O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. V1 ]& s4 w/ Q0 s/ @6 | - #else
; L" K1 x& u- F5 X! @" F! v - #define DMA_PRINTK( x... )
$ v: f# g0 h9 d0 P5 ^$ g+ L, N; N - #define DMA_FN_IN
" g: ]" W d' U( Q" _! O - #define DMA_FN_OUT
2 ?& M0 I5 P( e7 U4 l# V I; e - #endif4 n# E9 Y+ n) q9 ~
6 j, { A7 R+ j) B- `0 f) k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' z' T/ k- W# t# ~( p( G5 u( W - #define STATIC_SHIFT 3+ F# U3 T) l8 Q- {) F
- #define TCINTEN_SHIFT 20# ~* P, i5 M3 f' X- q! v
- #define ITCINTEN_SHIFT 21 b8 b; a8 g* ^6 l
- #define TCCHEN_SHIFT 22
6 U, g+ U7 M9 S' o - #define ITCCHEN_SHIFT 23
% x3 |/ h. s/ F8 J* F
. L. U2 _- i) g7 f2 J- static volatile int irqraised1 = 0;7 R+ k+ |& |) \+ j7 i# a
- static volatile int irqraised2 = 0;+ q, K8 H" Z! k
3 ]$ Q2 r( F1 j- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* K9 x" T2 o# q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F* T( `* x; b! m9 F4 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C% \, ?! q2 e( ~) q: |3 ?4 B5 r2 _ - 6 J" U& v+ u1 t! s; I& y: U& y
- dma_addr_t dmaphyssrc1 = 0;7 X5 \9 M5 U' ^2 Z2 g& {
- dma_addr_t dmaphyssrc2 = 0;
" h* o% x. z5 E/ G/ Q - dma_addr_t dmaphysdest1 = 0;* p4 ^' B4 p2 k' h9 z- K: K5 g
- dma_addr_t dmaphysdest2 = 0;) `$ L% `" a) u: @- s0 ]
# s% G0 B7 G$ c% \- char *dmabufsrc1 = NULL;
+ j6 u" n$ V+ O1 i5 v( t' ] - char *dmabufsrc2 = NULL;
. k9 J3 f0 E( g1 f, U3 V - char *dmabufdest1 = NULL;
( S& W$ Y: Y4 a7 a" [/ q. D: H - char *dmabufdest2 = NULL;" {8 A+ J8 w7 L$ a- n
5 l8 P7 k; Y W* c0 g0 n4 W2 s- static int acnt = 512;/ [3 p% j1 S. {+ p
- static int bcnt = 8;4 b: R! [! g6 a+ R
- static int ccnt = 8;0 y( g* _9 i: P/ A0 W" r
( [3 |$ Y K6 H: D" m; ~ ]( {- module_param(acnt, int, S_IRUGO);
( V/ Z- G9 U3 D6 w. X4 u2 k; J9 z - module_param(bcnt, int, S_IRUGO);
b; d1 \1 J6 d+ S - module_param(ccnt, int, S_IRUGO);
复制代码
0 J1 M) q* v g8 E: ]5 E4 A# H! S% ?7 H1 K9 E$ |! J w, g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; X Z A2 T: Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& n4 r5 F: N5 Z M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' |, m4 U% F2 n, H6 f# f7 [3 J, w: F& y/ P/ b. F
* d! Q) F: p) X" f# Z! Q. `! P# |
|
|