|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. G. Y! p# a- t% E: K) B3 C- C- [code]EDMA sample test application
- S$ H( g7 R. ]8 E& v# x& K - /*7 F8 r% p/ N9 Q
- * edma_test.c& Q6 i9 F. b$ D3 ~
- *
$ ~1 }; \" D9 D" P - * brief EDMA3 Test Application
/ T8 m# l$ k% M" a" r7 ^5 f - *
( d) d: D# F+ g0 {: m - * This file contains EDMA3 Test code.
$ u; q" l) r8 p/ r- w - *& o2 r# S- V3 f& |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- C) K, m3 ?; Y& j& v! }( U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 K9 S3 n; x& T8 Z; a) z
- * TO CHANGE.
. k: f% v3 I& ~8 K* Q- |6 @ - *
1 Q, j/ H2 j8 n: ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) m9 V/ q9 @4 }! |& @3 q
- *
0 z7 Q, S' V# R9 [5 B - * This program is free software; you can redistribute it and/or4 W7 z1 Y m, {: l
- * modify it under the terms of the GNU General Public License as
* ?8 F( w# q* e& Y - * published by the Free Software Foundation version 2.
0 {* f9 w! Q- b) J+ l6 a - *: Z) r; A1 ^) h7 |, m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any R! P/ D' _2 \- m% G
- * kind, whether express or implied; without even the implied warranty
* H& S( ]- r3 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. f, D7 W' l& b - * GNU General Public License for more details.) M* ^% c* ?3 A0 _$ P# K. V" G
- */3 i! H3 x M; l% [" @) B
[$ d0 ^/ m! ` c3 j! |6 B @- #include <linux/module.h>
/ f$ D7 u! B% \7 e. `: v- u - #include <linux/init.h>
- z7 d3 @: P* Q; L& @- s# [ - #include <linux/errno.h>1 U/ r+ l, ^" f! U/ @& {/ r
- #include <linux/types.h>
& k9 r/ _6 R7 k" ] - #include <linux/interrupt.h>" E) F. w5 M1 u. N6 S' P
- #include <asm/io.h>
$ ]8 ~' M5 E) p+ c \ - #include <linux/moduleparam.h>9 Z4 f; j+ L% j8 S' M" D
- #include <linux/sysctl.h>
6 C" T* J* i, D0 E# ^ - #include <linux/mm.h> H9 q$ x* U, c& c
- #include <linux/dma-mapping.h>9 U: v* U6 I1 T- U6 h& w
" ^/ m5 e( m2 V9 g- #include <mach/memory.h>/ H# P4 b. a, J/ A3 a2 d$ c3 d5 q. {
- #include <mach/hardware.h>
( E# o) K* \/ e9 k! e; B - #include <mach/irqs.h>
- Y f# Z7 `7 Q2 Q - #include <asm/hardware/edma.h>
4 l8 g( L8 V" x8 O
) F2 A' U3 X e5 r; R- #undef EDMA3_DEBUG3 O. u( B/ h- M1 ]
- /*#define EDMA3_DEBUG*/
: {+ `0 P+ I4 [7 j* c - 4 m8 [2 n9 V/ N1 ?- ^& X* E
- #ifdef EDMA3_DEBUG' _% d0 ^. q* e, |/ L* L1 P+ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Q# D% _" X; m: M" E+ q2 @+ X5 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 o8 p1 h6 J( A: }( n5 @/ E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# {) G7 }; E$ @0 E" a N - #else
( Y) j. D/ K& `3 \3 U - #define DMA_PRINTK( x... )
4 M/ f7 a* r* X' e+ o - #define DMA_FN_IN* n* g- ^; {( a) m7 |" {1 n, w
- #define DMA_FN_OUT. V0 Y0 U7 I# T/ R2 e, Q
- #endif+ ^( v; n: O( Z9 q( w* B9 ^! _1 ?. m
- ( \" z: S7 q( I. g; D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). U. A$ a3 L5 y. S+ b! m& q# D# }
- #define STATIC_SHIFT 3
0 s$ Z: `( e2 F/ V/ H- f# Y - #define TCINTEN_SHIFT 20
1 E: @: ~3 l0 p5 v* A+ m2 [ - #define ITCINTEN_SHIFT 212 H7 v3 [" f9 z/ {9 R; m: ?$ h
- #define TCCHEN_SHIFT 22% E' f; X6 }8 g" j8 L5 v4 m8 y& i4 ]2 f7 o
- #define ITCCHEN_SHIFT 23
0 O& e6 ?9 C3 t8 c
?1 [' L. P' h1 X T- static volatile int irqraised1 = 0;- r/ r- ?0 |6 Y
- static volatile int irqraised2 = 0;
4 v0 j( b7 n- T* K# a - 7 e' g B& z. i# t+ u/ @3 E4 p2 e% o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' \+ g: R( _2 h) X+ {# C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ o* A, G* U! M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 I4 P; a; w# M, ?
* p$ ^# ?4 W' e& S0 f- dma_addr_t dmaphyssrc1 = 0;
7 x0 e: O. M0 D# p/ U) B5 j& I9 H% l - dma_addr_t dmaphyssrc2 = 0;
& W% s, D; v6 W# Y" Q Y - dma_addr_t dmaphysdest1 = 0;2 J, G8 q, e. n9 N Q/ ^5 S! ]. {) B
- dma_addr_t dmaphysdest2 = 0;8 N: H2 m0 H3 I3 f6 e7 }7 z
- & H; G) Y3 m/ c. ?' @- s# `
- char *dmabufsrc1 = NULL;
% v; Q$ F0 i% N* x7 j1 w- j: V - char *dmabufsrc2 = NULL;
2 I. _6 Q' y1 q9 I& N7 q6 f, d" C - char *dmabufdest1 = NULL;
& N3 v, L9 I; D: l$ O- R; V - char *dmabufdest2 = NULL;
+ N" o! o, v; J8 Z
! n% V" `: }8 C- static int acnt = 512;8 E; I, z9 \* v7 U- n
- static int bcnt = 8;! I2 L3 I9 {8 S5 \4 O" V
- static int ccnt = 8;
. w: S- k8 `# G, J
$ q& Q5 ]& L; k' N$ ~; o) f" G" i- module_param(acnt, int, S_IRUGO);7 j/ q' w6 U$ A
- module_param(bcnt, int, S_IRUGO);
% T% n4 @0 h8 `! F/ [/ _- W$ z3 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 4 F$ a/ `, p6 F6 o- k
6 p4 d3 I! q- @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L$ W+ L4 ]1 S5 o, x: e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Y4 `6 r2 g# g( ~! E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i" C. P7 v4 T# a
6 J( I% [2 ]" J- k. K
, v1 E+ \0 n7 g" r& W# L, h; j7 I |
|