|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 z* h! g0 x9 N j: }! c5 t- [code]EDMA sample test application& _0 h# B/ F1 ?) M+ e
- /*' I8 m* ] r. z0 V
- * edma_test.c
- X- b/ ?# h" l; k - *
3 p' M: ?( }1 Z - * brief EDMA3 Test Application
! i+ E& @! _& ~ - *9 ~( ]2 D7 U% _7 g# ]7 j* `
- * This file contains EDMA3 Test code.
$ R3 Q! L* B% `2 f7 R) O# { - *
. a" t4 K3 Y4 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
x0 x, J, I1 c- T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ~6 V) c4 Y$ m4 |) j( s y7 v - * TO CHANGE.( @* ?( c; @) o* h, U1 k
- *
& `9 x7 C. u* f# Z6 {- l' {$ j! S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F, |; M$ K% i' j2 B( m
- *
5 Z( a5 ~4 C* A& S* ` - * This program is free software; you can redistribute it and/or
9 r: \6 |' A3 C/ y$ j - * modify it under the terms of the GNU General Public License as
, T+ F# @- z6 e4 _0 \; s+ [ - * published by the Free Software Foundation version 2.) `0 W& Q6 D; P+ J8 S M7 i4 ?
- *
& u# i0 ~/ w# g2 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 T# ~1 ~% ~) X3 w0 Z3 m, o
- * kind, whether express or implied; without even the implied warranty. A1 [) b% C8 Z2 W* B! T1 |$ |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ O! ^% t' X+ g- y* C
- * GNU General Public License for more details.0 {8 U% j, k! y* @
- */" q* f7 P( v( s" f
* t1 x Q3 m( `9 {6 Z- #include <linux/module.h>/ T- N0 E; g3 P
- #include <linux/init.h>
4 X3 Q7 x& t3 q7 C5 V - #include <linux/errno.h>- b1 ~) Z" a e! @
- #include <linux/types.h>9 i3 \5 c. g$ Q" d- m/ @
- #include <linux/interrupt.h>
$ @2 z4 O% I. ?/ X" U" E- F# f - #include <asm/io.h>
! b) g" E: Q9 O" o - #include <linux/moduleparam.h>" Z: U$ w. Y! P! C6 k+ E
- #include <linux/sysctl.h>/ P y+ C0 x7 f
- #include <linux/mm.h>
' R! g' e" u/ T% k - #include <linux/dma-mapping.h>
$ a6 ^2 t! s, M9 q9 J - 6 m) m4 _; I& v P
- #include <mach/memory.h>
. L, p+ |- w. W) D6 J0 f - #include <mach/hardware.h>* [& q/ Z# E4 r( }( l" z) R
- #include <mach/irqs.h>9 V' o" v, F0 ~1 C
- #include <asm/hardware/edma.h>
9 o% w9 g# U+ O" X - ! m: i2 i; ~7 M2 W2 i
- #undef EDMA3_DEBUG
; O' [; N0 M$ i+ y3 l% _7 w4 u- E - /*#define EDMA3_DEBUG*/, t, t5 l) R9 f5 L
0 x) W T2 N7 O! B$ o' w; k- #ifdef EDMA3_DEBUG2 W; ^' ~4 z0 n5 y( B1 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z3 h" [/ p1 ?! b$ u' ~; n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: w. d" b: q6 `3 X1 X( l/ x5 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 S7 ~# b* _' e) R
- #else$ ^3 y' j K# \( k
- #define DMA_PRINTK( x... )
- a6 K* p' K$ C' Z6 @8 X1 j! g: E - #define DMA_FN_IN
& E+ t! E" Y8 x' q# X6 u$ X- y+ [ - #define DMA_FN_OUT+ t& r4 J% E# c( b! c! H4 z8 s
- #endif7 X' L/ s; x$ M( D$ v3 e3 B; x
' t; [" c5 M9 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
b3 w" X! l1 d! p5 b - #define STATIC_SHIFT 3* g2 B- \/ c% Q8 u+ z+ S
- #define TCINTEN_SHIFT 202 l. V: Z. x4 f9 _: v+ d6 U
- #define ITCINTEN_SHIFT 21. Q8 C" r0 U+ b
- #define TCCHEN_SHIFT 22
4 \2 {+ f) Z( I, h. m W. e - #define ITCCHEN_SHIFT 23
0 f ~% l, }- m9 r" e8 Z0 l, o
3 B8 @1 O6 z, `5 A- static volatile int irqraised1 = 0;
) K; s9 R, U4 V5 b" K - static volatile int irqraised2 = 0;
9 n( D2 P& ^% w8 X
8 o/ [" |1 O% h3 k" K& D) J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Z' A9 M* j' e4 l: d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ L. D' {' I0 ]0 u, q+ j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 B$ t9 I9 E+ `7 k7 e+ A
2 E! m/ x1 C9 q/ t5 P+ c- dma_addr_t dmaphyssrc1 = 0;1 @) `, i5 K% X
- dma_addr_t dmaphyssrc2 = 0;# o) {) `. p/ i$ Z+ m
- dma_addr_t dmaphysdest1 = 0;
$ z) W4 S* C9 g6 |0 @" A# w# q - dma_addr_t dmaphysdest2 = 0;
5 q' g* j6 J/ o8 n
* T E V9 b) z$ c5 d ?- char *dmabufsrc1 = NULL;
V8 l9 a8 E' A, Z8 Z# Y! \ - char *dmabufsrc2 = NULL;
2 \) s$ n: C( A, o+ [* ` - char *dmabufdest1 = NULL;
8 [$ t$ m7 P3 t9 g) L - char *dmabufdest2 = NULL;( ?) _, J8 g0 s; f% l
" E7 n A: {# b9 x9 U6 B8 Z- static int acnt = 512;* K) j7 E }$ n% V3 U- l* A
- static int bcnt = 8;# a5 J$ o! {. ]+ e
- static int ccnt = 8;
: [7 F9 ]2 b" I
b$ Q% _( M% F! S( ^- ]8 M- module_param(acnt, int, S_IRUGO);4 X9 u! g. [/ p6 R3 X- w |# U M
- module_param(bcnt, int, S_IRUGO);" T- K4 \3 D) x, g0 g1 t% k
- module_param(ccnt, int, S_IRUGO);
复制代码 1 E9 u2 t* r- M9 @/ `' A" o
c5 V3 W- k( ^$ P% ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 a2 t+ b8 `6 M. `& o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E" K6 N9 ?5 f; D. R: j2 G/ u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 T# N ^* s: w/ d
" R! @1 i# N5 d$ X5 w2 A" k
% I9 ?2 o4 X) a6 ` |
|