|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 H' G9 w' Y! L) x e. {" w; Y8 Q
- [code]EDMA sample test application
% l3 @4 q5 J, P4 U; w' f - /*
) ^5 D* T9 ~. }+ T) o) u - * edma_test.c5 s1 e* ~; C0 Z9 x2 y
- *( U1 l" G: d' v* K
- * brief EDMA3 Test Application
- J0 J8 m4 I- b- q9 T3 o$ t2 h - *; s! g u1 V$ b& z5 V+ D) L
- * This file contains EDMA3 Test code.# d& P% c+ ]5 a" ?* }* E O) Q
- *& n- M+ |$ o9 |" i6 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ L S6 Q7 m w' x- d8 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) p+ s: I5 g7 ] C- a
- * TO CHANGE.+ h0 @ ?" {5 A
- *9 X( g$ [4 [" W7 Z/ ?& W2 j+ U0 ]+ i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 B/ ?1 H; b" x& h9 P) h
- *
0 N7 ^8 n$ I g* P - * This program is free software; you can redistribute it and/or* U: b* Y# e q4 X8 t
- * modify it under the terms of the GNU General Public License as2 `4 w* C2 t6 }, c
- * published by the Free Software Foundation version 2.
8 S6 y' Y% J- D9 L - *
) Y0 v/ ^9 C3 k" Q u0 P0 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 O. n2 j# u0 N; m, J - * kind, whether express or implied; without even the implied warranty1 o/ H5 c9 v1 |& o. b4 r1 v1 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( Q" E0 z! v! R! V0 U
- * GNU General Public License for more details.% s& J( _" t% e5 `0 T
- */* A; u. i( w! V! [7 F/ y
8 c+ H% H. L, k- X* C* L) c- #include <linux/module.h>2 O9 h: p5 n" ~3 G) a
- #include <linux/init.h>$ w# g; U$ U L3 m+ ]* ?
- #include <linux/errno.h>0 R2 E1 N9 t" Q# h* k2 T
- #include <linux/types.h>
; L% L# ^9 A+ f9 x+ w) e3 w - #include <linux/interrupt.h> S* F4 O+ {" c4 H9 x
- #include <asm/io.h>
0 ^9 x. w# O h8 |& p - #include <linux/moduleparam.h>; j% {5 O, l" h8 b+ h% R& C
- #include <linux/sysctl.h>- Y" y3 X& M/ T" ?
- #include <linux/mm.h>
4 |0 |& \# z# W, `7 _5 O - #include <linux/dma-mapping.h>
0 T9 y6 Q+ z; {+ u, s( l# C - $ _8 K) b& s! S& e
- #include <mach/memory.h>
$ _( S+ b7 M+ `7 p) U - #include <mach/hardware.h>8 K7 q7 D5 M% ?# u
- #include <mach/irqs.h>3 w$ I& c5 ~% ^6 m! D
- #include <asm/hardware/edma.h>
! Q6 U5 n6 r7 ~" b3 f. S3 `- E: \; ^( w3 i
. H7 `7 ~+ T7 M* e, C6 n- #undef EDMA3_DEBUG' U* _% ~# Q/ n6 G# _# v
- /*#define EDMA3_DEBUG*/
3 F0 e* t- s: P# v, I+ ` - ; y' u" [0 }7 q- q: C
- #ifdef EDMA3_DEBUG
6 c9 |: M, i; H9 r; Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ I' ^/ T9 H/ Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 M! _7 \2 Q3 j) F% c' `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 A( B! q% \; E" @: E4 w
- #else
) ^8 `+ F1 l2 \" P$ U& s1 a6 i" C# h - #define DMA_PRINTK( x... )
# ]/ t* M3 M" l J: F - #define DMA_FN_IN# K+ o/ f# Z+ ~
- #define DMA_FN_OUT
7 [3 t# _( ]- v% n - #endif/ y7 N0 D2 T* |
- " ~4 b1 F6 }- f* `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): _3 x8 Y1 K/ I% Q) P {5 l
- #define STATIC_SHIFT 3
/ m8 Q' G- e( P8 K7 V- ] - #define TCINTEN_SHIFT 20
" j' P9 A6 l9 v8 J- H, }( P$ ` - #define ITCINTEN_SHIFT 219 i' q/ l1 E# W$ r
- #define TCCHEN_SHIFT 22
7 d% i0 f6 H# ]0 M% ^ - #define ITCCHEN_SHIFT 23
1 {8 h2 j f8 H6 w5 D& H9 w) N
% z6 ~* H5 ~* @% y7 a! f- static volatile int irqraised1 = 0;- e7 d& {. M0 q9 _
- static volatile int irqraised2 = 0;* I6 Q4 z; K3 K1 _8 n- J4 I
7 M3 z8 C6 k+ c4 @% @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G+ K+ g% P7 h3 d! O8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @- W1 C; l( N* @ n, y+ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 j2 Z( [6 A! Q% ]+ e - " l" w p' z6 I
- dma_addr_t dmaphyssrc1 = 0;
' I, F6 @- @9 j( ]" ^ F9 M L! u* V- w - dma_addr_t dmaphyssrc2 = 0;! ?2 H6 x+ p1 V! |* ?
- dma_addr_t dmaphysdest1 = 0;
5 ^* ^8 ?) C9 g8 {2 l# Q; B* ? - dma_addr_t dmaphysdest2 = 0;
* Z. F; x! q& b" o0 B$ }# l - 1 O7 L% d; k% l4 K( l4 ^
- char *dmabufsrc1 = NULL;
' E$ K3 {, l' k" y - char *dmabufsrc2 = NULL;
, }4 V1 z. _# e9 C1 ^3 P+ V3 j' | - char *dmabufdest1 = NULL;/ ^! o6 i( J* _
- char *dmabufdest2 = NULL;
/ y% V2 q5 R' p+ u8 q - ! G2 c* l( x3 |+ C; ^8 Z
- static int acnt = 512;
/ j( U! m7 E3 l% C& Z" U - static int bcnt = 8; k: V+ N1 `1 W5 A5 d C) S& v
- static int ccnt = 8;
7 |! B9 m. J& c, s, P4 v- e - 1 S7 \0 o% Z4 a6 t" ^+ }4 t' W k
- module_param(acnt, int, S_IRUGO);
+ i) j9 }* D7 u) j3 Q* M4 m/ Z+ o) L - module_param(bcnt, int, S_IRUGO);/ `& {7 J! N5 K
- module_param(ccnt, int, S_IRUGO);
复制代码
( @/ |" o0 z! _. s+ J1 I0 \- b
( C! b5 A7 t- X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' @& A& Z" d: M- karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" D1 f1 ~/ d& y( P, i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, P& h% a @7 J5 H
6 g( @! N: e H$ _; F ?3 m9 ^# i6 [, k1 p
|
|