|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 d: ~1 [* A6 c2 N! {2 q- [code]EDMA sample test application- @; ^$ V- z$ u. @
- /*
6 \5 l! s- ^- c# q) { - * edma_test.c9 g( k n: s" P) x! p: o1 h9 ^! @0 J3 h
- *
3 L2 n" Z; g# x& T - * brief EDMA3 Test Application
$ Y9 T/ l% F8 j n- q1 S - *
/ W* I) k. J* O4 f9 L - * This file contains EDMA3 Test code.
/ c1 \4 t+ k9 W5 z3 {$ t- |5 Z! M5 L - *
! L, D1 m" N! C5 n4 k, G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 t. ?/ N d/ [7 n/ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 b! f5 S: a7 o% m( p9 H2 Y7 R - * TO CHANGE.
$ w( L9 O$ V4 v& a; [ - *
2 N! e( C0 l0 \ d: j7 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' q0 _+ i: e, ? - *& v3 ]% b' }. V, [
- * This program is free software; you can redistribute it and/or2 h1 D3 _& M( Y3 ]& c
- * modify it under the terms of the GNU General Public License as9 H4 R; ^+ q c& z! Y) ^/ f$ T
- * published by the Free Software Foundation version 2.
) ^* t4 r, _8 x - */ F7 x+ A; }* S" W% b5 W4 g% k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 {+ c. }+ Y) x- B
- * kind, whether express or implied; without even the implied warranty
2 ~$ L) w+ _0 T/ P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" S! {% z- L* R: S' }9 i - * GNU General Public License for more details.5 c- p. @# R" {
- */8 F+ H( h/ X4 I1 F& j
2 `! d7 ]" }8 @- O% L- #include <linux/module.h>
8 P- _3 U) p% O( z+ O3 T+ U - #include <linux/init.h>* M$ b' E7 r _/ _$ S D9 H' `
- #include <linux/errno.h>
4 [4 U6 g% ]8 o; E - #include <linux/types.h>
) g% ~0 {) a/ _1 e - #include <linux/interrupt.h>$ J$ s! e( M$ @, l; m8 R
- #include <asm/io.h>
& S( ], c7 }3 S+ L8 P; V - #include <linux/moduleparam.h>
: h( Z* u H8 s+ p5 z# o - #include <linux/sysctl.h>. S3 d3 u& [% K2 \( _
- #include <linux/mm.h>
: K- g" z. l6 ]+ D' o# t - #include <linux/dma-mapping.h>
3 E3 O1 e' Z. Y$ r: W- J$ q
7 H$ H7 h6 f+ F: l/ I3 ~8 T9 k+ l! J- #include <mach/memory.h>
) `% _. Y/ _& A$ K2 G, f - #include <mach/hardware.h>2 H6 W! ^% B% I6 G2 B
- #include <mach/irqs.h>0 K1 m9 l9 }: Z* o$ ]- s
- #include <asm/hardware/edma.h>
0 y b' U/ q s% l3 y5 ]' F; s - ; p; C0 i3 `( b/ P- s. v
- #undef EDMA3_DEBUG
0 o) d3 \3 y5 M) C - /*#define EDMA3_DEBUG*/
7 a5 [2 X9 G7 P# i# F1 `! L - 2 ]3 e2 W F4 \$ S& i4 j
- #ifdef EDMA3_DEBUG/ |% M6 o2 t6 x& h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 }% K$ T; L/ M" K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 m2 S9 O% j- @: M, c9 y7 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 }3 `& H+ M. Z6 L' P - #else
0 d# ]! w- [9 j - #define DMA_PRINTK( x... )
; N4 C& |. V- F2 R" @ - #define DMA_FN_IN! b& \4 h3 h5 n* f4 M
- #define DMA_FN_OUT
6 k, H% h! h/ G: @" V - #endif
4 l. h% v# n/ I8 i( |: o
; u( K# O6 o- o9 J" k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! N+ C9 l! T& A+ D( C! X0 ?
- #define STATIC_SHIFT 37 ]* }7 G* G. ]8 U* o: z1 |9 m1 |
- #define TCINTEN_SHIFT 200 P1 K- o- o: u
- #define ITCINTEN_SHIFT 21! n9 |$ e. V; q, A) j x! d D
- #define TCCHEN_SHIFT 22% c1 h% }' N% N3 M' u$ I
- #define ITCCHEN_SHIFT 23) o0 g& f+ r# ?2 w7 q0 X/ T
6 I4 O. a, B9 ~" b* [5 ?- static volatile int irqraised1 = 0;
( R) e; k, \: K+ O0 U" k - static volatile int irqraised2 = 0; s) D) R2 i2 `% Q4 }1 M4 n
- 2 W7 u9 W4 ^# ~# z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G$ T; I8 d! F$ ?/ c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b, J5 C% L4 N) Z, ~1 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 U9 Z% d9 f2 C3 p N
, a2 z, z8 O Q7 ~, v- dma_addr_t dmaphyssrc1 = 0;
! e$ J0 I& A7 A) A - dma_addr_t dmaphyssrc2 = 0;* F/ u+ W L$ a( r
- dma_addr_t dmaphysdest1 = 0;
8 i. {/ b- |% w: U7 F! \0 o - dma_addr_t dmaphysdest2 = 0;: [+ o: U3 p" i- S2 f; g' S
( l( R9 \/ f3 h+ P! g$ }) g- char *dmabufsrc1 = NULL;
$ k9 j6 B( G: ~+ l - char *dmabufsrc2 = NULL;
0 b' {, |1 e& Z) M( q - char *dmabufdest1 = NULL;
2 y) x9 ^) T3 o @7 X O - char *dmabufdest2 = NULL;7 U4 J% Z. \2 u0 p. u
5 c9 ` h* n8 N, {3 U- static int acnt = 512;
8 K* o: {8 s+ `: n$ Z: f1 U - static int bcnt = 8;, p- g! q& y4 G# X9 E
- static int ccnt = 8;
! z. y6 A, }. L, y; E+ P) c
2 P! D; t& e6 T; v. M* O) F! c2 i: |- module_param(acnt, int, S_IRUGO);% }6 `: J2 g+ H! d
- module_param(bcnt, int, S_IRUGO);
/ K7 f& Y4 _# ?/ p3 t - module_param(ccnt, int, S_IRUGO);
复制代码 + X8 ]1 @. N z
0 d8 g$ C" a7 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; \" B; o' ~! x7 |* y3 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B( H& }' @% H. b) x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ k+ y8 m- t' @3 P/ [
- F+ Q/ a7 a* H* s. h' j f' x0 [; _, g* i
|
|