|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* ^' v: ^7 x1 F0 L9 j- [code]EDMA sample test application
6 x9 P2 g5 r: i3 b6 o - /*/ [( Q/ B+ E; L S1 D" W
- * edma_test.c3 F% ~$ M0 m2 t0 m& u5 ?" d
- *
" |$ C) \; w7 _4 W1 I, c( K - * brief EDMA3 Test Application
% Y' N+ L8 R' Y - *' a/ M& v" u$ A6 K
- * This file contains EDMA3 Test code.
4 U1 J! Z2 A0 Z0 O5 E - *2 ~8 J+ Y6 d% \* k+ |8 N( v# U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S4 d: } j% X+ p2 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 J2 y; Q$ n# |/ J. l
- * TO CHANGE.; i' o( E- H# V& D: o! e1 G% r
- *
7 P" [6 j3 P4 v$ @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& D) X F# @) x$ z: c3 S# M! C/ W
- *
3 J1 W0 H I( B+ v z' X* ^7 W - * This program is free software; you can redistribute it and/or
+ ~" O% e' @* d1 C. i2 ?; v - * modify it under the terms of the GNU General Public License as
* t1 w' ]/ W& q# Z7 ? - * published by the Free Software Foundation version 2.
/ { K" M$ t* t8 ]- J+ }2 F! D - *
8 |& f3 G( J! d# j+ q. A% t G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 S T, B6 w- V+ k
- * kind, whether express or implied; without even the implied warranty" l& [( }- y: J% ]9 @: m" ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 m9 L5 |, H8 y4 ]$ t - * GNU General Public License for more details.
4 ^0 g6 B7 ^' n5 r7 @+ E - */" r. `% W) e, L! j
: R/ k0 ]5 ~6 t* z8 p+ Z) H- J- #include <linux/module.h>
* e4 j9 o5 p* o7 Y: ] - #include <linux/init.h>
" u [! b& n/ a - #include <linux/errno.h>4 B' s6 g6 L; E' }. `8 f Z* b: q
- #include <linux/types.h>4 U/ D1 b% V1 I/ B
- #include <linux/interrupt.h>
x+ J, q- m$ K0 e2 [% n - #include <asm/io.h>$ S) o8 ~: H+ j/ ^
- #include <linux/moduleparam.h>' ^2 T0 ]$ n- D! {
- #include <linux/sysctl.h>" k6 i; |" J2 }3 z
- #include <linux/mm.h>9 F0 k8 |) J" `" ^) e
- #include <linux/dma-mapping.h>$ L- H/ j. T/ u! l4 z
- % g" h) A- X+ L u: `% x
- #include <mach/memory.h>5 m# ^% r6 v, i8 {
- #include <mach/hardware.h>
, y+ E6 U5 N) d6 A+ _- ] - #include <mach/irqs.h>& n* L* X$ b, O6 C1 S/ c7 p6 T- V1 R
- #include <asm/hardware/edma.h>
|! n2 b, s. o: ]1 q8 z$ r
: u: w8 ]% P6 q. p( W0 @- #undef EDMA3_DEBUG
3 h, q+ V& e, K) y - /*#define EDMA3_DEBUG*/
9 ]" U" ^& x4 }7 [" u( W0 k - + t1 b* k' I, ]
- #ifdef EDMA3_DEBUG
5 R6 K# f% s' f1 L5 S) \* h2 Q0 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- V8 w1 k( Y' k; g6 P+ k( Z6 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* ^2 `# h4 n* E5 i: }6 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): v; X: J c, b
- #else6 p5 |# e& u; U% V8 X7 y
- #define DMA_PRINTK( x... )
8 `6 k* b$ h1 ]3 ^4 |" U3 X- D) z - #define DMA_FN_IN4 f. X- o! |3 v- a
- #define DMA_FN_OUT [1 |6 R8 J: ?9 [+ J" l8 v
- #endif: ?- t* G5 R4 l' s4 u( V
1 j3 B* l. U4 R- r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" Q, I: m' x( |5 q' W6 t* }' w
- #define STATIC_SHIFT 3
! ~6 f S6 M7 O5 s4 M - #define TCINTEN_SHIFT 208 z! p" B9 [3 ], `, ]/ `
- #define ITCINTEN_SHIFT 21
/ S/ q5 X9 @2 v. {+ V: v- n4 H& X - #define TCCHEN_SHIFT 22 u: {- m4 B2 h2 V
- #define ITCCHEN_SHIFT 23
* ?0 b" L. y/ ]1 r; {
: |/ F& D! w/ e& i% M2 D$ l+ \8 ^0 M- P- static volatile int irqraised1 = 0;" K# I- L* P/ t5 M) F g
- static volatile int irqraised2 = 0;8 l' `4 y5 T, z: o
- / H+ \0 W. ?+ H6 _: V+ P3 e' D0 h7 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: O$ N$ R L3 o: r( z. W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ p9 |. z: T9 a( |& F5 ]8 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* p' V. s8 k$ a* O
5 b! m1 y; Z- j2 k- dma_addr_t dmaphyssrc1 = 0;
' @. z4 }7 h3 @ - dma_addr_t dmaphyssrc2 = 0;
. a6 m6 }& F+ v5 m - dma_addr_t dmaphysdest1 = 0;* C, n' j/ k& t9 K2 {
- dma_addr_t dmaphysdest2 = 0;+ D0 V3 n& S2 u& H9 ?: e1 o
. T& U2 N1 Q8 k' W- char *dmabufsrc1 = NULL; e% t( v( }/ f4 b9 M
- char *dmabufsrc2 = NULL;
v* E, l$ K% G3 L; ~4 J: _ - char *dmabufdest1 = NULL;8 r3 b7 Z+ [ A5 v N! U8 k* |: j1 D' d ~
- char *dmabufdest2 = NULL;/ B& @; M9 p! ^2 ^
8 j+ o' l9 }* R* U' H: y- static int acnt = 512;
4 L# t8 @; C; x9 S- n - static int bcnt = 8;
5 B3 c2 y/ Y3 b- k; J3 ?; G% q - static int ccnt = 8;
0 C) T. @! a4 Y
% A/ G. ?7 s9 ~1 @7 x' ?. |- module_param(acnt, int, S_IRUGO);. v* Q$ u# ^: }
- module_param(bcnt, int, S_IRUGO);
$ M8 `! M9 y7 r# G6 \ - module_param(ccnt, int, S_IRUGO);
复制代码
1 x8 Y& e5 O6 f5 d# z# s
1 O# j ~+ G* B- c/ p$ J. `" } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Y* y% N) V9 m* {3 q- [& ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 @* e9 U) B0 \% ?1 M& p0 w0 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 M+ j3 {0 l+ k: g, u9 y3 r
) [( R- G1 g: A( y" v( d
- l7 c" o4 U/ V- F# r8 P |
|