|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ Z5 g& G' M9 ]# v- z0 C: a Q- [code]EDMA sample test application; Z0 C% @! \5 P( ]5 I- g9 ~% q: E
- /*
4 O* y' u/ b7 F2 k% `% N; y/ r - * edma_test.c
6 v, Q m5 R8 E2 K4 \8 d - *& h, ?4 \5 @1 @' a2 k
- * brief EDMA3 Test Application3 v0 E, {* R( d2 l5 _
- ** k A, o2 C' G% C
- * This file contains EDMA3 Test code./ m2 Q' Q6 W. Y/ o
- *+ m: L3 H& w7 V3 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 L) O& e" J! m7 ^7 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ?! z; s" A. }1 R
- * TO CHANGE.% G7 T4 d, w& q5 w, y3 D
- ** i, b' a ~7 V7 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% W6 _/ I4 k1 `2 a - *
2 I9 e4 n" T( A4 s - * This program is free software; you can redistribute it and/or
7 l7 U) ~% N9 U3 S) I - * modify it under the terms of the GNU General Public License as
6 m/ ?3 f* S9 a/ `' P( L+ x - * published by the Free Software Foundation version 2.% s" T! O# c6 I# x% g
- *& _ D% Z+ ]6 `/ p' F+ k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o9 p% B8 |3 O
- * kind, whether express or implied; without even the implied warranty5 ^9 T% I, Y: Y$ Y$ G- n' F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* U+ I- s) M- t1 N
- * GNU General Public License for more details." d9 r. }+ X& t/ k' O
- */ R* j' H+ s# y0 [1 Z t
- 3 _# T1 I$ e \9 A9 B9 f
- #include <linux/module.h> o/ c7 n1 I" T* G7 i4 t) I
- #include <linux/init.h>
9 E0 d& Z2 v W, f0 M - #include <linux/errno.h>3 g) X7 h3 Z) A
- #include <linux/types.h>8 v- k1 ^9 |7 w' [, q% ~, j
- #include <linux/interrupt.h>
5 x6 q C+ j& X0 ] - #include <asm/io.h>1 C% \1 a( [: @# i+ I
- #include <linux/moduleparam.h>6 e, ^0 {2 y+ m# d- b- w; ^
- #include <linux/sysctl.h>
( T& J# Z4 a5 a4 N3 K - #include <linux/mm.h>. G1 n# k; r* a4 [0 q6 E5 [
- #include <linux/dma-mapping.h>
7 B) F7 P( z" | - 3 t% ]* _% u3 ]. u+ @: e
- #include <mach/memory.h>
$ R. s9 b" a' P+ N H5 ~8 \4 y - #include <mach/hardware.h>; x- @1 S2 H, }) _
- #include <mach/irqs.h>9 R( R* F" |' R# o; y
- #include <asm/hardware/edma.h>
* K4 U% ~( h6 M( T+ A" f - , A% g0 i* Y* W
- #undef EDMA3_DEBUG k9 z9 F9 a2 t/ W, Y2 e0 m
- /*#define EDMA3_DEBUG*/
( k! x8 Z, c; H
! d3 }# _0 F* b( {- #ifdef EDMA3_DEBUG) ^' r) ]0 L+ D) v/ j; @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, G, u2 R/ t- g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- t3 q7 b( i$ K# u ^" [+ u I* V3 U3 l* V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^3 g2 _9 E" c% h" k) q1 |1 }
- #else
& z, C6 B& w' }# z$ z: u" k2 U - #define DMA_PRINTK( x... )* ]" v$ Y" d" C2 Y2 |/ J' g; p
- #define DMA_FN_IN! u! I2 x3 k# b9 l% R
- #define DMA_FN_OUT% B6 A$ F, s: c' [- w; s) A# m
- #endif
+ x+ ]" H! B$ z: t* O+ h2 v - . X" b _% K& t% b4 h2 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( u T0 r3 `1 t; r, G4 j6 k
- #define STATIC_SHIFT 3) X8 F& K" U1 W6 d n
- #define TCINTEN_SHIFT 20& b, `+ Z5 d* x. {- }( ~( D( |
- #define ITCINTEN_SHIFT 21& n2 m1 z- v, s8 |# }! b( M
- #define TCCHEN_SHIFT 22' a* h* S2 ~$ _: p. j5 y2 J# v
- #define ITCCHEN_SHIFT 232 ]& M/ A" ^+ A# Q
+ p( V( Y4 u/ d0 K7 `9 q- static volatile int irqraised1 = 0;
# W2 x8 b* b! [: @) e - static volatile int irqraised2 = 0;
& ? g0 N6 H9 a, |6 H - / j: M3 X4 c% G9 f6 ^/ ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. n4 d; y( G" X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S' Q* X& g; i/ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k. r; G; {" M1 e# C& ^
- : R$ a$ B+ S% o# e& ?
- dma_addr_t dmaphyssrc1 = 0;
, S1 r1 F, P* S9 w# f; N - dma_addr_t dmaphyssrc2 = 0;# R: m. v5 I6 I% g/ c
- dma_addr_t dmaphysdest1 = 0;
6 d/ C$ `0 z$ ^' u: i - dma_addr_t dmaphysdest2 = 0;4 e0 i( Z0 G2 h; N
) f, R! {3 b1 p: a- r, ]- V. y$ w. s5 E- char *dmabufsrc1 = NULL;' Y" z8 \" Z6 z% F6 |
- char *dmabufsrc2 = NULL;
& C$ r* K9 ~/ B - char *dmabufdest1 = NULL;$ J# w& Z* A x5 m1 Z
- char *dmabufdest2 = NULL;
$ V$ @( @) c, _6 L
( H4 N9 J$ z/ @5 O- static int acnt = 512;1 E1 h7 n+ l- L/ @5 W3 {' _
- static int bcnt = 8;, Q, d" q3 L5 u
- static int ccnt = 8;
& V% Q3 q% N* V4 B: c; V - 9 M* b! {; U: C+ u
- module_param(acnt, int, S_IRUGO);
" x+ r2 x. V0 J! {+ X# r& a5 C2 R) D - module_param(bcnt, int, S_IRUGO);
. K- J( K. i. A - module_param(ccnt, int, S_IRUGO);
复制代码
9 @3 I- C5 W- O- F0 R
) U' D9 v2 @* ^ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, c9 h8 U. U% B2 h$ h, w$ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 V2 c! O5 f1 G- R6 H+ i8 H2 v' [- _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _% |3 d& B7 m2 V7 O
; x. d7 K3 U, h. E6 y1 u* K" {
3 p7 d0 A, \9 g9 T- w |
|