|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 ?+ _( i7 q' p$ M# g% ^5 Q# X
- [code]EDMA sample test application! V3 H1 [0 n6 ?
- /*. L9 m* H/ y$ ]4 Z, Z2 ^
- * edma_test.c& N1 G6 y6 \2 j0 }* X! A/ H
- *# f' D0 r X3 F, t1 a ^
- * brief EDMA3 Test Application1 {/ @# k" b* O/ |5 r
- *
6 j8 y8 c7 M. e4 {* x; X: b+ l( a - * This file contains EDMA3 Test code.
) R* g( g6 T3 A1 N$ p - *' S/ b5 S3 U# B1 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; o" _9 F+ F; J4 Q, y# Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ f9 h5 L0 d/ `+ X1 V" ^$ ?- m - * TO CHANGE. z$ D4 I8 b- J \- r
- *
' ~ \' C% U: ~, t: ]- L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) s0 H1 r1 C( { - *
5 v4 ]0 B/ |- E5 n: U# \# j( J. X - * This program is free software; you can redistribute it and/or) R1 `& z& z- z! ~& ^3 m
- * modify it under the terms of the GNU General Public License as
2 n4 p9 {7 R S$ C- | - * published by the Free Software Foundation version 2.% W! Y# q2 w3 u
- *
, p1 A n: e2 w# H. m0 n; K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 R( b. Q( {/ O! b% B8 f - * kind, whether express or implied; without even the implied warranty
. p1 q* W3 ~/ R1 w6 S& I' p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& |3 P$ H' r( c2 R4 H* o y) x) ~% R) A - * GNU General Public License for more details., Z( p/ H2 y$ _- P4 C
- */( |" t' E5 g# ?* f
9 C$ w- k2 G- r( a& q3 J- #include <linux/module.h>; J; J6 n, d; Q$ b
- #include <linux/init.h>, d5 G# Q t; L, A- P5 C; v0 ~
- #include <linux/errno.h>4 Y" s: T4 H9 k( w$ X
- #include <linux/types.h>* y, |, W7 C2 e- F$ D
- #include <linux/interrupt.h># A+ N2 m' Q4 p0 G- l& G0 J& P
- #include <asm/io.h># @ c5 R1 n. l- a' M- z" Z
- #include <linux/moduleparam.h>
' U P# P" C- H }# X - #include <linux/sysctl.h>1 B- J# s: L6 W/ q
- #include <linux/mm.h>9 B. z1 P# {: E6 y' F
- #include <linux/dma-mapping.h>2 }' H8 G% c$ E
/ t9 M- I6 n% d- #include <mach/memory.h>1 X; }7 _8 P: O! W- |
- #include <mach/hardware.h>
1 E; u2 m5 R2 l/ T: S - #include <mach/irqs.h>
" X8 K- x& t3 P, V, i8 h - #include <asm/hardware/edma.h>
- C8 ?9 h* t+ d3 Q9 F, K - 4 O. `! B' ?) f
- #undef EDMA3_DEBUG( ]- J" @+ j1 O* f8 ` ], z# k
- /*#define EDMA3_DEBUG*/
# Y4 s* `) J+ }% K
; P5 \! B2 z1 z ~% Y$ u' d- #ifdef EDMA3_DEBUG
$ D# s7 `4 C: Z' v& b+ [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 l, k) d4 v* j5 o+ T6 q. N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 J# d) _7 m, Q; g0 N6 x. ]; U# e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' U+ P, K k2 ~/ `* l! X
- #else; T/ h8 e& V; N* c8 J# ~5 G3 F
- #define DMA_PRINTK( x... )
; y) p' |' Y. Z- R2 i - #define DMA_FN_IN& T. P# T2 f: x' \
- #define DMA_FN_OUT( d7 t2 [0 |% K7 W
- #endif
- d- s) m: N8 O# Z" @) {: v0 q
0 ]+ F: s- z; Q7 r% R) s A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: O y9 D' v, g) d - #define STATIC_SHIFT 37 n1 H/ }/ }8 ~' S; `
- #define TCINTEN_SHIFT 20$ v+ V3 Z* K$ i1 E5 m* K9 v2 U- s2 T
- #define ITCINTEN_SHIFT 216 ^& _+ k* `1 [9 p1 U( |
- #define TCCHEN_SHIFT 226 X8 m! m; e+ f$ ^2 K1 e5 i
- #define ITCCHEN_SHIFT 23) x1 H2 b9 Z2 m% y
- : T6 e7 g+ r1 Q$ \
- static volatile int irqraised1 = 0;" o- _9 z( }" } o0 d6 f% b/ U7 W w
- static volatile int irqraised2 = 0;
8 J8 U: A& C& @" ]$ w
6 ~5 Y. v) d) b* g, F4 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* g5 L" o) T% _/ z; l2 I! {3 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 H' j9 @7 ?+ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V$ y! }. f1 q7 t8 ^
- n# g3 B* B+ e+ w$ l4 Z
- dma_addr_t dmaphyssrc1 = 0;
, M: {0 r5 b* f+ X1 R9 y - dma_addr_t dmaphyssrc2 = 0;" I' v+ U3 ?+ [( a+ `. r q
- dma_addr_t dmaphysdest1 = 0;: L V* E1 ]4 X2 |9 f+ u; o
- dma_addr_t dmaphysdest2 = 0;6 l( H, F6 M* T
- 9 Y. F4 [9 b7 A8 p, U2 a4 w5 G
- char *dmabufsrc1 = NULL;
( |' q- S0 z) G$ _3 g - char *dmabufsrc2 = NULL;
* [( u3 S. ^6 `# z8 T Z ? - char *dmabufdest1 = NULL;8 l( U. V. i: I o8 i& B
- char *dmabufdest2 = NULL; C) E( Y b) o7 Y
- ' c; g; b& ?& l
- static int acnt = 512;
; B& b) {0 D. Z9 X - static int bcnt = 8;
5 w' @! l; z! p: I! w - static int ccnt = 8;
) w7 |+ k# ~& x' Q3 A( B/ ]
3 b& Y$ X$ e$ E- module_param(acnt, int, S_IRUGO);
; k6 k' H) v- l" w* r- u - module_param(bcnt, int, S_IRUGO);% u" h2 u0 w: d2 y" ]+ ]
- module_param(ccnt, int, S_IRUGO);
复制代码
7 B3 ?0 y1 c$ Q* w n6 P7 R: P" ^7 k8 ^1 z+ }/ G' W$ _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q" X: x% N2 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ K) }; ~% P# s# F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& O5 B' E6 q/ c2 c: S' K2 H; I9 d
% d& ~* d) W+ d- |4 O8 _2 Z" Q1 l) [6 z7 u2 T/ g
|
|