|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u/ z: s! T$ ?' ?2 e9 h- [code]EDMA sample test application: m3 c5 N& w* G7 j% x
- /* b9 j' D) g* s7 ^
- * edma_test.c
9 r/ w& p/ A6 ]' y: u, Y1 F. n - *
+ }4 f) z& ?/ E3 @1 R- h - * brief EDMA3 Test Application
8 x O' o9 W1 Q6 h - *
# J6 a/ R" V9 s. t - * This file contains EDMA3 Test code.8 u: O1 ]) s- T7 E$ E) u
- *. d1 b6 I+ ^7 M' |. T" n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 I! m+ |7 }0 x: _ U; L5 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 X$ {' J8 H* o. Q- y& D6 S, N: u - * TO CHANGE.
0 J$ g |) L. ]2 y2 n# y - *
5 N! M3 @ m7 C0 P/ S+ J# e# c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, V0 w, v8 S% T' Z - ** v1 J& d) h! w1 G+ E4 V2 X
- * This program is free software; you can redistribute it and/or& q1 Z2 e7 h8 \: k( b
- * modify it under the terms of the GNU General Public License as- {2 k u8 {& C& o
- * published by the Free Software Foundation version 2.
' S; R4 j/ P& F! x4 P - *
8 Q( K" o* `4 P/ S- c+ @' A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~9 c+ g+ c- H
- * kind, whether express or implied; without even the implied warranty7 S: s' G5 Z$ q1 n% v: L4 _: i2 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ u. B, S z7 y - * GNU General Public License for more details.; d' I( f6 C* P2 j% T
- */4 o$ \ @% v9 m) c
( l, x1 u: f* P1 y- #include <linux/module.h>, O3 _8 d/ d, r, y2 Y
- #include <linux/init.h>! V1 C* K) l: y. w2 B& ]: G
- #include <linux/errno.h>3 ~" ]/ O2 _. E/ F
- #include <linux/types.h>
1 h/ r5 u* |/ D+ a6 b - #include <linux/interrupt.h>
, R8 X4 n+ i9 U8 r - #include <asm/io.h>' o5 e, D4 w$ Y1 |6 k& r7 @
- #include <linux/moduleparam.h>* ^9 D5 K+ M: j8 E3 }; s: W
- #include <linux/sysctl.h>, ?# b% g# `& d+ g
- #include <linux/mm.h>, w# N6 \& m' q1 C1 l ~
- #include <linux/dma-mapping.h>
$ w: [( T% q1 R+ H [( r# I
" E- s% ^* b- Z- {6 T# O6 e- #include <mach/memory.h>$ J$ ~0 {' _. w+ L' |. a( M
- #include <mach/hardware.h>0 w" O+ {+ \) k' d: P4 S5 B' d
- #include <mach/irqs.h>. U+ K7 X. C6 b' y# r3 ~4 R' u' Y6 i
- #include <asm/hardware/edma.h>; {1 F' {+ Q7 @ x1 {" w8 Q% i
- * e# q) @% A2 g
- #undef EDMA3_DEBUG, a) W6 W+ T. W) X- S) }! J
- /*#define EDMA3_DEBUG*/
( \6 M9 M" g1 q. z M8 C - ' \4 e& M7 D3 r9 M1 L3 j
- #ifdef EDMA3_DEBUG
: ]) Y u ]( L: h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( g& l- \& H, ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( i. f( s E( U7 L0 H( k" Y) } h2 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: T$ ]* X9 z' H - #else
* Y% \: w- a3 g2 V* E0 n+ ~9 _3 n - #define DMA_PRINTK( x... )
* `" T' m5 T! S1 f - #define DMA_FN_IN, i: |" p2 ]7 [; s1 j
- #define DMA_FN_OUT
8 ?. |8 X& p6 u- A% F! d - #endif' E8 l+ ^6 d1 U1 s; B: R# n
6 k* J% A+ w) x m3 [9 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 y+ N% F) F5 M
- #define STATIC_SHIFT 3
- C$ } t: d3 t6 I- _ - #define TCINTEN_SHIFT 20
& I: R t% ]5 v& ^# Y, s( F - #define ITCINTEN_SHIFT 21
1 o, Y4 p( X& A x - #define TCCHEN_SHIFT 22% a/ `5 U" K0 |+ k4 e6 u
- #define ITCCHEN_SHIFT 232 B* M3 |' b) w# R9 d W7 t
- 0 s4 X& ` R; s
- static volatile int irqraised1 = 0;
7 ~6 ]5 W K- }% E3 m - static volatile int irqraised2 = 0;
' D7 y' @! B/ p; G1 [4 b
+ S$ J5 U3 U4 c& n% o( g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" b' C8 y( ]5 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( c- ?+ J' l! p3 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 T. `) U1 A& u/ x - - ]5 c$ r T4 E8 B. i, b2 H
- dma_addr_t dmaphyssrc1 = 0;
3 b5 P6 I9 U& O7 b2 t2 T - dma_addr_t dmaphyssrc2 = 0;
) k& T9 g2 Z) t7 b - dma_addr_t dmaphysdest1 = 0;, y* I+ L+ V$ y7 |# N- w* [0 Q$ S
- dma_addr_t dmaphysdest2 = 0;! R y3 F7 o6 V% K! a( y
- + X% f# J# d+ |2 d0 M8 @3 T
- char *dmabufsrc1 = NULL;: Y- d: i L/ c4 Y: i1 H
- char *dmabufsrc2 = NULL;
8 U1 @" j/ l+ ]; ~3 g( x - char *dmabufdest1 = NULL;
6 E9 \& H" ~) I& [: C5 v. ~ - char *dmabufdest2 = NULL;
5 z9 y* c% e% p( u; B
" J9 I6 \ x0 f4 w- static int acnt = 512;# m4 a; q% M9 Z
- static int bcnt = 8;4 C3 P! R% \2 ?0 |% r, Y, J
- static int ccnt = 8;
8 k; R) S M) W" t
+ S; [% f' B2 ]5 L- module_param(acnt, int, S_IRUGO);. F" A# v7 F( {, J) \
- module_param(bcnt, int, S_IRUGO);$ Y3 e W& P. p* I
- module_param(ccnt, int, S_IRUGO);
复制代码 3 J% Y/ ]4 U8 p& G- h" V Z* E# u' ~
/ e; ]7 L+ d" ~7 q0 c" t, [6 _% S+ b2 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
G& l8 |" Z3 a* B2 C' ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
U- O. i; l- {9 `& e7 J& z0 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q1 w# r9 F& O0 C. V
5 W# J2 M0 N5 L; Y. L* |7 b
$ r: V( A' n, O7 e2 g
|
|