|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D1 n H) F; r6 O- [code]EDMA sample test application1 i- j& f1 y9 n( O$ L
- /*: ?( `' r% [4 c
- * edma_test.c
* R/ |2 H* N9 c' F9 w9 l - *
h; P I2 Y! M4 n - * brief EDMA3 Test Application
/ b. e4 q, c' B- h% s - *, @& y+ ~ F) r% h; f" V
- * This file contains EDMA3 Test code.+ t5 x, [# M; i- L& P* N
- *& n; c$ V( F2 S# S. k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f) t$ J# ]' \; B: L2 w6 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& x8 F! a! [/ B
- * TO CHANGE.# [& _ w9 M* j
- *
+ c# Q# z% D8 m* `- v9 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# j. ]8 R7 j! J- a
- *
/ |9 R" e! n" b/ e - * This program is free software; you can redistribute it and/or
6 q+ l3 _( Q' M6 ]# L0 h$ W - * modify it under the terms of the GNU General Public License as4 t# l) t: O/ U$ L8 m4 Q% |) K
- * published by the Free Software Foundation version 2.4 C% ]& f% m7 T
- *
, a7 d/ c, ]% ?+ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 p* |( T: e. `' R$ m" S! G - * kind, whether express or implied; without even the implied warranty
0 z5 _) Q, H' E6 E) Q/ b3 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& D4 P& |1 H0 t0 A- O! S! b* N - * GNU General Public License for more details.
# L& l) }, I) z* s' d9 y5 s - */: ^7 F3 k4 X, e( j$ z
1 z1 r/ G, a3 K- #include <linux/module.h>2 T) z3 Y% c' G! ]: E2 p7 }
- #include <linux/init.h>- i r* j' s) v4 N |
- #include <linux/errno.h>
+ Y. P0 E$ u# z - #include <linux/types.h>- I, E/ o, a, }- r2 ~1 p
- #include <linux/interrupt.h>
( i: L* V, Z3 _( U - #include <asm/io.h># f9 M: A7 \* g6 P6 m `+ v |9 M0 k
- #include <linux/moduleparam.h>
' v0 S& [3 u/ y3 }- I9 S6 v - #include <linux/sysctl.h>6 |3 t1 }7 L7 x# X
- #include <linux/mm.h>
+ z% A4 k! B$ m1 @$ L - #include <linux/dma-mapping.h>% X! ?* _: _/ x7 D! H
, N: {1 u$ h" |* s- #include <mach/memory.h>
# g) t8 f/ P t. W5 E0 \ - #include <mach/hardware.h>9 @ ? Q, k) V3 U! G
- #include <mach/irqs.h>
) @0 D6 O% U% J2 y - #include <asm/hardware/edma.h># E d# z. v8 ^- Y5 j4 j) J
0 @. n# M0 d( H; {- #undef EDMA3_DEBUG1 r1 l( ~: @- m2 X; w
- /*#define EDMA3_DEBUG*/ E) U$ l- c* V2 I2 R; X
9 r$ y! G6 _# l$ w- #ifdef EDMA3_DEBUG/ ^+ a* T% b5 g7 v% e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' x9 t- T& B" N' s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, s8 b' e. K5 V- A. I- d! j# o: C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 C9 G$ O5 r! |8 g7 ]: i
- #else! m0 v0 V$ \& X4 A* y$ P( K
- #define DMA_PRINTK( x... )
" H/ r& D- c" ]) ?6 T+ _9 { - #define DMA_FN_IN
3 }1 I! B) i/ S9 v - #define DMA_FN_OUT
6 d! O; ]/ F" \% Z( T - #endif
6 F9 z, b7 l' H/ k6 e' Q7 M! @( x; B- g3 V - 8 {1 B$ C- F+ L! m9 X1 @5 b/ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' Y t5 V l7 q - #define STATIC_SHIFT 3
' h! h0 e( \6 r" N' x2 H+ D - #define TCINTEN_SHIFT 20
; ~7 ?) }# n9 {- O - #define ITCINTEN_SHIFT 210 ~' q* }$ |* G
- #define TCCHEN_SHIFT 22
, s. C1 P- F% I: u - #define ITCCHEN_SHIFT 23
6 _: w7 @1 P+ L
( T% V3 R7 y* n9 d- static volatile int irqraised1 = 0;3 U4 @/ j3 h o2 [
- static volatile int irqraised2 = 0;+ V! q1 P9 ]* g; F5 M! M' ~/ W
- a7 L' n3 D$ t5 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q! R6 m2 b( w4 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m1 M3 w* S, u0 _2 Q& H% _7 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 n) \+ u3 J+ N" U - & w# p5 q H& C3 C P; l
- dma_addr_t dmaphyssrc1 = 0;/ i" @, {1 t `3 L. ?% l% c
- dma_addr_t dmaphyssrc2 = 0;; {8 Z0 q6 p! q, D( s! e
- dma_addr_t dmaphysdest1 = 0;
% t! r1 N, v. {4 v' Z( C8 x - dma_addr_t dmaphysdest2 = 0;
8 v) I5 P- r' X7 }2 H
" ]6 H% g6 @! `8 l8 j3 Z- char *dmabufsrc1 = NULL;8 U' V3 H2 e9 {% p4 K
- char *dmabufsrc2 = NULL; N7 E, U, I3 e' V, ?1 e8 a
- char *dmabufdest1 = NULL;
# f+ S h9 k- `7 s8 p - char *dmabufdest2 = NULL;
8 T; R- j9 }, n& e4 n m9 y3 m - / J1 o) H) p g0 @( j" {
- static int acnt = 512;- l K, Z' X \6 P) c
- static int bcnt = 8;; x, ?% K# l( }
- static int ccnt = 8;
: W# V3 M' ^" y; e( ?: R' v$ \% ~
1 D0 s6 Z- Y2 W- module_param(acnt, int, S_IRUGO);
) \7 k# L4 C( M$ ] - module_param(bcnt, int, S_IRUGO);
. M7 U: c5 X+ k$ c$ | p+ D% R: |7 Q$ @ - module_param(ccnt, int, S_IRUGO);
复制代码
7 ?+ T! M/ u6 o7 D5 H- k6 D7 Z* a5 Z! b% c" E% d6 |6 m4 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ?: x' `2 E3 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 C- [$ a9 a! d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 N' t9 P- W* l- w$ k3 x$ X- _2 L9 p/ Q) X' s+ M/ Z& L
& T. d2 H" C! N2 d) W! s# A
|
|