|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; f9 V, x F9 ~. Y) X/ x
- [code]EDMA sample test application* R8 }2 C6 V9 q+ t" ?' V
- /*
/ T% I- h4 [; Z- M+ { - * edma_test.c: `, j( J+ U: [2 f9 }7 ~9 D! Q" f
- *5 g2 h" A0 e* y3 l: M! R
- * brief EDMA3 Test Application) |" p5 m2 E8 v4 e) ]3 g3 d2 h
- *7 `1 b! d4 S0 t2 i# e2 M7 H7 } X
- * This file contains EDMA3 Test code.2 Y+ W2 a7 ?7 N# ?& c. N
- *
9 J3 e. ?: r+ V+ t; V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ I# j* z8 O- j2 p# f" M, `8 p( o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 I M- t, S) W( Y - * TO CHANGE.
/ f. a- K3 d' A" C) N - *
$ J7 `1 G' f0 l" _. T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( s$ L+ N- w. L$ Y - *- ]; h* }2 w* W! } B. ^9 x
- * This program is free software; you can redistribute it and/or
1 ]6 f* C3 }6 O; i) M - * modify it under the terms of the GNU General Public License as
; ?9 m! x2 g( |( J- _2 ^ - * published by the Free Software Foundation version 2.
6 e) A. {. R# a5 O1 h' j - *$ A" t) K- k2 d+ D- g& j* ~9 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 ?$ r- N0 ?1 d. W- i; O; y8 J - * kind, whether express or implied; without even the implied warranty
4 _, S1 ^! J Q4 E( w- u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ }+ P# g4 y w - * GNU General Public License for more details.
7 l* y! n, M2 d% M8 T- d - */( w: d8 ]9 D$ f& A! q
- * G3 u8 }. k3 t* \2 ` K
- #include <linux/module.h>3 F" q7 h8 O H
- #include <linux/init.h>9 {; U- b6 S4 z1 p8 G; G' Z
- #include <linux/errno.h>
0 |1 _ P& k. s( e) U - #include <linux/types.h>
& ?+ A* p6 [+ x: P/ m - #include <linux/interrupt.h>! T% n6 g$ Y7 J5 U
- #include <asm/io.h>' w" D2 V: [0 ^; b
- #include <linux/moduleparam.h>5 O. n5 {8 F3 H7 s
- #include <linux/sysctl.h>6 R) D" ?5 }% b& W
- #include <linux/mm.h>; ?. ^0 ~) K3 g+ C! U' U
- #include <linux/dma-mapping.h>
% \8 A9 C. I) \
3 H* P# c! R0 k* V4 r- #include <mach/memory.h>. H6 S4 d9 p# K, O) f' D7 G
- #include <mach/hardware.h>! j. t: ^* N8 v6 l/ w8 |: D# L
- #include <mach/irqs.h>
% F( Q/ K4 q/ i, v9 y - #include <asm/hardware/edma.h>5 L! A" U% G4 i2 [
1 O7 b7 y: C( t! c2 v3 W- #undef EDMA3_DEBUG
8 i8 j$ k3 f2 T - /*#define EDMA3_DEBUG*/$ O) G% a# y; d4 ^- Y
4 ~& {2 V; u7 O: Z; w6 |) H6 K- #ifdef EDMA3_DEBUG; ^; u _# U( L O' q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# ~; k3 G, \% H$ t3 x. a* Z7 X- d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) D. b; a! Z* {5 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Y( k0 I3 R6 Y% F& X. W0 @5 z* t: M - #else
+ m- K$ b6 a' j: W% B7 ~' C - #define DMA_PRINTK( x... )# u% D- C5 [1 Z' |. F. N
- #define DMA_FN_IN
$ L! e- g% C( f. P' o+ m- O - #define DMA_FN_OUT8 C. d: H9 q* x% H: Y$ o
- #endif1 A/ A% ~$ i5 L6 ?, s
6 I# f; g& F) k6 s! x$ \6 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* W) r2 o( h4 g' z/ e, [
- #define STATIC_SHIFT 3) ~% d Q% D. e/ N2 [: `7 m+ d) V
- #define TCINTEN_SHIFT 20/ q6 F9 q# d! L8 h( ~6 s
- #define ITCINTEN_SHIFT 21" Z: ~) a, G" v+ Z
- #define TCCHEN_SHIFT 221 v& ?) A8 ]' e# x3 O6 `- z
- #define ITCCHEN_SHIFT 23
7 U! r( v2 ~4 R6 p6 g - 8 {3 u2 q! m( |" w, |1 A3 r
- static volatile int irqraised1 = 0;
4 \* S. C& M6 i, V1 } - static volatile int irqraised2 = 0;. ^. I2 t7 v3 m7 v3 q8 X
& P8 l% g. G; R$ m* Y* ]& c1 B, U3 N1 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^& O% _/ W% S1 j5 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); {- |0 l X8 P4 m4 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s$ S" ^5 a9 }# h8 g& H5 | `3 }5 N - " N, c& B0 X$ G$ H- f' k8 S! O
- dma_addr_t dmaphyssrc1 = 0;0 W% G+ M8 S$ e9 U" L# ?4 p: {
- dma_addr_t dmaphyssrc2 = 0;
8 O1 u! C4 Y) s) C- V - dma_addr_t dmaphysdest1 = 0;* F+ R9 C* c4 S! y
- dma_addr_t dmaphysdest2 = 0;; j: S; I' a$ D9 p2 H
' y) D' ]6 s8 O) I" k- char *dmabufsrc1 = NULL;* x# n" [* w7 t. u; T! W
- char *dmabufsrc2 = NULL;
6 w; u/ {, C: g% z$ z - char *dmabufdest1 = NULL;
6 p$ G, ]: I) H8 ]. {! z2 V0 h - char *dmabufdest2 = NULL;8 F0 `, ^' ?6 [4 ?3 \7 |' [3 ^3 @
- A6 T1 c$ _1 u0 |3 V# v: s
- static int acnt = 512;2 y6 Q3 e0 C3 D# ~6 u
- static int bcnt = 8;
* G' Z5 _# e% k - static int ccnt = 8;
! Q" v" l1 w! d+ _, n c) o
v2 X' b, C" E* l/ v* [$ Y- module_param(acnt, int, S_IRUGO);3 H" v- ~8 _1 J; {) s0 a0 ]+ n
- module_param(bcnt, int, S_IRUGO);
3 H* E: ]# x# o( e - module_param(ccnt, int, S_IRUGO);
复制代码
& U% G1 ]: c# d1 T3 ?6 v8 R! [4 K8 o! a; q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& y" I8 A* }3 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 [7 _# }7 ^$ w/ T+ W& G0 \( c+ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' {9 B1 Q8 }0 P! V- a, u' ^' m8 D. Q1 F$ B
. |& y& P7 X4 Y/ T
|
|