|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . J% `7 d6 G+ q& L
- [code]EDMA sample test application. X+ q7 l+ \6 _+ ~+ ^( X8 ~
- /*
6 w/ W2 K6 N9 \$ R* X' G4 G - * edma_test.c+ a* z# e) s% q% A# f! @
- *
# C+ M t: J( Y5 L - * brief EDMA3 Test Application
/ a4 |6 M6 s" b: ? - *
+ c3 G2 {7 |* C2 h1 \' x( I - * This file contains EDMA3 Test code.9 t4 }5 f: \% l: N6 ?+ f/ R
- *
5 b6 M6 X k* o% s9 Z4 j- m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 u4 {8 Y8 g: [1 Z- v9 e! L& ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 E: A% j2 ]9 {- W! m! g1 |
- * TO CHANGE.
4 I# {. J9 ]7 S- ~% u8 z - * c1 K* }$ O% u2 J% J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 q. G5 c7 u Q( j9 l% k
- *
7 ^7 N" Y: i) x# M - * This program is free software; you can redistribute it and/or
0 |9 @5 a( V: l# x1 j - * modify it under the terms of the GNU General Public License as
) A* o5 t* k, A |* x - * published by the Free Software Foundation version 2.
5 U* ?$ |" E2 i! [ Q& n1 t" F. B - *
& j0 h/ Y, M' O: b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 E9 P" x5 }- Y4 g5 j6 X; H6 T. V' t
- * kind, whether express or implied; without even the implied warranty8 I3 k2 E5 Z) _3 m' k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! l- Y |) [0 ^* C
- * GNU General Public License for more details.: K; ~$ h/ q4 t
- */% U) e4 U2 r% Y. X U( u
) _7 P0 l" K$ A1 u/ q- #include <linux/module.h>
1 k. @# S9 N5 X+ U/ o! L1 O - #include <linux/init.h>5 J' R2 w( R6 I$ [+ `$ u: A
- #include <linux/errno.h>$ ^3 B8 r+ M2 j* z
- #include <linux/types.h>
$ B0 o! Q+ o* Z4 o - #include <linux/interrupt.h> K$ P0 g8 b1 ?$ g8 B" i
- #include <asm/io.h>! O8 J, z. F& ?: d
- #include <linux/moduleparam.h>; h% A+ z0 X7 g& |
- #include <linux/sysctl.h>
; e2 I2 ]5 x/ k8 ?3 h: y - #include <linux/mm.h>% O# L* b* y* }/ j Z" w0 O9 Y
- #include <linux/dma-mapping.h>
1 f+ J# ^$ A# c1 W4 S - 7 {: A8 U) P# L1 X1 Q' G
- #include <mach/memory.h>
6 d. r6 L1 {4 v+ {7 u0 { - #include <mach/hardware.h>0 e- [0 M9 N( Y) _* x
- #include <mach/irqs.h>( d9 Y( u7 F. I l" x
- #include <asm/hardware/edma.h>
# v( x5 i4 Z9 B/ y% H - : N( [/ T. Q' \$ B
- #undef EDMA3_DEBUG% n F( q2 Y$ }. \
- /*#define EDMA3_DEBUG*/
6 f4 k* j2 b' b" V8 O5 i - ; i9 M6 l4 u0 L3 U$ S
- #ifdef EDMA3_DEBUG5 z7 \ J4 h. q9 j D2 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Z4 a& E! }+ ?* n) w! c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% I- M/ ] s( G6 ]8 l3 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q, e" o- K1 N' Q, y' f2 }
- #else
* ] q6 r# Y: U& n - #define DMA_PRINTK( x... ) H G6 F' l! ]! {5 N5 C0 S- X
- #define DMA_FN_IN
1 P2 z1 j- @3 Q; e5 G - #define DMA_FN_OUT
6 d% [1 U% @& d; v) z* C g - #endif
# U' r5 o# u9 f, o - ! g( m! X' u& W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& i6 y' i7 Q/ i2 d6 f5 C V D* A - #define STATIC_SHIFT 3; A3 J% Y: c" v- h* G- k
- #define TCINTEN_SHIFT 20% K% `1 W* _' O# ^5 s
- #define ITCINTEN_SHIFT 21
9 n$ b" a: \0 Z `4 o8 P: M - #define TCCHEN_SHIFT 22* n7 P, u; j! x+ D: W* ?; V
- #define ITCCHEN_SHIFT 23 [( g' b! w. ~& j
- : A: Z- f5 U7 z+ _) C
- static volatile int irqraised1 = 0;$ L3 {2 E0 |) v& v9 h& c
- static volatile int irqraised2 = 0;
: U2 ~/ s8 M& y' `* w% X8 I: [
* B! P3 c! K3 @. r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' H6 |! C% [. T0 G/ g U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: G, ?3 c5 {% h! l: e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 f R- ^& G+ n3 B% A2 Q
- ! O0 E, @8 z$ \/ x, `
- dma_addr_t dmaphyssrc1 = 0;! | _6 z/ w# f! K& d- ^
- dma_addr_t dmaphyssrc2 = 0;
( X& j6 ~* ~5 K% C7 D - dma_addr_t dmaphysdest1 = 0;* l0 f0 G6 C9 _: x/ W5 w
- dma_addr_t dmaphysdest2 = 0; Y. W5 d3 C* c' F9 V- s2 `
- ' v. R; H9 d* z$ F2 ~# p q
- char *dmabufsrc1 = NULL; q# d( v) r V7 J; Q. Q
- char *dmabufsrc2 = NULL;0 r4 q9 {: D5 E" ~* H6 Z, { E
- char *dmabufdest1 = NULL;
8 [- y" F/ I' m8 x( G9 W5 b - char *dmabufdest2 = NULL;, d: z" G$ ?3 r9 O
- 9 ?$ p5 i7 G( s( L! q# m
- static int acnt = 512;; n9 H8 c/ y# L; h# t$ i
- static int bcnt = 8;
0 O& P; Q: d! P3 F; H) I - static int ccnt = 8;
+ E! r8 b# Y, l - 6 _4 H% G9 C& i; n2 Y$ e2 R+ E4 ]
- module_param(acnt, int, S_IRUGO);1 o, m7 Y3 \" b2 e; S% K" T+ f
- module_param(bcnt, int, S_IRUGO);
" `* w9 Y R6 \) A' Q5 Y - module_param(ccnt, int, S_IRUGO);
复制代码
4 p7 d+ A3 f$ h5 @ h# j- W* ~9 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 N& M) K% F9 S( M4 C; S5 ?7 t$ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 U% q4 h, y# Z! b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! O2 [, V4 E: e
, H9 t8 F; Q! _* I: v5 R3 s5 h) U4 K1 B- w
|
|