|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S6 `7 X. p: ?8 t. c
- [code]EDMA sample test application& B4 p0 x1 Z& h0 e T# i
- /*
8 e7 v1 E! M7 a7 V- | - * edma_test.c# `0 {) H; G/ u% k1 I
- *2 ]3 t9 l9 o) Z/ `) m0 i: f
- * brief EDMA3 Test Application
Y2 A- A' l2 w2 r: T( B) j - *% @9 \) x# g1 n' l
- * This file contains EDMA3 Test code.4 y( n/ B0 y* |( S( t+ R1 A1 v
- *
' N/ C0 ~; ]3 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& j3 ]1 S" w/ `" H+ S+ ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; L7 c- { {. D2 t, {% f
- * TO CHANGE.& t5 K! h; I- o7 |" g' k
- *
0 j( l; R0 |( K; t, @* m# B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ a9 [; p i" I& y# q6 J/ e - *4 F1 Q" Y0 x5 F1 S0 n
- * This program is free software; you can redistribute it and/or
' t) r/ [ u. u C S3 C" k% Z - * modify it under the terms of the GNU General Public License as
: y5 u0 s ` z& {0 ^" F0 v1 D - * published by the Free Software Foundation version 2.
0 [ Q. H& q) @ - *" h0 [5 b! s8 j `+ c- U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 J0 d: D! k" @5 i - * kind, whether express or implied; without even the implied warranty" l6 ^4 J" D+ g& H ]0 a0 z* J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ K* P' h1 w3 D4 V9 Q. V3 `
- * GNU General Public License for more details.( v2 a6 e- U" C) u* }% D8 c
- */7 t1 @$ V0 }) Z6 j2 l
0 R! n% d7 O1 A. z- #include <linux/module.h>3 [% M' K5 `3 \9 N, y( q
- #include <linux/init.h>8 M2 \/ k% @- L/ }- ]
- #include <linux/errno.h>
2 [& [$ v% G0 Q- R) `. R. Z3 T - #include <linux/types.h>
( v& K( s' C$ Z. C1 C - #include <linux/interrupt.h>; M5 ~, r6 z+ F, j! T. x- m
- #include <asm/io.h>
! f7 N3 V( C. D, z" ?; V8 ] - #include <linux/moduleparam.h>9 o6 y. X5 F! O4 A+ P! X
- #include <linux/sysctl.h># q# X- x+ \- P: V% G0 i; X: _
- #include <linux/mm.h>
. l' Z, }% }# ^! k. O1 m1 t - #include <linux/dma-mapping.h>
* V9 D/ L# p. _% ]/ A$ L - 6 x0 Y& u7 j+ c, f {) ^6 F
- #include <mach/memory.h>
# t1 \* @' b5 R( g1 V9 R - #include <mach/hardware.h>
+ U' K1 f0 ?1 I V2 {5 t2 B! L - #include <mach/irqs.h>
7 B* E, w$ B% C* |! k - #include <asm/hardware/edma.h>
1 N6 D* `; g5 D; A$ w- R! U
4 D- @& r8 E) b- #undef EDMA3_DEBUG5 b/ c N& j1 a; V6 G, B- x% G. E
- /*#define EDMA3_DEBUG*/+ q# c d9 F. X4 m2 H, r
- ) a3 Z r3 u$ Z" K1 I L; F
- #ifdef EDMA3_DEBUG
' u2 V! D5 ?/ `+ P, { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 a2 c, P6 ~, ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# }4 }. b6 H/ a. \: W" `2 f# p$ B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' p) G1 J5 \7 s% I; H
- #else
& j4 J# d! I4 O - #define DMA_PRINTK( x... )$ j: ], T2 x; i) ?* s
- #define DMA_FN_IN
+ N: i( r* a6 l, J, ]' r - #define DMA_FN_OUT; S$ }$ ?% R( V5 {0 C# M- Z& x$ f
- #endif/ J+ Q8 q( {& k6 R1 E
4 G" e# L* z, j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ z; o9 P/ _' w% q, z( V- c - #define STATIC_SHIFT 3
; ]6 G* K: E7 `: I, }0 W& u - #define TCINTEN_SHIFT 20# S; @2 A% |& v1 F" c7 E
- #define ITCINTEN_SHIFT 21
$ G7 b* ~3 H) ]5 V% K6 W6 P - #define TCCHEN_SHIFT 22* T ]5 j" f% w0 z" b3 u) |0 c
- #define ITCCHEN_SHIFT 23* c1 r+ e$ k( F5 ^
- 0 p( s! ?1 j! K2 z" h+ m3 x
- static volatile int irqraised1 = 0;
3 l Z! f5 F0 M( M I& o) _" ] - static volatile int irqraised2 = 0;
4 R) w0 O8 ]& X* j1 ]# n! A - 4 u6 N% S- u- \! c- {0 H! d/ v% I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {, Z" _# O4 z0 \; I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q) X3 x- S3 f' Z/ \: I, O: i; E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b8 f [# { h( z3 [
! ^ @/ m" J4 Z! E0 Y' y8 C- dma_addr_t dmaphyssrc1 = 0;% T' Y) h4 r. O. b
- dma_addr_t dmaphyssrc2 = 0;+ w) `3 B, G: p w
- dma_addr_t dmaphysdest1 = 0; B g' z6 @) f9 M. L R, o3 H
- dma_addr_t dmaphysdest2 = 0;" I- {5 B; j! b, p
" v2 T2 O- B5 [5 O6 C: W- char *dmabufsrc1 = NULL; ^" N2 O0 O" ]
- char *dmabufsrc2 = NULL;
+ }; p( Y8 Q, ^2 f - char *dmabufdest1 = NULL;- ^9 ^( s4 \" E# ]; L
- char *dmabufdest2 = NULL;5 W, g+ Y$ ?2 S6 T/ a6 ^4 P
- o0 Z; f f$ n* H" l* k- static int acnt = 512;
, R& l9 e% U& _9 T - static int bcnt = 8;- l6 n8 q1 t% J
- static int ccnt = 8;+ ^5 R ~' r% Q/ O+ I
1 [; P' T" }7 ~/ H. V0 r3 z) F9 K- module_param(acnt, int, S_IRUGO);
2 }0 ]- {+ t8 E5 O" K - module_param(bcnt, int, S_IRUGO);$ Q+ G5 b ~& t, g0 p
- module_param(ccnt, int, S_IRUGO);
复制代码 3 b9 [! q! K+ b
! W5 M) G1 ^) j7 ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Q) P+ N+ b, A H( x7 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I( k; b" |: ? t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 }8 a( T3 I2 E' q9 U( P& u
; B* F2 d0 P* \1 S3 Y
& v( z( W- q) ]( p
|
|