|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 z u* ^8 W8 [8 c
- [code]EDMA sample test application- r+ X) b" U" J5 x u
- /*& b- A9 d. v$ p+ u9 g8 C
- * edma_test.c
# g7 v. n* ^" m6 ~ - *
# ? u4 H) Q, F. [, q- p - * brief EDMA3 Test Application
, p0 T/ @/ J+ x$ E - *0 P5 z5 Y* d) Z+ Y$ L
- * This file contains EDMA3 Test code.' h( { }1 X! D' M4 p
- *+ h& Z- a+ X* ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 C" H- g5 K9 R( m% K- ~ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. f, E! i9 g+ u) g; c
- * TO CHANGE.
' Y3 @) J! l6 Q0 ~$ [( [) D - *
6 ]/ K: G6 n7 u5 k: r; W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ~+ `3 w8 ^9 e+ ]: Y - *4 M3 E. g- W. Y! ~% w6 r* G# A; _
- * This program is free software; you can redistribute it and/or
9 V9 p( h2 ` J - * modify it under the terms of the GNU General Public License as1 D8 e9 @- f/ W7 F
- * published by the Free Software Foundation version 2.
7 N" E" H y! D, e2 h - *4 H% `; W) h+ w; p1 l9 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 \5 s9 P$ s6 {9 ?, n" x: F
- * kind, whether express or implied; without even the implied warranty
/ T \7 r2 i! S- Q+ N/ D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 c! a. x" p# B) O9 P% z* p8 i - * GNU General Public License for more details.; ]" c3 s% H- x
- */
+ I% o' H( Y9 M - + k! L6 r+ M4 E3 n- N" a# j
- #include <linux/module.h>3 O+ W2 X+ v( A/ C- o8 M8 l' @8 i
- #include <linux/init.h>
% y, M$ y5 P7 E' n0 i/ k1 R - #include <linux/errno.h>+ d; X5 \' @0 }) T1 O) P7 b' o
- #include <linux/types.h>! ~6 Y9 n5 {3 l0 @
- #include <linux/interrupt.h>, o8 E, B7 {" m1 e$ L* V0 ^
- #include <asm/io.h>& f) Y& f" y0 }# }9 _
- #include <linux/moduleparam.h>
! R* x* Y# S, X - #include <linux/sysctl.h>
* A% ?" e K8 v' Y3 S - #include <linux/mm.h>
: a2 B: ~9 I/ w. I) W - #include <linux/dma-mapping.h>
* B: N$ h+ o3 y8 y% I% t6 B4 `" U - 1 Q- r. ?, p6 O/ y! [" a+ p
- #include <mach/memory.h>
% A, ?& c( ]. j+ v+ `; W - #include <mach/hardware.h>
! _; O6 L* g/ [; O3 J- y5 { - #include <mach/irqs.h>$ l% {* Q6 I0 ?$ t2 k
- #include <asm/hardware/edma.h>
" q! n3 e* i4 U c( } - ! s3 t3 Q3 Q9 R" t: g1 K
- #undef EDMA3_DEBUG
- M4 L1 [7 h. |; T4 t- e) | - /*#define EDMA3_DEBUG*/
* p; n4 k3 ` J
e: O# \; U4 C# H8 [! `( s- #ifdef EDMA3_DEBUG2 [" L* ]4 z" H1 Z! r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ E# z0 K) x. B5 {. M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ j$ a$ O* ]! V: ]( o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ]2 \0 _) }' B2 e4 M$ }# l
- #else
1 _ L$ U# t- D& P8 \2 F# |9 e - #define DMA_PRINTK( x... )
: V6 V( Q2 O- a# B/ z: }7 A l - #define DMA_FN_IN$ B8 S h: {- G2 {, w R# K
- #define DMA_FN_OUT
6 t% A" Q# {& T4 g, j. E1 g - #endif
Q; x" _4 F! f2 Z% \ - : O0 ~8 }1 |- C+ C. T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 s6 c" S6 ~+ r# L5 \ - #define STATIC_SHIFT 3' S: H; l v; M p. e
- #define TCINTEN_SHIFT 20
( ], H) C& H) w2 X' a- B2 a$ l - #define ITCINTEN_SHIFT 21
/ T( G K# F# o, @% W7 Q - #define TCCHEN_SHIFT 22
6 x8 H: h& I0 A4 L - #define ITCCHEN_SHIFT 23" E8 F0 p o) W, o1 S# R" `0 C
- 1 K2 l4 g3 d+ G4 ]' h0 O
- static volatile int irqraised1 = 0;
* i- v, g. E1 Y; E, J, p6 Z# s - static volatile int irqraised2 = 0;! \- R' f# ^ h4 n5 x
- 3 q# o, i' u" }; R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 R7 J+ x) s0 ?5 d" v8 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v! {3 A6 _9 p, U/ E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Q* `6 r* d) i7 j
- - s; B8 o4 p8 U, B" K# L: ]
- dma_addr_t dmaphyssrc1 = 0; o' P' q+ `' o. U; U/ u
- dma_addr_t dmaphyssrc2 = 0;! I- I3 C% k( s$ v+ _1 \
- dma_addr_t dmaphysdest1 = 0;
1 `1 K9 C! X8 `( Q - dma_addr_t dmaphysdest2 = 0;0 N( e5 ?1 I7 B1 E$ Z
- $ L7 q. c* a3 f |7 ? z; w
- char *dmabufsrc1 = NULL;
- z% q/ a4 ~8 s7 j3 K/ c8 F; o, X \ - char *dmabufsrc2 = NULL;
1 O( M6 ~# B7 I1 Q - char *dmabufdest1 = NULL;2 E! y* x& A$ o% k+ R4 Q( X
- char *dmabufdest2 = NULL;
3 `* M, G( Y1 H4 H2 [! I - : v2 W4 R/ R2 K* H" s
- static int acnt = 512;. t( s3 H6 }1 D) J1 z2 |
- static int bcnt = 8;
7 w/ x3 h/ P; }; _0 V; Z - static int ccnt = 8;
9 h, @3 c0 A& h5 W. I2 @ - 0 R3 | k' V+ T* E- L4 t
- module_param(acnt, int, S_IRUGO);0 K/ P8 O: z$ \" C6 @4 [/ K
- module_param(bcnt, int, S_IRUGO);
5 q/ x. z% G% ~8 v) n! V - module_param(ccnt, int, S_IRUGO);
复制代码 2 d" J$ v' I7 n0 H/ k% k( t
! y+ G: H0 j& f" D: {' b, m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; K7 h( \) ?, ^/ j& l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* A; g( }# }* I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- a/ t3 V& |: W/ c1 m" C+ w8 i( P$ h( F
) d5 G" Y, N+ Q$ S2 i |
|