|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O. c% N: s, b C5 j8 @1 ]7 H7 G, b- [code]EDMA sample test application8 O3 L/ R2 u- o' p4 J" i* k
- /*
6 q0 i7 g* @% } - * edma_test.c7 A9 w, C' ?; ^7 {% G, g
- *1 X: m3 B% m+ d/ Y; P1 b* B8 W/ v
- * brief EDMA3 Test Application w) u* J6 L( R
- *
% f: a5 n1 ~$ n! x: ^7 b4 ?. M - * This file contains EDMA3 Test code.
- M/ k! `* }. |0 ` - *2 u% F4 a) o6 v8 X. A" m/ g: L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, i# d- m" \5 w3 h0 |9 u' L- @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. S0 x" N: I$ F% M% P
- * TO CHANGE.
/ R6 U* c5 ^5 `) G$ }2 o+ W - *8 q u9 M y4 V; ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! ~( q) y& f9 \- Q - *0 M# F* S' C6 X( l) x8 z
- * This program is free software; you can redistribute it and/or* Z- B9 o- R/ F2 m0 h, f! t
- * modify it under the terms of the GNU General Public License as
; N4 O% l5 |! l7 P) } - * published by the Free Software Foundation version 2.
/ _/ C! X, D0 F- Y4 I - *
# _( V% W3 R. b7 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 I- k/ ?) {2 k, b" B - * kind, whether express or implied; without even the implied warranty
5 g% A& _+ a9 l" t, {2 p7 }& y8 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ s3 B. c" Q. f/ I# d3 Q0 } - * GNU General Public License for more details., ]+ o2 z0 L& H
- */
: l) n+ h( e8 R+ C8 u" s
. v5 ?8 u2 G, B6 g0 e% `- #include <linux/module.h>
9 r# l+ ~4 i' q2 e# x - #include <linux/init.h>
) U' ?7 F2 i8 z2 R3 j2 j - #include <linux/errno.h>1 \$ \4 P% d$ M* g/ i& n
- #include <linux/types.h>1 \" x" G8 M. f) z! w( N, i0 |8 C
- #include <linux/interrupt.h>
5 ^/ z0 J( P" V - #include <asm/io.h># }5 ]0 S- j; t* m
- #include <linux/moduleparam.h>6 }0 {* M W }7 |2 z$ k* ~
- #include <linux/sysctl.h>
$ J" ~, Y* d% }! M1 [ - #include <linux/mm.h>9 N8 H. R# }" @
- #include <linux/dma-mapping.h>
( a5 u5 u3 V" p6 a2 t - ( {+ L3 X1 D+ y% ?
- #include <mach/memory.h>* \% c! a" Z; J- S5 F" \
- #include <mach/hardware.h>
! V# g1 }/ ^/ I8 U - #include <mach/irqs.h>2 F. L* l( P, ?4 o
- #include <asm/hardware/edma.h>
5 T& ?/ l" h( ?' ?
7 }8 z( y) q* w3 |& [# H- #undef EDMA3_DEBUG# e2 b' ]3 @6 B. Z. P; \
- /*#define EDMA3_DEBUG*/6 Y' H' e, p- O! S2 T
/ A9 a6 U1 R0 o$ t9 f- #ifdef EDMA3_DEBUG! _) n1 n4 j, r# K9 c. l& I3 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 h4 r( N+ u1 \. C( \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( X* r; ?8 x3 B9 Z5 |3 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; s0 e+ j# }$ s8 J$ O3 p3 s - #else- a+ N" V) e' E! d h1 e
- #define DMA_PRINTK( x... )) ?8 M" T/ g& X! P- s9 z9 {! n
- #define DMA_FN_IN
: c1 c; V/ L0 i% h - #define DMA_FN_OUT, v' N9 }- v$ `, g# m& c
- #endif
6 x) c1 D, ~+ y - / V; L: _' a! M" p' i: R8 c4 j# x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- C N0 A# X4 H/ e ^8 L. ~ - #define STATIC_SHIFT 3
2 j" ]3 x, ^- ?# E* d! [ p2 [ - #define TCINTEN_SHIFT 20/ B: a3 w+ B$ V. t$ P' B
- #define ITCINTEN_SHIFT 21
0 P4 X; E) C% ^" u - #define TCCHEN_SHIFT 22
( Q% m! n; X' Z - #define ITCCHEN_SHIFT 23) f' k d4 j) e3 B7 t
- 3 U- a) t, Y" y+ _3 |* h1 Q
- static volatile int irqraised1 = 0;) n6 ~8 l; F* P* _- ~% h
- static volatile int irqraised2 = 0;
6 d3 `. S2 K+ h4 n3 w6 D - ( O- |; O$ l5 G9 e b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I3 O& y5 z$ Z" |& P- t; @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]& J1 k1 `$ ?3 e. x0 ], {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X9 c# x1 V- o2 F! U
# \2 K) W5 W! W& k. |9 H( e- dma_addr_t dmaphyssrc1 = 0;/ A# f9 D# g, ] ~" R# R; H
- dma_addr_t dmaphyssrc2 = 0;1 P" r B9 A6 ^- e
- dma_addr_t dmaphysdest1 = 0;
" ^2 \0 D0 Y2 u( S4 m% } - dma_addr_t dmaphysdest2 = 0;; ^/ Y. g' w+ r$ |$ {& u" [; {( h
- - ?/ N# p q9 h& ~8 T9 V
- char *dmabufsrc1 = NULL;
9 l5 ^# k# d! ~ { - char *dmabufsrc2 = NULL;
. O; C. i' h; \" D/ b, b - char *dmabufdest1 = NULL;
; D! ^: P7 g N4 c" A. X7 P - char *dmabufdest2 = NULL;. z, n; u( ~1 C- t' i
- / W! A( C' _6 q/ j
- static int acnt = 512;5 _* v/ e8 n, W
- static int bcnt = 8;
: e9 l# e# \& C/ ]8 g - static int ccnt = 8; I ~# _. N1 z2 L& H* h3 s9 l
- 2 [$ B& R2 E/ U6 O0 f% j* m
- module_param(acnt, int, S_IRUGO);
; K+ k7 ~8 z2 i) E1 m2 n0 \ - module_param(bcnt, int, S_IRUGO);
2 w4 k8 @4 | X! d - module_param(ccnt, int, S_IRUGO);
复制代码 . t2 {4 ]: k6 @) ~
' W; ?* p1 ?: N2 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
C# c! y9 s* uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 o4 }9 i9 Q1 d1 G/ o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 d7 t# d& ]8 j3 W- S3 j3 _, k
4 e1 }* Y' L3 ~$ T+ C6 V
' ^/ J, A5 r6 T8 A6 J5 l |
|