|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Y7 P$ \3 S& k9 E: C
- [code]EDMA sample test application3 o3 c0 W, U+ T1 ~0 V3 _4 |
- /*
; ?- h1 T; U# u/ `% e& }* j4 p - * edma_test.c; E' g5 l1 n) Y% R
- *
; g, k5 F1 t; d" U; G - * brief EDMA3 Test Application
$ [6 l2 r2 q l+ \! x( ^! J- L - *
( \! [* A& L% K+ `& q - * This file contains EDMA3 Test code.4 z) ] _* i% |, N: ^, B# t& S$ h
- */ b6 y# R. r4 L) ^' k1 q2 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* @2 ?/ G9 U. M' b8 R& k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ F: j) g7 }. ? - * TO CHANGE.+ e7 n6 _# W; Z# d# m1 P
- *& w3 L% x* s1 [' o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 c9 v4 u- H9 E: k! L - *
% }. ^# m% n- k% }1 }$ A- R' L - * This program is free software; you can redistribute it and/or
# Q6 D8 S% C3 W* D7 q2 S - * modify it under the terms of the GNU General Public License as
3 T9 V4 P' u* H - * published by the Free Software Foundation version 2.& N: i* r2 y' e* r5 q; S7 u, Z
- *
6 N7 c$ V% e1 V1 |4 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 n# p' L/ E5 c( ]% b
- * kind, whether express or implied; without even the implied warranty, r, N7 {- H, v1 P; J3 h& @' y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ H2 P. B* x5 G% f' R4 x
- * GNU General Public License for more details.
9 ?* C2 D# |' e7 T: t6 O' L% n4 a - */
. N/ b# F$ m3 }. Q0 t
4 N3 {$ c1 H0 G( T+ ~6 y- #include <linux/module.h>* ]+ l* v) v4 t$ i& L' r
- #include <linux/init.h># t6 W8 Y9 ]6 a# [9 Q- m6 w
- #include <linux/errno.h>! ^0 T! j; I/ [( w
- #include <linux/types.h>
: N/ m' t" a* T7 a. { b - #include <linux/interrupt.h>: F0 r' f" k5 y! c. r, b8 J4 J+ l
- #include <asm/io.h>
0 \0 u: Q6 w& ]0 c7 s6 | - #include <linux/moduleparam.h>1 r* T# y8 M0 {7 z4 A2 e3 u: y
- #include <linux/sysctl.h># }6 L1 _! ^. J+ Q# o
- #include <linux/mm.h>
) f+ w# M% Y8 ?$ Y - #include <linux/dma-mapping.h>
2 o: J: d6 U# @6 B& D - ' R3 d% Y$ A X0 B
- #include <mach/memory.h>3 a6 P2 }9 o, M3 T
- #include <mach/hardware.h>4 x9 o* n. r% K. _
- #include <mach/irqs.h>/ }3 s7 A5 H$ P) p3 N" g% ?
- #include <asm/hardware/edma.h>5 e0 G7 K2 X, q: L" ^* H
- : j2 h2 A1 O. Q0 a' L
- #undef EDMA3_DEBUG/ r; e' P$ ]1 f8 o- X1 v
- /*#define EDMA3_DEBUG*/+ \! @3 a7 h. y/ f) x: l
- ) l$ d% X% _' ?0 M. e
- #ifdef EDMA3_DEBUG
8 j" u: X( D! T s- x- a7 `. { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) } B$ q4 N3 h1 y) ]+ Z/ O! d2 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \7 h% _3 G' c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 e+ v& o. h$ |3 L% t5 U5 i
- #else9 {* Y9 l, @7 c1 J
- #define DMA_PRINTK( x... )9 k4 Y4 |& y7 O: B& G
- #define DMA_FN_IN' ^/ |- Z% D) L' \# o o6 V1 T
- #define DMA_FN_OUT
5 N6 t! z2 @1 X0 M9 { - #endif
1 C* J+ o: {6 ]$ Z
. [4 o! l* f0 ~( Y8 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 D" v: T' ]2 R' n4 G - #define STATIC_SHIFT 3
6 U' I* ]: S1 y- Q; m - #define TCINTEN_SHIFT 20$ L ~# w$ }; c# w
- #define ITCINTEN_SHIFT 21
! C7 m& G' t/ p% Y) I2 l/ } - #define TCCHEN_SHIFT 227 C x: D: k/ p/ F6 h9 V5 J
- #define ITCCHEN_SHIFT 23
8 K) U0 [9 l7 E3 C% d8 r" x E
, B5 O7 ]* P5 R7 b b- static volatile int irqraised1 = 0;
3 v' r6 c- j" P5 K& t3 M( _2 A6 [ - static volatile int irqraised2 = 0;8 O* R) o- M1 w
- }' D4 {2 S& N" `9 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 X: ]( ~6 T7 {8 r" `, L6 A/ ^% c% k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. X' ?& ^/ y# ~3 Y% Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( P7 H4 ^; Y& L& D
- 2 P5 r, A/ O$ m+ B& P5 \
- dma_addr_t dmaphyssrc1 = 0;
3 Q# Q! P* c& e. ~# n7 H; ? - dma_addr_t dmaphyssrc2 = 0;
8 t+ w" I9 n* M; h' `3 i - dma_addr_t dmaphysdest1 = 0;6 c6 O3 a& f+ H; U4 @0 z' T1 U
- dma_addr_t dmaphysdest2 = 0;
% F3 x- z& p4 }" L9 [
9 E% x4 p5 ?- k- char *dmabufsrc1 = NULL;
5 @9 t7 v! [/ e1 h4 q0 p - char *dmabufsrc2 = NULL;" A4 j7 N- C$ S2 ]
- char *dmabufdest1 = NULL;
9 e% a$ O P; \- @, P5 A - char *dmabufdest2 = NULL;
& n& _& Y# }5 I2 l+ _$ ~ - 2 ^; c9 o* _9 b" g, _+ n- y8 S" }8 Y% ?
- static int acnt = 512;
* p3 w6 i: q( l! ~" _- [1 C - static int bcnt = 8;
( Q7 p1 g, i7 r* T( n9 y9 N - static int ccnt = 8;
) K; D$ R# i1 t* g
/ c2 d }/ p) k; _/ _' I7 n& ]- module_param(acnt, int, S_IRUGO);
6 S2 c. U/ ^" F% }8 o1 u - module_param(bcnt, int, S_IRUGO);
( i" W( v7 ~" \ \& ~% Z$ V* x - module_param(ccnt, int, S_IRUGO);
复制代码
" `- J- n# Y) B: H- G8 O5 D+ m3 K( x c. S, k2 ]5 ~2 H" t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# o5 u6 I/ l# T# \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 j9 O& ^+ V" U" P* x8 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g7 F- N T- o& N R5 o" [+ T/ G" ~( N) V. G
3 Y8 `" N* ?- E( j2 k" e
|
|