|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k# U, S" W) M: R- [code]EDMA sample test application3 ~( e' J+ J5 c6 C5 e' E* o
- /*
! x/ a6 c' w& L: Q) `' i; [ - * edma_test.c: z! f( j" F) ?3 }
- *& ?) p- }6 O% w4 q0 b0 O {4 J
- * brief EDMA3 Test Application' z+ ?+ b$ ]' u$ ~ j' E$ h
- *
$ l* w9 T; F0 b. d- [/ d; p - * This file contains EDMA3 Test code.
- O, V2 |! D* A7 r4 o3 ]: } - *
4 V* Y8 `$ _, {6 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 e; J! n& B! U* G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 S7 g& O n1 l3 Q8 B0 L - * TO CHANGE.8 a% ^4 D7 W- i# t! b% C
- *
6 T) c$ r6 G3 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w$ }+ E' A5 n$ b! x1 H" y- J
- *
7 p& K8 [1 m) ^* |. {: @6 ^- k - * This program is free software; you can redistribute it and/or
- I4 z" [0 Q; z. C& h" l - * modify it under the terms of the GNU General Public License as
5 d/ q% |- n! w' C7 N$ \; a+ {' T7 Y - * published by the Free Software Foundation version 2.5 z5 W6 ^5 c' u* T$ }
- *; d, [9 ?* R- T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]4 ]" q. ?. Q- S9 Y" ]
- * kind, whether express or implied; without even the implied warranty
+ x; Y+ s9 j# ]% P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( Z8 b g m; R0 K) N - * GNU General Public License for more details.! ~. A* }& f" N# V5 I
- */
1 q# D+ ]3 b' Q' s: E; I( |/ w
7 V0 f, r) F8 p6 M; q* o- #include <linux/module.h>
6 o* {/ E/ T$ x( V. @; E; @ - #include <linux/init.h>
5 T* s( i# \$ l3 U0 B4 A& g- B - #include <linux/errno.h>8 T. V- |: i( t& Z' `6 o5 R) }
- #include <linux/types.h>0 _8 c7 h0 l' u
- #include <linux/interrupt.h> g$ I; L, W9 O- D. r% I' j0 ]. z7 j
- #include <asm/io.h>0 i* K2 u- x: }/ |- n$ g
- #include <linux/moduleparam.h>
4 a" z) g& o( k2 d% O - #include <linux/sysctl.h> a* _" i- L7 l N
- #include <linux/mm.h>
* l( h, \( B0 e - #include <linux/dma-mapping.h>3 x+ V" c4 g( |8 u. U/ v# h$ v3 [) m+ Z
- 1 d3 W) x0 G+ Y+ f! l- T: I
- #include <mach/memory.h>
3 q; x/ v) b* V- l) g - #include <mach/hardware.h>4 Z. Z0 ^) X1 y
- #include <mach/irqs.h>
& N& O2 F1 Q; s# k0 ` - #include <asm/hardware/edma.h>0 P B+ v* j; k: ^* Z
6 f$ ]* @8 U, H" G4 C- #undef EDMA3_DEBUG' p5 D1 y2 Y6 x9 y+ [
- /*#define EDMA3_DEBUG*/ `8 l: E8 ] |. A+ J3 b! Y
- + @" e% Y) J0 P* u) t; a
- #ifdef EDMA3_DEBUG8 e# n+ i% _. _5 y D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 A- C, A z! q$ I$ z% ?$ U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 D! K% X2 b2 Y1 N" ]+ r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* F# P3 O% J$ N- D9 U5 I* c
- #else! h- ]8 Q: Y8 q- Z. l8 J+ l
- #define DMA_PRINTK( x... )
4 b! l* e2 R0 T - #define DMA_FN_IN
: o, z( @3 A. [1 U! z - #define DMA_FN_OUT& z5 Q+ X; q N. ]* ~8 }* `: N. e
- #endif4 U+ n# t; V# x
' T- {6 B# e' c( X6 [6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 _; {4 }+ t5 [7 M5 N - #define STATIC_SHIFT 3
9 ?# i% l: O# F% s; { - #define TCINTEN_SHIFT 20$ ^$ {2 k2 i2 E" a
- #define ITCINTEN_SHIFT 21% O% P5 V$ m& Q q
- #define TCCHEN_SHIFT 22
4 p3 J+ X- D+ E, |, W" @) t6 b - #define ITCCHEN_SHIFT 23
0 L7 R# x& T5 s
6 Y7 L- @& D% O; W' Z6 S- static volatile int irqraised1 = 0;8 x" P+ g! O9 _1 I# r
- static volatile int irqraised2 = 0;* z" D4 a& a9 s9 w* A
) Z7 C& Z$ {) C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q4 s/ [2 a5 m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }1 n. f# ]. `5 }8 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c; G* p2 B+ @0 `% g7 J9 R
8 Z( u9 K5 f1 [( h6 e+ M- dma_addr_t dmaphyssrc1 = 0;, Y' h8 ~/ x$ ]+ g/ Y! p6 V7 F7 P
- dma_addr_t dmaphyssrc2 = 0;! M. U9 N% Q# t6 a
- dma_addr_t dmaphysdest1 = 0;& }) \% `1 c4 @: ]7 }
- dma_addr_t dmaphysdest2 = 0;
' ]+ }8 Z4 v& g5 b7 m& A3 B# b - + x+ e0 j& l2 F! \
- char *dmabufsrc1 = NULL;
/ q! T: z5 z* x) s8 X! B9 X - char *dmabufsrc2 = NULL;
U5 N2 U4 ~* R0 r - char *dmabufdest1 = NULL;% ^6 R3 R; L3 C, p( U
- char *dmabufdest2 = NULL;; Z3 y+ L3 ]: Y2 g5 A
/ ?" ]% @7 |* U. a) d3 A- static int acnt = 512;
& M% S) a3 U! z$ Y8 X0 } - static int bcnt = 8;6 S8 f3 g1 p7 q& ?8 }8 Z8 o
- static int ccnt = 8;
- d. s% A% S7 ?+ R
/ [8 @8 A- T2 S* O6 n1 U' S. K w- module_param(acnt, int, S_IRUGO);
3 }" ^6 k1 ?: o, A: L. t6 P - module_param(bcnt, int, S_IRUGO);0 v3 V8 m! k, a1 v; ]9 \
- module_param(ccnt, int, S_IRUGO);
复制代码
6 K" |+ [4 K+ g5 [& q) Q1 k% p7 i: C2 F2 v: @1 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; G) s( n* i$ v! b6 Rarm-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, K' V7 \$ R1 ?; n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o& n, k7 s6 k9 u0 \8 }# {" k3 e/ x
5 Z `/ S" F1 C
|
|