|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . @& f5 X# {! j+ J1 a( t+ [! a# C
- [code]EDMA sample test application* k/ N& }" X, G9 R/ u4 @# s* q# Q
- /*6 Z0 ^' [5 Z$ @- b7 ?0 S2 |8 a
- * edma_test.c% q9 R& P& b8 I3 a s9 Z
- *. T9 a2 Y& B2 z& y h7 h, ]
- * brief EDMA3 Test Application4 `$ W% E% L- D
- *
5 g: ~- v+ c, d; {1 g2 D" e! b7 v% I) B - * This file contains EDMA3 Test code.
) G b# a u4 E8 a - *! y: k" q3 d1 a7 b" O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ r6 f- M* R( m; w% D+ b. H9 o0 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* W8 |$ \# `, Z: a* @9 z. w1 B
- * TO CHANGE.* @, `6 s" k. V
- *& a; F6 Z9 R7 G! `. X0 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
\/ [ }2 d( y" c - *7 ]4 U: i5 }' L* z+ Y( q/ H- N
- * This program is free software; you can redistribute it and/or5 l1 x+ }8 i: @% U* F& n
- * modify it under the terms of the GNU General Public License as
& ?/ O/ n: ~- k: p0 r - * published by the Free Software Foundation version 2.- T5 w w6 Z3 @1 M/ l) D8 ^
- *" o2 T H8 E- E) J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 P- r% o# `, q: O! D' r - * kind, whether express or implied; without even the implied warranty
9 F" o* U x9 w1 R4 G n+ m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 A" A2 |! w( d% b% q - * GNU General Public License for more details.
; M7 E" S% U$ r. U7 A, }& B - */
, }9 n, |, R) s$ k& q
8 H; c3 `; B& g2 y* L- #include <linux/module.h>* _) P+ y) Q6 P) o; {
- #include <linux/init.h>
( b$ y" b! F& ?4 |9 |( Y - #include <linux/errno.h>
) }2 i' L+ T1 I2 q4 j" y, R - #include <linux/types.h>
9 \6 D! G- i8 F. m1 i - #include <linux/interrupt.h>2 v0 ~( r: q3 ?6 g+ a* V
- #include <asm/io.h>/ j4 I+ e& ~0 ?+ Q
- #include <linux/moduleparam.h>
3 r3 N9 d3 X. U- ` - #include <linux/sysctl.h>. [" G( X3 A, {& U/ y! _! {
- #include <linux/mm.h>& j2 N! n# p: M2 Q7 Y1 ^0 h
- #include <linux/dma-mapping.h>: y6 s- T& c) @
- ! i9 C: ^' L2 m) S6 I
- #include <mach/memory.h>
2 V2 H8 t5 V' n& E - #include <mach/hardware.h>7 b! p% I$ E" l# p3 v
- #include <mach/irqs.h>
" p0 o1 [: M) F2 G) J) ^; A5 ~$ y5 i - #include <asm/hardware/edma.h>, m: J- D% c2 Q6 x
- " {% i F7 i" k
- #undef EDMA3_DEBUG* e8 G! e$ u+ G7 K8 Y. M
- /*#define EDMA3_DEBUG*/
$ w' B: e0 U. |9 j4 _ w3 G9 A# n - 7 W7 ~1 `: c$ n: u6 f
- #ifdef EDMA3_DEBUG
* ^3 I" m4 A) l" v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% w( ~7 O& F, O0 h+ j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" y1 L% U1 ]0 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). m! ]9 T1 s) X3 K3 h/ { i
- #else" d/ C& D) t& z" o+ O$ y) @! S
- #define DMA_PRINTK( x... )
5 y8 m9 |- w3 E% Z0 [. F - #define DMA_FN_IN
7 ~1 [! I2 N! o - #define DMA_FN_OUT
s- @, {* e: a8 X7 q% ^ - #endif' e9 d. r1 Y1 b z x
- 6 t+ D2 n l3 e' l; c7 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) d0 J1 P% Z9 a0 r% \ - #define STATIC_SHIFT 3. t8 h; r; D% r2 K0 G; h
- #define TCINTEN_SHIFT 20( r: W5 I) j+ O2 ]: Q: z$ d
- #define ITCINTEN_SHIFT 21, e$ @2 u0 v# Z A8 z
- #define TCCHEN_SHIFT 22
! K/ s" R+ }" }$ W - #define ITCCHEN_SHIFT 23
, _0 w! C# L! L- H `/ C$ q
# Y4 d& Z9 a2 \, f& _: E- static volatile int irqraised1 = 0;
1 g4 ~/ Y( r$ | U7 R5 K0 U. Q - static volatile int irqraised2 = 0;
( p: r: U% G9 y- G - ; E0 T d/ ~9 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ m' ~2 s; R. u/ X% s- O2 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K% q" k! l/ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b2 O4 d7 G/ Y. m; o
+ J5 p- m5 t6 x- S- dma_addr_t dmaphyssrc1 = 0;* L. T: B. E3 G& O
- dma_addr_t dmaphyssrc2 = 0;
$ a8 w i; V3 q( D - dma_addr_t dmaphysdest1 = 0;2 ?, b% P. b1 l" `8 _
- dma_addr_t dmaphysdest2 = 0;
# H6 y% i7 |+ k0 Q7 r+ R* g* J
( y1 }5 Y9 S4 [$ `9 e- char *dmabufsrc1 = NULL;" i" K+ h C+ d) \9 q
- char *dmabufsrc2 = NULL;, `" q U, S* P6 a; n7 y
- char *dmabufdest1 = NULL;
3 S+ G* J3 q) \) {) B: M* K! r5 R - char *dmabufdest2 = NULL;
~) `( x, ~0 a5 q' j
( [: C& c/ _2 y; F- static int acnt = 512;
8 Z& E/ I2 k# r# F, q" @ - static int bcnt = 8;, }( S8 a+ v) }
- static int ccnt = 8;
+ X8 f! }+ v! t. h* f+ v
( M5 s2 e0 k2 h3 _/ ~. s- module_param(acnt, int, S_IRUGO);
, `. q r6 j7 B. g; Q1 M - module_param(bcnt, int, S_IRUGO);
: x; F" T) n& |) [& L - module_param(ccnt, int, S_IRUGO);
复制代码
- z* G; _2 n. M5 A
! x/ G# h x$ X! |9 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ?9 N' e% x6 C* Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' }' C) F- l H1 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ B' W# [5 l6 M4 ~7 v$ r
: v8 M( F3 f7 U0 ^
( F, w6 J% O" x: _+ a K# t
|
|