|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i3 O+ Q- b1 V m' k* f2 a3 t1 a- q6 _- [code]EDMA sample test application8 h% O+ F" B0 X3 B
- /*- u6 X k% v! _( S
- * edma_test.c; P) r# ~8 K$ y0 x' S* p; q9 b
- *) H) V$ d' \: ^* `! d& o) F) \0 u6 |* _: E
- * brief EDMA3 Test Application: x' [3 y8 w+ g) [( s
- *
( k0 N* M+ M& L) z& A! i b, } - * This file contains EDMA3 Test code.
5 S3 p* T$ U0 L% i$ x5 s( P: a - *, Q, j& H. [% P$ H1 c: q3 w/ _; c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" w9 E# E9 N! D& G! ~6 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. ^. L7 f, m; f' V) f) w - * TO CHANGE.. ~& h7 U9 i5 b: u, z# l( Z
- *
# K6 |7 ? s! i8 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; U0 }6 Z: @6 u
- *
, _& H. O+ ^+ X - * This program is free software; you can redistribute it and/or
: G& L$ _, s& {5 M. x9 d - * modify it under the terms of the GNU General Public License as1 n. p1 E5 M! X& C- G! b$ s5 k; H
- * published by the Free Software Foundation version 2.
$ t( J ~( \: Y - *
; {% t# n7 Y8 O( r# ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 a+ D M( \8 b# W: E) Q/ ?& i2 [ - * kind, whether express or implied; without even the implied warranty1 {+ M8 u1 B+ Q& [& s1 I1 y. s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) g3 ^" N5 u& O( u) h - * GNU General Public License for more details.' ]& S f; `5 m0 H
- */ {! U7 W7 O# o1 F# Y8 ~
9 B* g( j7 G4 Q, A# D- #include <linux/module.h>1 u2 J( h/ i0 Y$ }
- #include <linux/init.h># q$ H: c' `+ ^: ]% e
- #include <linux/errno.h>. s3 a6 f1 _6 T1 j! h2 e
- #include <linux/types.h>2 q0 ^- H$ o* l; Z6 M
- #include <linux/interrupt.h>7 P: _/ F+ s' `
- #include <asm/io.h>
9 P! ]% L Z* P( P& f0 Z - #include <linux/moduleparam.h>
3 N* ? b- k7 e5 i* i* j - #include <linux/sysctl.h>; e( V/ v( b5 t+ t
- #include <linux/mm.h>9 G$ X" }# P5 Y
- #include <linux/dma-mapping.h>
8 M) R |) I* F
- x& g! ? U) w4 R) m- #include <mach/memory.h>7 i7 ^+ M3 L8 R) w C3 d
- #include <mach/hardware.h>5 Y" E! R! f4 u' \9 _
- #include <mach/irqs.h>
* W% `3 D2 }) w6 e - #include <asm/hardware/edma.h>3 z' m0 ?, K( t& M! M, R
- 9 P j( l8 e4 d( c( {
- #undef EDMA3_DEBUG1 e/ d0 k& B5 q6 H" R* W
- /*#define EDMA3_DEBUG*/
, q1 }& T O# j0 a/ a5 C - 7 A- c' E K: ^# a- I
- #ifdef EDMA3_DEBUG8 `9 j8 y) E# M X4 a$ c. k% G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 J- T G' [9 ^0 h. E- A9 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [# T* y; t: r) u* |0 {5 J% l( G1 `4 P0 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 j! ~9 {# R) n* f/ {. G- a. u* g - #else
" c7 ] S7 ^: s+ b0 Y( L# i - #define DMA_PRINTK( x... )' u* O K0 h$ U* C: ]- \) Q
- #define DMA_FN_IN* z4 `3 Y4 @8 f1 T
- #define DMA_FN_OUT, x5 @* a' A/ q( _+ ]' x
- #endif# i; j% w/ b4 } y
- ' [6 s8 P) @6 E4 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ s% Y0 w8 X9 e' e - #define STATIC_SHIFT 3
, `; U9 Q8 c1 A, H - #define TCINTEN_SHIFT 208 ]0 {5 G" l4 b* j6 G
- #define ITCINTEN_SHIFT 21
& O! ]% g0 T. K - #define TCCHEN_SHIFT 22
' l5 b/ E+ ^4 p! u# [% T' P: n' C' w - #define ITCCHEN_SHIFT 230 d3 P) G* O" f; o# t2 R
- + J$ X2 y: V) r& m9 t, P& P
- static volatile int irqraised1 = 0;# l7 j% d( X* H8 A" j
- static volatile int irqraised2 = 0;
3 h9 c6 `2 O3 `% I2 I - 8 i/ w* A! O$ ^' e$ m9 M" K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) z; l+ H9 B( j& p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Z. J B8 T! w0 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& C2 W9 X& C/ a# Y - 3 D5 [0 {& T1 A
- dma_addr_t dmaphyssrc1 = 0;1 ~- ?& j. e; K! @
- dma_addr_t dmaphyssrc2 = 0;
, P6 d" @ f" r4 ~ - dma_addr_t dmaphysdest1 = 0;$ a$ ~/ T8 Z z3 ]' |, b
- dma_addr_t dmaphysdest2 = 0;/ n1 g! ]5 F, Y/ X' i+ u ]
& `6 w" ^2 ^7 C- J0 p# H* o- char *dmabufsrc1 = NULL;
C4 m" m6 C: f& n/ k K - char *dmabufsrc2 = NULL;
7 q# K! N( ?0 l8 R - char *dmabufdest1 = NULL;
. f) \( ?* J- l/ o - char *dmabufdest2 = NULL;$ T$ T; {* V8 d
" Z' b- f! B- R8 Y4 l- static int acnt = 512;8 P+ h- [ v5 `, l* |$ A& E' s+ b1 C, Q
- static int bcnt = 8;
2 q5 L. q" q5 G2 Z+ n' A - static int ccnt = 8;8 B0 j0 h% T5 Q G
8 A/ |: ?( `3 F- K& ^- module_param(acnt, int, S_IRUGO);
) f7 W Z, |- G: j* T - module_param(bcnt, int, S_IRUGO);
) [) [4 |6 ?0 p: p! g - module_param(ccnt, int, S_IRUGO);
复制代码 + a/ g6 d, Z4 |! d6 _- G9 H0 [. Y
8 |9 C! `6 Y5 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" u4 f. o) n: r, W* F! }* U4 v
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 ~3 R) l5 ^8 Y. y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 g, r" Y" a) k+ Q O8 n8 Q- ~" e. |! b# Y, F
7 G( r( S7 Y4 u |
|