|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N7 v- k( u4 j# a' [5 N( }+ D% X7 M- [code]EDMA sample test application2 e4 |9 G8 A* L$ D. N+ @
- /*( Q3 \3 G4 z) _7 Z6 [" f
- * edma_test.c
% w) ^7 }/ h5 y4 @) p( ]! V - *8 u# C6 i, N9 J4 k9 @) |: s- [( s
- * brief EDMA3 Test Application
\- k9 L+ W+ N$ ]: S - *
1 r2 l8 y# E; D7 E3 B# E( h6 y; i - * This file contains EDMA3 Test code." j' O! y( s0 ]" W3 e5 o
- *
1 D( P w4 }* h/ }: o# R% B& q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% [0 _1 [% D; v' e1 g" K5 J r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v1 [$ F- h- l k
- * TO CHANGE.
. }6 q$ `+ c6 {7 m: @ - *
. V& ~$ s% G" H2 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 g' O; z: N# ^1 f
- *
1 D7 s6 J. n& W% F+ b7 V - * This program is free software; you can redistribute it and/or
+ A, U6 j0 R1 s' E" L - * modify it under the terms of the GNU General Public License as
$ B0 p/ u# A( v) e - * published by the Free Software Foundation version 2.
1 h/ ~. C6 G0 f1 m# V) D - *
z1 H7 z4 V1 t3 i9 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, W0 q4 }6 b$ J: Q2 w& l - * kind, whether express or implied; without even the implied warranty
) `8 z9 q) c- H4 A3 W9 |) r; x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
O3 q- |4 r% O& r' e r+ S - * GNU General Public License for more details.8 j R/ h- E2 p6 N; |/ v6 @
- */
' P, h9 p: |( h3 C0 Z- C - ) `: Z$ f7 R- R. u3 n+ A' g# w
- #include <linux/module.h>9 F T$ E/ z( |! N2 p
- #include <linux/init.h>. f% R$ ~. X# h. \2 u1 [+ q& N
- #include <linux/errno.h>/ v$ T* r% g1 V6 B& c
- #include <linux/types.h>
5 H; s1 `. W) e& [# V - #include <linux/interrupt.h>5 T7 E/ q" c3 ^+ @$ A! W
- #include <asm/io.h>: B7 @5 T: T3 F; P. @
- #include <linux/moduleparam.h>
6 ]. h) T) R. `' D) V5 p$ T9 A) T+ z - #include <linux/sysctl.h>3 b1 c. a, T5 { o# z
- #include <linux/mm.h>* K: c4 t- C( h, q0 K
- #include <linux/dma-mapping.h>6 f1 r. p c) l {1 T9 T g* R- a
- 0 y) f. j8 i9 G, T, a
- #include <mach/memory.h>& Y! c2 w( {3 g
- #include <mach/hardware.h>
$ m d5 S/ \' n/ |5 Z - #include <mach/irqs.h>4 S. W% h0 R- A- |$ j( c2 p2 L
- #include <asm/hardware/edma.h># w! V& r$ X4 P2 c1 n. j
# T8 m0 g8 D9 h4 K- #undef EDMA3_DEBUG' j, q# X4 W" L4 ]1 i3 Z
- /*#define EDMA3_DEBUG*/' V& {; ]* ?) Q% Z9 c, D4 i
9 t) K% M2 l7 d- #ifdef EDMA3_DEBUG) |* c( s' k$ ~4 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c) O" t! e- U( o- Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ _* U6 ?# c0 N- l; p6 E) }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y+ a n% j9 q( n. U6 v+ L u6 H
- #else* A% N8 b3 ]: {, A- o5 c; v! B
- #define DMA_PRINTK( x... )
`3 u0 X' q8 G6 ]6 l; H+ K+ {# u - #define DMA_FN_IN" e7 \$ n9 L9 s8 f
- #define DMA_FN_OUT
# u0 y8 q" l# s& |4 w - #endif
$ k$ d, P; ~6 q" U, y - % h, _! e$ }$ `3 f$ W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" y0 W7 B" e" O2 K- A5 ^ A7 \. d - #define STATIC_SHIFT 36 W+ j) w3 Z5 F$ c; t/ b: B
- #define TCINTEN_SHIFT 20# O8 U# ~$ |, S$ r! m, c
- #define ITCINTEN_SHIFT 21
+ E" i5 j3 V/ K f2 p q0 U - #define TCCHEN_SHIFT 22
. O6 n2 T% g# S* e- O0 d) U - #define ITCCHEN_SHIFT 23
6 E2 G( Z7 R: E4 r# t+ G
8 s. @0 V0 g( x" i( {- static volatile int irqraised1 = 0;
; u$ `# m! m# X - static volatile int irqraised2 = 0;) h3 L/ _5 b+ r- J1 {7 \
# Y0 b1 Y& H. O* U1 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% B' F7 V8 c v# y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, X) \! R! M8 w, W6 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. u1 ^) W& p9 ?3 i - 4 D* `: `% T9 {: i, _
- dma_addr_t dmaphyssrc1 = 0;% ^0 j5 ~) l+ h( R
- dma_addr_t dmaphyssrc2 = 0;
# ?! d& ]* u: _ - dma_addr_t dmaphysdest1 = 0;" K- o; g; O1 P$ b0 i; c5 K
- dma_addr_t dmaphysdest2 = 0;$ Z0 k+ V7 G% P9 [, {( q$ [ b9 J
8 G. x- `- }* k& ~: x- char *dmabufsrc1 = NULL;5 f4 P2 C& p) M
- char *dmabufsrc2 = NULL;" n2 h" m2 B/ S
- char *dmabufdest1 = NULL;
- q( p. i( _9 Y/ p. b* U/ T6 N5 g6 { - char *dmabufdest2 = NULL;4 Z* v# K4 P) O0 `1 }
- ; W/ n$ L4 }9 O& h% z& u' p$ q, m
- static int acnt = 512;- V, l/ i+ V9 D& b# F( Y V
- static int bcnt = 8;
, k- h9 H0 e. L7 M% i# A# o# h- k4 b - static int ccnt = 8;
, \( ]( e( `9 A - ! @! q; U; i6 b# q+ G! q0 _& S- c$ X
- module_param(acnt, int, S_IRUGO);
7 P3 @5 ~, e6 Q6 ^ - module_param(bcnt, int, S_IRUGO);* f% `+ _5 s5 j, x: `! i
- module_param(ccnt, int, S_IRUGO);
复制代码
4 ]& N+ ^$ u J4 [0 X* D/ {5 B. a) m- J) j2 y; }& J2 ~- @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ L0 Z( [! t9 V8 R! j' j7 p5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 d1 R4 y( b% V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 c; n2 Q; L" n" d
, z" R) i/ M' }9 ^9 N& Z' I
' p0 z8 t# G Z# c |
|