|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V- P$ S7 D+ A, |- [code]EDMA sample test application
' \) ~; s, \. l( |5 O - /*5 d3 i6 |( H. X; Z
- * edma_test.c; b8 L# n' Y* s
- *
X! o3 E) v9 S9 ^( r - * brief EDMA3 Test Application
9 ]- _: E# {, o: j - *5 e( z7 V/ H' m9 K
- * This file contains EDMA3 Test code.$ y& x( K. G+ H: e! h2 W4 L. T: J
- *) w2 _4 X8 E- z a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ e7 E' B+ l6 t: N8 J. @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! R! o. ]0 x8 s6 m - * TO CHANGE.- ~) w+ Y) }* J8 P+ @/ f9 S
- *
+ {8 u. P9 w; V, H) v2 p3 f5 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 c( v' ]6 f& K+ e
- *
4 e$ ^! b: P% \6 ~ - * This program is free software; you can redistribute it and/or
& p! `2 G9 h; @6 N- g0 B - * modify it under the terms of the GNU General Public License as
# A; s3 E4 g2 B2 Q - * published by the Free Software Foundation version 2.# ~5 f! c) B" p( b
- *% K2 k! F1 j5 G$ [0 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: F" I9 J) g7 ~
- * kind, whether express or implied; without even the implied warranty
: c5 D' l3 ~) }5 F- N6 @& r3 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( { B+ V( s; V: X. H% ?/ d5 z& Z
- * GNU General Public License for more details.* r( a# m& d5 \: r& a
- */, q6 L- ?/ i" Z% I: F8 h# o
- / Q; r1 Z- Y/ U; w. m
- #include <linux/module.h>) N3 L( ]* F* j' L6 A
- #include <linux/init.h>- |2 N6 x# J6 ]/ ~8 i$ p* ^3 s
- #include <linux/errno.h>, I5 m% I1 V, M$ w
- #include <linux/types.h>
* h) ] v2 y5 t - #include <linux/interrupt.h>
" X+ G! `0 m2 s( e2 ^4 O, ^ - #include <asm/io.h>
* _! F& l+ r4 u0 r9 h" ` - #include <linux/moduleparam.h>
- ?2 @( y5 V$ X& S3 D# u3 p - #include <linux/sysctl.h>
, k: g- Y( t7 X0 F, u - #include <linux/mm.h> C6 H$ J2 p$ L* D2 H
- #include <linux/dma-mapping.h>
; l7 a1 z O( H* g - 6 Z1 e% j! b' ~" {* z4 [$ [
- #include <mach/memory.h>
* \) I1 Q" W3 x2 o3 Z - #include <mach/hardware.h>( N# b _0 S+ r9 K5 r$ m( c
- #include <mach/irqs.h>
D% [$ V" `. I4 R3 o' x - #include <asm/hardware/edma.h>3 b) D; ]7 G" ]& N6 K) y( |
- ) n/ i: ]2 Z4 N" E+ J/ W3 n
- #undef EDMA3_DEBUG
: M' O3 _/ ]3 o" d - /*#define EDMA3_DEBUG*/
$ Y0 R1 s" |1 V9 P$ I7 N
7 K' c- G) s" { b8 r- #ifdef EDMA3_DEBUG0 U; E% L) L, o# Q+ U+ p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
]& a) q; j4 P+ q' A% f3 \6 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 p" T' N# {( o' |8 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* v! | ?) P$ a$ f - #else2 J6 P/ w$ y* d0 d+ c/ W
- #define DMA_PRINTK( x... )$ `! j0 E7 m) O8 s2 g
- #define DMA_FN_IN) h' l8 j/ O/ I) t& M
- #define DMA_FN_OUT
# ~( {( f% c7 s$ f' R- C - #endif
3 G$ o# r8 n' z% o/ ~
# Y; }3 a- r7 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# _$ N6 w/ t5 c/ U
- #define STATIC_SHIFT 3, B# ~& Z- q, P; W8 y# q+ L, A( D
- #define TCINTEN_SHIFT 209 c" B; N' A# t A5 N
- #define ITCINTEN_SHIFT 214 L) Q+ a) Y. g4 t( h( R5 r: Q
- #define TCCHEN_SHIFT 22
( U8 `( H. A# U% [- r - #define ITCCHEN_SHIFT 23
: a+ S( T$ H. W - # g9 J+ v9 y4 x9 b( N E6 p2 h- C2 _+ K) W
- static volatile int irqraised1 = 0;
8 q; @# W; m: Z3 \ - static volatile int irqraised2 = 0;. \! ~$ t4 B* j$ D
# J* |4 f, w5 ?* E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ]- l* u" X: E0 b' b8 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p0 d5 C9 s' j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c8 u \- w* J& h! S ?0 R! U
" p# t# p; j- @/ V+ T9 [- dma_addr_t dmaphyssrc1 = 0;
7 ^5 i5 i3 j2 @; y) O - dma_addr_t dmaphyssrc2 = 0;; W# u2 Z0 ]& r2 w
- dma_addr_t dmaphysdest1 = 0;& }- q: I' r y3 I; L
- dma_addr_t dmaphysdest2 = 0;. v# k* t3 [+ C9 Q3 a Y
5 _/ X7 u- U z8 i% T% n- char *dmabufsrc1 = NULL;
6 r) n* W7 j" \, v: ~ - char *dmabufsrc2 = NULL;" D6 f, [% r1 ?5 l2 w1 [
- char *dmabufdest1 = NULL;
9 G/ J, [( L" u2 e - char *dmabufdest2 = NULL;" Z6 H1 z' ~( C( e4 _1 E# f
; }$ Q! ?3 N0 t: g- static int acnt = 512;
: W$ s) @; p2 K6 F- `% U) S - static int bcnt = 8;4 t) U. c+ c" Q- s% Q
- static int ccnt = 8;
% G( v/ L( d @ _4 f9 x+ l7 ^
) I9 o8 i7 }$ ? ?% A- ~% d- module_param(acnt, int, S_IRUGO);0 Y9 O3 S4 @8 f8 b7 m' s6 s
- module_param(bcnt, int, S_IRUGO);
3 g! D5 S( ]4 I: X2 [ - module_param(ccnt, int, S_IRUGO);
复制代码 , ~6 |7 x1 Q2 I4 D" U2 w! Z
" e z/ s0 @9 z- B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) d, ] C% q! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s# P0 X1 {+ Q9 ?- h% @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 t! o# t' X2 `; F# a
0 G. R H8 k: w! H0 h* k" I. F3 h! X: w" K% F& \
|
|