|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 z2 d9 V- W3 ~6 j- [code]EDMA sample test application, r/ g7 v7 h8 t: a
- /*7 r8 ^0 {' F' A5 y) ]" g; k9 {
- * edma_test.c
9 Z! e, c0 q, ?4 g. g - *: ]1 y) u4 T) s& \
- * brief EDMA3 Test Application [4 u5 @8 N u0 H
- *
; N& E6 _4 f( }4 t0 q1 _% y1 Z - * This file contains EDMA3 Test code.% k1 O( Q6 }9 G8 K7 `& p
- *
: t& d; u& w1 V! D* F3 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' H4 p: x9 L. g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 n5 r/ V* x; m/ `& }3 ], B/ `
- * TO CHANGE.
0 \( M+ _; k! J5 ~- q - *( m, f8 S' A# x! d1 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t+ A m$ c+ [3 i6 ?1 f- }
- *4 _2 D) i* ?2 j# b% K7 y
- * This program is free software; you can redistribute it and/or
' P5 {6 Y1 H1 t: S1 A - * modify it under the terms of the GNU General Public License as: D2 {" S. O; ~( k! o5 {
- * published by the Free Software Foundation version 2.; N- w& ~# H6 _; q# M+ p Y/ t6 @
- *; v. d: R' |) d J v i* b7 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 e* u) _; g H7 n7 |) G& n
- * kind, whether express or implied; without even the implied warranty0 R, c" y0 U2 M/ v9 F O, g: p& j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) C' A S+ c4 ?5 U+ N! u
- * GNU General Public License for more details.+ J. o& p7 L5 q! ?! q/ K6 e# _
- */
( P. |$ |/ W2 c& z3 `
* i" d; |2 ~& l1 Z8 y- #include <linux/module.h>
+ N! T1 j0 s/ ` - #include <linux/init.h>8 m# j- N( W# T) V+ Z% V9 _
- #include <linux/errno.h> O' `# t7 d2 X v+ ]- c
- #include <linux/types.h>$ _) T+ f: \7 e4 `7 a
- #include <linux/interrupt.h>
# b" [) m# S. i. t" n& E - #include <asm/io.h>
& ?4 I m V" R3 u7 L8 A( e - #include <linux/moduleparam.h>
; V8 ^ w q5 T3 H - #include <linux/sysctl.h>
; r" u' B6 C! d4 `0 t+ C - #include <linux/mm.h>
( w$ \5 M! v8 J; B4 a. g0 p/ m2 X - #include <linux/dma-mapping.h>
" \+ s( y. N6 a8 n' n, w
6 {& |$ ?% ~. m8 g9 C" V- c- v' x- #include <mach/memory.h>, i7 Z! K1 P* g- f0 v
- #include <mach/hardware.h>' h7 M) K: l4 f
- #include <mach/irqs.h>8 {8 C6 \8 j% _5 j" X1 M
- #include <asm/hardware/edma.h>
# c5 c x9 n1 [- k* t, j5 z
; p O' a1 ]' s8 D4 }- #undef EDMA3_DEBUG
7 `! t- p2 q! e7 n5 g - /*#define EDMA3_DEBUG*/* s9 l; D2 n. T' X. `# A' _, q$ E
P2 h* o9 \. M- #ifdef EDMA3_DEBUG
. y0 ~- f) B! {# J, \. K; g: ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 j0 Q' M7 k3 w. x- X1 o( X1 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 f2 z: {1 {) j% Q2 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& f2 w; [/ d( q - #else
4 @$ S" |! h; a2 n7 d* U6 Z. D - #define DMA_PRINTK( x... )
# `1 t8 v' n2 q& A, q5 P8 j% f- { - #define DMA_FN_IN' B! @8 ]. X4 Y4 Q8 p% V, D
- #define DMA_FN_OUT
% W* z: G9 M8 `% {2 K$ Q$ T9 G - #endif
+ E ]9 G% e- o - - X# _* z. C" w& c; g8 u0 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" j* t* ~" m$ f, h1 u( g- t; C
- #define STATIC_SHIFT 30 t7 G1 W7 M, x" j
- #define TCINTEN_SHIFT 20
; w- i9 u6 M, h- s. j; u; S - #define ITCINTEN_SHIFT 21- y, X0 g9 h" E5 E- i
- #define TCCHEN_SHIFT 22
8 y# H% H5 m! x - #define ITCCHEN_SHIFT 23( n' |6 u C9 w0 g ]
- 0 O/ m5 t5 g8 s7 i) j+ \
- static volatile int irqraised1 = 0;5 l& z. l7 |8 f' i1 j7 n3 m
- static volatile int irqraised2 = 0;8 w+ V! L9 r5 T9 ?& o+ W3 e
; m0 X! b' j9 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R+ n5 L+ c+ s4 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a: T d# ^: q8 m4 o8 d% M$ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W6 ]3 L0 z' w6 [9 j/ h7 A - / C. d8 j2 z0 x" W9 P5 a8 z
- dma_addr_t dmaphyssrc1 = 0;
4 U6 K5 U E' C% \5 C1 ] - dma_addr_t dmaphyssrc2 = 0;
3 G/ j2 ]6 h& z- L - dma_addr_t dmaphysdest1 = 0;+ a& C7 U# s3 R7 G0 K/ x# c# ~/ c
- dma_addr_t dmaphysdest2 = 0;# }. g h9 m! _0 s, Z
- 9 X+ N |& O& I) p; P
- char *dmabufsrc1 = NULL;5 W& z/ M: G1 }& [ K& }1 E9 O8 x
- char *dmabufsrc2 = NULL;
" k% r) q) V% o' j0 l; H* c: i - char *dmabufdest1 = NULL;
( L- B( U! [& Z- _ - char *dmabufdest2 = NULL;
% d4 |9 g( X0 a. x - Z+ ?! B U9 j! ]
- static int acnt = 512;! y0 o7 z7 i- v9 g) d/ Q
- static int bcnt = 8;1 F4 |" P2 p8 }# t8 D: r9 R3 _' j
- static int ccnt = 8;
4 @/ l" ~8 `4 B# g
% E/ p# t# G/ j Y( D' c j- module_param(acnt, int, S_IRUGO);
6 G+ ~* b+ }+ H' V- B - module_param(bcnt, int, S_IRUGO);
9 P8 T" X/ P+ U& D - module_param(ccnt, int, S_IRUGO);
复制代码
7 [& ?/ @& d* }1 {' c* M. }, l6 u+ `; J
3 t! @6 O8 f6 U+ B! T/ l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 c, g9 Z" P N- Q/ N
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 {2 ^; |& |, M1 t% \' J! D3 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. K3 [9 O4 ]: l) h7 c" ]+ u
, J* E% p; o: j# F6 X4 P# {* ^. \. W3 n0 M z$ D. [0 s3 o8 f
|
|