|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ~* h* w1 I: d. I m* g- [code]EDMA sample test application. q2 o# y& V3 i* i6 P
- /*% x, A4 d! }0 H- L1 y( A1 o
- * edma_test.c b2 M( v+ S* l" H
- */ P+ F9 n E Y* A3 O
- * brief EDMA3 Test Application
N5 }' _. W/ n% c0 z - *1 {3 j/ O& M0 W3 q8 V( O' f
- * This file contains EDMA3 Test code.' x8 } \7 x4 S% S
- *6 v6 `, ?4 {/ @* x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 F/ \: G2 x3 Z2 r2 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- q2 u- n* t \+ o0 w: d7 `
- * TO CHANGE.4 [3 q# o3 a4 C- Z' i( D
- *
9 W& \' b# \! _$ F E0 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% @6 F/ I5 [2 i- k - *
, ~) E- C8 Y7 E, F3 j' E - * This program is free software; you can redistribute it and/or
8 k: T6 N4 F7 v+ f6 O - * modify it under the terms of the GNU General Public License as
7 ?8 n- T/ G! o4 h) w* t - * published by the Free Software Foundation version 2.
) S' g6 H- M( e3 A1 n N - * B R( w/ a" o E& Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. D. N/ ~# |; Q4 C2 i3 V# l
- * kind, whether express or implied; without even the implied warranty9 }+ H, Y: u6 l2 _$ @) A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 Z# ^5 ^% D/ s' c - * GNU General Public License for more details.
: V; u: R' f5 p - */
4 |& X4 P, }6 G& \. b, i6 X - ) t, |. r* B ]6 S: R4 J
- #include <linux/module.h>2 J, x8 c$ B1 ~$ ~6 \
- #include <linux/init.h>+ g' z; ^0 B+ U* \/ |
- #include <linux/errno.h>7 c3 @1 g8 c& \+ e7 u a/ W( L
- #include <linux/types.h>, o& r o5 Y) A0 h
- #include <linux/interrupt.h>
2 u F2 r; W) ^ - #include <asm/io.h>2 e7 Q2 g$ H( ~8 N) S4 s
- #include <linux/moduleparam.h>
& G$ S Y: x) L4 u5 J3 d4 _$ \ - #include <linux/sysctl.h>
7 v7 Z, c0 L/ J+ z9 t$ V' F - #include <linux/mm.h> S- A+ p$ R) s! `7 T
- #include <linux/dma-mapping.h>
3 w, b' |7 P- X/ W, N9 l0 f! J6 Q
- Q- F( o% p) L$ n) I- #include <mach/memory.h>5 ~, H+ k* f. p
- #include <mach/hardware.h>& E+ X, Z# f r# W1 L4 g/ k8 a% E+ P! y
- #include <mach/irqs.h>& x. S& T" ]$ _% h
- #include <asm/hardware/edma.h>2 m( Z) \. L: X" H# Z& B
& D }+ H: v( _8 D9 u3 j! x- #undef EDMA3_DEBUG. E* L9 w; P' N# d K
- /*#define EDMA3_DEBUG*/
% d! O( _0 l% G+ ]8 s5 h& d - - ]* Z3 ]$ I. l2 O
- #ifdef EDMA3_DEBUG$ s/ Y) ?% G. p8 v7 w, I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 n0 k4 K; b8 Q- X+ J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* k7 @+ y4 E3 K( h2 P! O, o& F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ B* U0 \8 H: W# p- _: E. R3 m N- A
- #else
" u3 |" |& V1 }" p( e - #define DMA_PRINTK( x... )
( l1 d% X( [! [1 [, N* d9 e - #define DMA_FN_IN( P) I" c, ^! V, Q# u( e4 U1 z
- #define DMA_FN_OUT0 X+ e' `, D; V. S( f$ M% @* w2 w9 R$ j
- #endif
/ H1 h/ q a/ U& f5 d; C0 A0 ] - 8 x7 h: v7 f$ X' Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 w$ w" ~7 W+ _; @. j6 x1 g
- #define STATIC_SHIFT 37 D4 z8 } L4 }3 j& v @ U
- #define TCINTEN_SHIFT 20
3 M8 S Y% K% X# j- e. F# w% {5 k7 K1 Z - #define ITCINTEN_SHIFT 21/ ?( x# ^, ~1 d; c
- #define TCCHEN_SHIFT 22
6 U: d O. t. C! w: Z( J, S; o - #define ITCCHEN_SHIFT 23
' F2 y% L& ^% g' S) j7 g" d
' E/ g" {" Q& g- static volatile int irqraised1 = 0;' t+ p5 N! [8 l0 ?7 R
- static volatile int irqraised2 = 0;
5 c! H5 |1 Q, j( {
7 w6 f, F! i$ a) O0 [# q0 |$ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P% X* B& y4 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 O# k- T1 i2 D& [1 E5 f) ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* g0 P+ i! B! O. M# m- r. ]2 T0 c - ( b4 q3 d! N$ Q/ N3 f
- dma_addr_t dmaphyssrc1 = 0;9 F% `; w0 U) r* g- J: l
- dma_addr_t dmaphyssrc2 = 0;
( w) Z1 ?) d8 E6 _& r% b - dma_addr_t dmaphysdest1 = 0;
" q1 A5 O9 Y( |9 e- y - dma_addr_t dmaphysdest2 = 0;6 Z7 _% m! I* ~ K2 e" M
! c6 `% B" y: p! ?" k1 s/ G- char *dmabufsrc1 = NULL;- S$ V+ w- {: H& j& v a$ K
- char *dmabufsrc2 = NULL;
! R$ b- c0 U" `* m - char *dmabufdest1 = NULL;
! F! I* I% N% @6 a - char *dmabufdest2 = NULL;
9 a3 r; \& F8 y( C; M
$ o- i% u0 m0 K9 w- H- static int acnt = 512;
; p, g( m9 h3 o9 O, S8 K - static int bcnt = 8;$ g* a+ `0 m. H& d
- static int ccnt = 8;
" Q6 i, Z( O8 Y V5 @& m - ) Q6 Y- ~ v; [0 r( b' j& F. v
- module_param(acnt, int, S_IRUGO);
" Z1 L L2 W* }# r( a$ P+ q - module_param(bcnt, int, S_IRUGO);% X% T1 |+ e* h% l
- module_param(ccnt, int, S_IRUGO);
复制代码
e; i- b. [) d; S. w6 T2 T. U" Q& ]7 z; S/ c3 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# A6 j: }* O d/ M2 X$ h6 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Y( E( M! N: s/ _1 R; a3 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 i3 I4 H) g% c2 h, b' p
: G/ v9 h0 @* W' v7 O. P
( H/ U/ f1 M" R* N2 d |
|