|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 k" U2 d9 W# a3 o* e# V- [code]EDMA sample test application5 E: G$ k7 L' D3 Q
- /*
! |9 ?' L- v- i! j9 z - * edma_test.c+ m% V1 y& B$ J) F6 b4 L5 O3 j
- *
, A5 K. N3 q- @1 X - * brief EDMA3 Test Application& ]( v- f* k% I' h' y; g6 e7 P. J
- *
7 r$ L" t6 F9 L - * This file contains EDMA3 Test code.( R0 B v3 |! R2 N4 q: l
- *' c9 ]) s& {! R# r. \ c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 c5 U5 {; ~( P, v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 H; p/ v3 C4 }* X& E - * TO CHANGE.
7 K& r! F. d% t- Q - * ]$ |" w" K9 d' E) _, R5 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 v6 T: |2 V6 U8 y8 T7 S2 C - *
6 k& W& [3 ^; X7 I - * This program is free software; you can redistribute it and/or! p z5 p6 R+ D* [0 ~
- * modify it under the terms of the GNU General Public License as
- F, C5 {7 m @% N - * published by the Free Software Foundation version 2.
* F3 X4 g; I6 d6 z1 d/ {$ J - *; C9 n6 I. v' k7 h$ }) L# B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* B ?3 F9 s$ b9 B - * kind, whether express or implied; without even the implied warranty) f) [( j P7 l+ n( [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 _/ h3 D! r% N. l& j: i$ b6 c - * GNU General Public License for more details.$ @. g: {7 V9 V! S. u
- */
2 b9 l. O( s% N/ X" C
7 K7 U' R$ s; @0 |- v- U# S- #include <linux/module.h> r" o, B0 s1 x) C# j1 B
- #include <linux/init.h>
* [* ?; h+ }6 @4 o/ `' [0 T - #include <linux/errno.h>
# k* N ?* G' V+ ]; }) L( M4 k* q# | - #include <linux/types.h>
! l+ S, b+ R4 G4 R# f5 ?7 h - #include <linux/interrupt.h>
3 q8 e* m e9 b& g; O& l* D- P1 N - #include <asm/io.h>* d; H1 U8 N6 q9 Q' {
- #include <linux/moduleparam.h>
: ]% F2 `% {5 P# M% \6 @ - #include <linux/sysctl.h>
2 ]8 o" R5 l7 A% h& v. q - #include <linux/mm.h>
8 J0 l, M1 I( e4 P" J' F - #include <linux/dma-mapping.h>
! m: e! f9 Q' I; Y5 ~; h- ~
* I B* j y7 `: O# m6 k! s- #include <mach/memory.h>
" \; b( n& p* Y. { - #include <mach/hardware.h>0 z* U6 g' e* H- S8 X- ?4 b# o
- #include <mach/irqs.h>
0 Z0 F. E3 F. Z h7 ]' s - #include <asm/hardware/edma.h>" D4 }2 o1 i+ { r2 J' s
( R/ `2 ^* \9 Q; I! e$ _- #undef EDMA3_DEBUG" U5 Q: ?( \4 i
- /*#define EDMA3_DEBUG*/
" x7 i5 r' i% m: o |
4 P% D1 K- e- L h6 R' h/ z- #ifdef EDMA3_DEBUG9 p+ s* h7 U- X' Z; n/ C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! E5 M! G; ^# A, \' N1 F, V J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 e( F# }) A6 T0 c6 o; k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( Q7 B' X1 q: a. Y3 K9 L - #else0 m: C8 @% [& h" F5 R. S; U
- #define DMA_PRINTK( x... )6 m3 U. e& k- T; ?* Y
- #define DMA_FN_IN! ~; L- Z, S6 B8 D2 L5 z
- #define DMA_FN_OUT
5 I5 d6 X0 \4 p* [' o8 X9 k' T4 A - #endif
: e9 B$ [, S+ z
h4 Q r0 b- \' J- X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ O6 D% y% _( Y9 v5 }4 Q
- #define STATIC_SHIFT 3' i3 W; f' f$ F$ b/ ]
- #define TCINTEN_SHIFT 20
# B+ f, D7 Z* r! ?/ `+ n - #define ITCINTEN_SHIFT 21" i: r5 p; M( k1 z! r7 F
- #define TCCHEN_SHIFT 22
, w6 K3 S5 ~) Z% @/ [ - #define ITCCHEN_SHIFT 23
; b7 a9 p" v. }7 O6 F - & d/ T5 a* K# N
- static volatile int irqraised1 = 0;9 X8 M$ _9 ]% Z& m% }; d2 h$ e
- static volatile int irqraised2 = 0;
3 C" v; O' _% l9 l8 l
. b' `) A$ H) @) t+ |/ T5 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k5 q+ ?" x# `( s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" e1 H+ b8 n' J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Z+ q) M. d0 i! _& x
' Y3 ]& R, B0 N3 }/ T- dma_addr_t dmaphyssrc1 = 0;7 Q3 `1 b; B! q0 J2 b
- dma_addr_t dmaphyssrc2 = 0;; B. E0 u: P& ]- m$ k5 Q* C: c
- dma_addr_t dmaphysdest1 = 0;
/ s+ j" H- f1 E5 y; c - dma_addr_t dmaphysdest2 = 0;: }& R! _; l7 f7 d( M
3 ~& L5 r/ O6 b! J( m- char *dmabufsrc1 = NULL;
3 v8 H) K# A2 N( t2 L' _ - char *dmabufsrc2 = NULL;
: [; X' g" ?3 C8 t1 R0 `8 V - char *dmabufdest1 = NULL;) q5 j$ t! ^7 @4 ~- C2 {0 z" B
- char *dmabufdest2 = NULL;
$ S( j* E; y1 D% z7 c/ D - * c7 s% o& [! E0 @( y* U
- static int acnt = 512;
/ N. ?; `8 B1 k: G+ b8 C' v - static int bcnt = 8;; w0 f8 f6 \4 A9 f* o
- static int ccnt = 8;% h9 {$ [( O# s6 y! {) Q( K9 {9 k
% A A* k7 `0 u3 u0 I- module_param(acnt, int, S_IRUGO);
1 p5 t1 W; O2 t# f( k. X/ ~ - module_param(bcnt, int, S_IRUGO);/ K L$ ]% Q. Q2 f
- module_param(ccnt, int, S_IRUGO);
复制代码
6 `0 N. O# h2 |$ j$ t: a' n* r5 q! A U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]; D3 ?- j+ {0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ L1 \/ y1 H; w) F: I8 q; l+ c1 B5 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x2 R" i# |* }9 R! H/ z2 Z
# y& I/ e: f& C" Y$ Z. H. |( F( A% _5 |! y
|
|