|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , {' G3 F' S' b. x
- [code]EDMA sample test application* @3 B! h$ v" M: V+ D: K+ x9 Q- q" ?- N
- /*2 o) z9 C4 s. J/ }, i: l
- * edma_test.c
2 P) J( |4 N% u; n! D - *
1 B. a/ e& X! w2 X r0 @6 q - * brief EDMA3 Test Application# V' p8 C. m$ W! T
- *7 \' A M; e" S9 @! [
- * This file contains EDMA3 Test code.5 C0 U& u* o8 A: p# J) p# t
- *- V4 a9 i/ U; G+ D) H% k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G. N8 ~' j) T1 ~, f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# m C7 r7 i ~2 ]& t3 F+ W
- * TO CHANGE.
% x! c8 u0 X; Q8 _3 N - *2 K8 B* n2 V* Y( m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ L. X& ?7 @8 q
- *
& q m4 _- y# c/ v" @9 V - * This program is free software; you can redistribute it and/or2 @, `' |& ?$ ]* Q7 ~
- * modify it under the terms of the GNU General Public License as
6 v4 Y$ a' Q5 e6 o5 k - * published by the Free Software Foundation version 2.! ~% y+ w g+ Y: x
- *0 [- C- v" q( F& D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 j* W1 p4 `* I# S% K - * kind, whether express or implied; without even the implied warranty- H1 D: V7 }, f/ y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) _+ @7 y; }) u0 W$ K% H - * GNU General Public License for more details.) L4 |1 P0 }% u4 v5 Q, `# R
- */
$ M$ n8 n" h2 P5 r - O# j1 v$ \0 D5 h Q
- #include <linux/module.h>
5 ^& S4 M* w0 N. o7 j" b - #include <linux/init.h>
' ~1 f( j/ x) g7 l3 ] - #include <linux/errno.h>( x" I4 E& K7 p% v8 Y$ M9 l; Y
- #include <linux/types.h>
9 _9 w* z4 N* ]. G5 x1 o, x - #include <linux/interrupt.h>; Q. _# c# D, j+ t0 w4 F3 [
- #include <asm/io.h>
7 `) h+ Y$ A2 F4 H9 O6 x5 K0 b# O2 l - #include <linux/moduleparam.h>
$ ]; r: J+ W' v3 }' B- ^ - #include <linux/sysctl.h>
/ I& Y4 {2 Y6 y3 Z" q- l - #include <linux/mm.h>, T" I" B! |. G1 T5 E7 M
- #include <linux/dma-mapping.h>; K4 t ~9 Z! w6 O" W* o% K
- ( r2 z3 Q! `4 P5 `! l
- #include <mach/memory.h>/ q# ~7 _: W i; K9 W" L
- #include <mach/hardware.h>
4 y; l4 v7 \8 m" V) c - #include <mach/irqs.h>
+ ^2 s# k; t0 @! Y - #include <asm/hardware/edma.h>* ^0 g! V# y% W9 h& \! d3 i
- 0 \: G; O2 [* S( z- m Z( A
- #undef EDMA3_DEBUG
- } E% B- u2 p; \0 S6 q( S. u e$ E - /*#define EDMA3_DEBUG*/1 H$ d/ l9 K, s/ D
- 7 L O7 F; D2 t1 {2 q2 ^; t( K# P
- #ifdef EDMA3_DEBUG
1 p! _" ?) F. L7 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 P+ O5 I4 H; J7 {) Y! ^% X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ^3 f( `2 U- N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* Q3 H' S! y J! {. h4 _9 E/ n - #else
& p$ M i4 y @; y' d - #define DMA_PRINTK( x... )
3 C) N; H$ j% N8 \; V# e3 U# a; T1 n - #define DMA_FN_IN
( s' I9 I+ F+ G8 g8 `5 a - #define DMA_FN_OUT
" [7 P; A3 R; b, \4 w( j; A - #endif0 r8 _6 P% p' O) U
0 M; d ^' r( @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 o4 ^" E( o; W7 ^0 F( W* e& w
- #define STATIC_SHIFT 3/ _+ f" s8 Y' r$ p/ d% Q* g
- #define TCINTEN_SHIFT 20. W- ^7 U/ ?! o9 i( `9 ]8 k5 E
- #define ITCINTEN_SHIFT 21
1 `) u+ l& N3 Y/ ]! ?; z - #define TCCHEN_SHIFT 22
+ N- h F6 I9 e2 \8 H5 R8 K- D - #define ITCCHEN_SHIFT 236 |. k2 z4 [: w9 o$ v& C
- 4 T1 q( b: R+ Q# j& D% r
- static volatile int irqraised1 = 0;
& n( H( E$ o* |8 F - static volatile int irqraised2 = 0;
. n, C5 h3 l {8 h P! d. t$ h5 I - 5 c. H* ~) A. f- J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 d, u e6 }8 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ a7 e7 P/ f$ J( H4 E! J- D3 w: L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c% Q7 l6 E: S6 \
+ H% W; T! g4 w/ U; x! C8 `. {8 s- dma_addr_t dmaphyssrc1 = 0;
1 I1 {% ]2 ^+ I" ]# |1 n$ V - dma_addr_t dmaphyssrc2 = 0;) V4 Y. `1 ^4 h+ C8 J* W
- dma_addr_t dmaphysdest1 = 0;8 R& U+ O' o- b' _( v7 v- G
- dma_addr_t dmaphysdest2 = 0;6 n" I1 [* W& T& O
- ' [$ J( N A0 R( B1 y
- char *dmabufsrc1 = NULL;
# T1 x3 g# D; S - char *dmabufsrc2 = NULL;
9 W2 c- ^& C4 t% c - char *dmabufdest1 = NULL;
" L" S2 \* a9 j. p& ` a( a - char *dmabufdest2 = NULL;7 u n. ?( q/ Y. h5 S$ L& U! r5 ~7 e
" J3 p& F" ]) U; K. B5 [8 I- static int acnt = 512;( P$ I! W+ Y( ^- v. s. I$ y
- static int bcnt = 8;
: e. v& a' a) }! }. |9 B$ a5 ~6 K - static int ccnt = 8;" M: a) g8 x7 J4 @0 K
- / k4 g- m) [. A& X
- module_param(acnt, int, S_IRUGO);
{# q! A7 J$ C9 u/ m* {, j - module_param(bcnt, int, S_IRUGO);2 U' O4 W' A( D
- module_param(ccnt, int, S_IRUGO);
复制代码 8 R1 N0 i; }4 M3 `
" u$ d5 n" ^" k' v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* I- x2 y7 r. Y" S, D) L2 K: J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% D5 [* Q2 u, Y" J: c3 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# y1 h9 R# | E* ~+ ]
& I6 Y2 S; g0 p
" F6 ~7 F/ T# F5 [ |
|