|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ U/ I4 B: C N; o+ n- [code]EDMA sample test application
/ {$ S$ [5 \7 \! F' N - /*2 A" E- p6 c( S M0 b& W
- * edma_test.c' l2 e( B& N5 W
- *
3 x- A( Q, J0 |" G" @ - * brief EDMA3 Test Application5 W- f0 _/ g: h' S0 |6 B
- *0 T$ B7 z3 u3 @! ]6 I$ v2 ^+ ?
- * This file contains EDMA3 Test code.
, O; O5 V0 g; d9 t3 K) G; ^% H& G4 Z - *9 P, d1 f4 B6 L# c% J' D" Z% q/ u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 {* P) Y( n2 I* w. m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P0 M& |: F! q+ B3 a
- * TO CHANGE.& y Z7 I0 j9 i" U: v( ~
- *
& n" `8 I2 U* a0 O" t- t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Z9 e. ^9 ^9 D/ R
- *4 H7 F" j$ a6 V3 |/ _, V$ @& b9 a
- * This program is free software; you can redistribute it and/or2 Q: ~5 |4 K0 e/ V9 h* z* T6 a
- * modify it under the terms of the GNU General Public License as& c9 i4 L9 O4 H+ g" }/ S9 R: n8 t
- * published by the Free Software Foundation version 2.& @' E1 F# c; Q' p# I
- *6 {: G9 p N% f3 m$ R# W( }9 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 B+ U+ a( [$ X/ [2 o4 _$ D, i* n8 ^4 ~ - * kind, whether express or implied; without even the implied warranty
" e3 _" I/ H* r$ N: S( M% x- i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- \1 U; x9 |/ Z! {" V+ Z3 D - * GNU General Public License for more details.
- K: m1 ]3 _. X" k. B - */0 ]6 z1 |' A, K
7 j/ E# `5 \ t6 a, h( t- #include <linux/module.h>1 ~8 ]8 T1 m4 X* V+ l
- #include <linux/init.h>! V, x( G+ x; O) q, W. K
- #include <linux/errno.h>
9 \) s8 o" u; Z. x/ s - #include <linux/types.h>- Q' _+ t+ }. P/ v; ]% T- f/ O
- #include <linux/interrupt.h>
7 m3 w3 @* B2 t# E( `0 C5 F" ` - #include <asm/io.h>& S9 ]9 @ l5 A, J6 i
- #include <linux/moduleparam.h>
9 K8 j1 t' [/ j! t5 `) R - #include <linux/sysctl.h>1 P4 y" U' E6 { Z" K6 H1 G/ j" R3 e
- #include <linux/mm.h>) @2 p- ~" {5 g0 E0 P
- #include <linux/dma-mapping.h>
$ ] `- h& w6 ^; M - + p$ ?" z+ z& d1 W. h# k- Q
- #include <mach/memory.h>; R/ s, ]; H4 b1 s0 r1 J
- #include <mach/hardware.h>
3 }/ C/ U, u9 P5 m+ O) V - #include <mach/irqs.h>
u- n% P$ n B$ T - #include <asm/hardware/edma.h>$ b( T; j* P4 W# D0 i
- 5 ]& w6 {% G L ]
- #undef EDMA3_DEBUG' D5 i# C) h; \7 h9 V4 X
- /*#define EDMA3_DEBUG*/
2 r! h( F7 h \/ |/ B
% i, f. @2 V! K: D1 X7 L- #ifdef EDMA3_DEBUG- T: Y' F& n! c2 L9 r c& E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# p# o j) u1 f; Y, v$ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 ]( ]1 I" k+ ?% Y9 D! M! B5 a/ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ]* f; s( V8 e J6 q: X8 w, E/ H - #else( i3 O# m- q' X
- #define DMA_PRINTK( x... )- b. l* w' b0 q2 |* [
- #define DMA_FN_IN
. J( ]$ R3 x% ] - #define DMA_FN_OUT+ ]3 w! V7 Y# E5 F) r
- #endif# o5 q8 e! M2 h" R, }1 U
1 s2 o; L( m B8 M& a0 i) v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 `$ Z. _' E2 u5 Y
- #define STATIC_SHIFT 3, Y5 m" ?) k' S9 J& U& k: k' t! @
- #define TCINTEN_SHIFT 20" p' m: c6 L7 e: O
- #define ITCINTEN_SHIFT 21( |: k# t O8 b& x% ^5 B( f
- #define TCCHEN_SHIFT 22' U y1 B1 O' q0 C8 t$ _4 x
- #define ITCCHEN_SHIFT 23% S p5 Y' {+ v0 w
5 l: l! ]6 m' R4 R% g2 W6 n1 F- static volatile int irqraised1 = 0;9 W. w5 N0 O9 y. g: X) B" h6 E+ _
- static volatile int irqraised2 = 0;! k7 ]# C+ Z* I* q2 `0 C) p
8 E" k2 L r/ u) B5 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ~) ~$ _& G! ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ]- {& h$ S8 }2 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); U6 @- ^- ]) G
- 5 q; Y1 D( x5 G+ p
- dma_addr_t dmaphyssrc1 = 0;$ z4 a1 t6 @3 d! {
- dma_addr_t dmaphyssrc2 = 0; S( {3 O7 z; O- Z
- dma_addr_t dmaphysdest1 = 0;, ~$ p S" }# i t) j* Q3 W$ R
- dma_addr_t dmaphysdest2 = 0;
: G. {* e4 i% [6 \ S! l - % e- h8 D& S- d6 l s
- char *dmabufsrc1 = NULL;5 i+ c3 }, j) f- o
- char *dmabufsrc2 = NULL;
0 H. R! _7 `+ W1 u - char *dmabufdest1 = NULL;* `, o. |$ B3 H( M/ }& @
- char *dmabufdest2 = NULL;2 s. b3 D, m& ? y
9 c9 N7 q$ \9 w% V- static int acnt = 512;" T5 S6 ?$ f X
- static int bcnt = 8;
- g$ T4 R6 F4 ]8 y8 w - static int ccnt = 8;9 z; T6 O- n a- z
- + s7 e J- ?4 C; r2 B/ M6 _# ~
- module_param(acnt, int, S_IRUGO);& ^7 D: @1 x" U9 T5 d
- module_param(bcnt, int, S_IRUGO);
. f5 `! g, U1 s, j# U0 O6 I. r5 B - module_param(ccnt, int, S_IRUGO);
复制代码
' f& w2 M' t l' ]* n/ G6 ?/ X( Z: J4 X7 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Y* O4 |4 Q3 ~$ n8 \! T& A6 `0 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 r. R' R$ n4 `4 B9 M! k( Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e9 {% w: V5 q- w# e+ D, a
- |( y' P0 P# p1 o8 J6 i, W' l. y
5 y1 f# n! q% ^* X7 Q) `
|
|