|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : V6 r: \& C* G' D) w# \3 S+ h
- [code]EDMA sample test application
2 t1 V. |3 U( n0 |2 Y - /*) k6 s" g% o% p: V8 X
- * edma_test.c$ ]# ?' L1 Q2 P0 Q$ F
- *% F+ }) V3 F% c' I2 ~/ b" n
- * brief EDMA3 Test Application+ Q6 b. u N9 C* r4 Y
- *
- C/ b% E# i" _( z" w$ t# ?. D - * This file contains EDMA3 Test code.- c# _) S( m$ b4 Y0 S4 Q- i5 Z( u
- *- o5 i8 ^6 g5 j. S, }+ C8 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ `8 n9 a% h" e7 Y" C% i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E4 f( N9 {& {! w& a& W' c
- * TO CHANGE.
" M7 Z5 H2 t9 ?3 i" {5 e" _3 T5 Y - *
7 l* L9 n' t0 T3 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) N) ?) K) s* U9 H V - *
! w; I* [+ z( f - * This program is free software; you can redistribute it and/or* e. E/ W$ {! s1 P$ z1 ~3 m
- * modify it under the terms of the GNU General Public License as& s, m% d5 |; c5 I s
- * published by the Free Software Foundation version 2.
! q: h2 }" _4 N) q- D9 s - *
, I% Z/ |$ R- P+ _" V8 x1 p( V' o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; I/ c# v2 h5 Z! P5 V! a N2 l" o
- * kind, whether express or implied; without even the implied warranty m+ [/ _; L7 f0 z* e9 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 y7 Z4 Y& o) r9 M" p0 }; X" m
- * GNU General Public License for more details.$ T( c* N; ]; \; I9 @: B/ u
- */
7 ?# @( G3 h) Q! T( g" o; Q - 2 N h' [6 u! i o y4 v# J, E
- #include <linux/module.h>
7 l6 F; C: d7 V( Q1 B - #include <linux/init.h>0 `4 I, y& R. ?- {; R
- #include <linux/errno.h>3 Z) T3 x! O- D: {
- #include <linux/types.h>8 U2 e5 M0 s& T$ v$ {2 I1 h
- #include <linux/interrupt.h>+ z# U' i( T: U9 i4 _ F. r- w
- #include <asm/io.h>2 `# Y! o7 v- B
- #include <linux/moduleparam.h>, V4 G; k+ T: D5 V7 m
- #include <linux/sysctl.h>0 b/ J2 n# k, Q/ \% Y- `
- #include <linux/mm.h>
$ @- G$ t" r8 T. H1 ] - #include <linux/dma-mapping.h>
" E4 z" Z2 F; h6 g' M# I - / }4 M+ o" N/ T* \7 z
- #include <mach/memory.h>$ D q# W- V* g; C4 v4 J0 L3 T
- #include <mach/hardware.h>
& i, Q6 L6 l ~3 N# O( f. [2 k - #include <mach/irqs.h>- q( k. ?4 O( G. M' d. C9 j0 _& d5 J
- #include <asm/hardware/edma.h>
. ]' s3 b) d9 k8 N - - F8 ], p, R1 r+ {
- #undef EDMA3_DEBUG- n) @2 |5 P, V/ s8 ^. R3 G9 i
- /*#define EDMA3_DEBUG*/6 l) h8 P j9 y! J F' L
8 U8 a! F* w3 G6 ^7 R; b- #ifdef EDMA3_DEBUG
: b0 p) Z$ X- o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 g) t3 G( ~; T4 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 C9 b2 Y3 c, G% W4 w+ m. [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ~3 }$ i& w, X: \6 H* J1 s - #else" S" B3 ^2 { t1 k9 F0 Z6 S
- #define DMA_PRINTK( x... )& b7 t9 F% n b# P
- #define DMA_FN_IN
# z, v' f8 s( K* G% D P7 z7 K - #define DMA_FN_OUT+ S7 ]# Y1 }* x( }' @; ^! L
- #endif: N6 x" n$ \& T& K2 \
- ( {( K- \0 ~! X( P$ Z3 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 s2 D4 U, U; u- P5 {5 C
- #define STATIC_SHIFT 3 a/ V* O( Y+ q* P4 A# W
- #define TCINTEN_SHIFT 20& e: V$ }& V' B8 s% I4 v
- #define ITCINTEN_SHIFT 21/ h N: j, O3 Q \* U# z8 e
- #define TCCHEN_SHIFT 22
' G6 ~- L5 ]1 w# \ - #define ITCCHEN_SHIFT 23
% J7 l& ^( t8 D+ k [7 {3 i - $ n8 `- o; u" |) \ B# K- H' Y4 J
- static volatile int irqraised1 = 0;# |, E% E3 u, X* w
- static volatile int irqraised2 = 0;0 D# |8 ~6 X+ o- |+ }/ s( E
1 F( p) L g& {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 B7 ^; P B* x3 e: O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G8 j; |/ }5 ^7 U0 O) O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z2 n/ z7 v6 E
- : v% b+ g% P. `9 F7 ]3 |# y
- dma_addr_t dmaphyssrc1 = 0;
7 ?/ L7 ?( a x+ B- q$ V$ w, O1 E, q6 { - dma_addr_t dmaphyssrc2 = 0;
6 m3 j' O) I3 s+ Y/ ]6 [* r - dma_addr_t dmaphysdest1 = 0;
3 T# b& {* t& [: j - dma_addr_t dmaphysdest2 = 0;
3 G6 f4 |2 ]% v o
) l; ?8 r+ ^& r% z/ y- char *dmabufsrc1 = NULL;' J8 @. R& ]- o8 u: h' O) J
- char *dmabufsrc2 = NULL;
2 m2 W* g6 s: B+ H, m - char *dmabufdest1 = NULL;
3 U4 _. _4 W- o) R$ I" ` - char *dmabufdest2 = NULL;* @/ C I C. V7 L
- 9 C) P+ h u3 v% t) {
- static int acnt = 512;
2 L0 x" [- J* s' p/ p7 b - static int bcnt = 8;# c6 `% @1 i* y4 N1 K
- static int ccnt = 8;& c. }: v7 Q0 v0 C$ d
4 `* A) L' g6 I& W* p' r# P- module_param(acnt, int, S_IRUGO);: }/ t+ }$ M- M @6 ^& s# @
- module_param(bcnt, int, S_IRUGO);
8 X1 k6 f8 _ O6 | - module_param(ccnt, int, S_IRUGO);
复制代码
9 [* V S5 z* S$ }5 I6 t& o/ U! ^- }) |. ^! d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c4 B, H( p6 K1 G; b" j- {5 r! Harm-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 F$ p) D; K4 B5 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# o2 Z: u$ d" x# Q" F! Q: l3 K4 F
3 P6 F" Q( e- w5 \, T( \' d* |1 l! T8 I$ k, h" K P
|
|