|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, n6 x8 v* B2 C- [code]EDMA sample test application, |0 H# X* G% a* _
- /*/ W4 ^ E! p0 n9 c) P
- * edma_test.c
* w W; X1 _' k- n, B - *
5 ?/ U3 E: U6 L; P: \* j2 u4 g0 R3 w - * brief EDMA3 Test Application
% l& w/ Q# e- ?" ~$ q6 S8 ? - *
) l# K6 ^$ {* }+ d2 ?! W' Y2 r - * This file contains EDMA3 Test code.1 x. |& U( e; x. J8 ], G1 M
- *
5 q! i0 q3 }" Y4 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* [' v8 W6 J! a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. @" ?2 G1 j* W2 e - * TO CHANGE.
: R2 [" Z: w: |: L - *: l7 A. f) O' t% s: l1 ]+ \6 u/ l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 m8 L. j1 w R; Y) Y0 l4 c - *
4 z q! R5 o4 T4 w( T$ ~5 M" }2 W - * This program is free software; you can redistribute it and/or
/ ]' |0 s( I( i - * modify it under the terms of the GNU General Public License as
* G- }7 M3 W$ A6 a+ _% {% X, g - * published by the Free Software Foundation version 2.0 S1 z) P# t, O
- * t. p, |7 ]9 ?7 w* g4 t6 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Z( p! Z6 l. H6 }; [3 U9 K; R# F
- * kind, whether express or implied; without even the implied warranty# p) F, M" s/ a! F5 G g9 W) W1 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 _6 i( U9 M1 o8 S! x. t4 x8 F+ n9 o
- * GNU General Public License for more details.
# S1 i- q) c1 B7 x3 f/ W - */+ U) r4 ~/ x$ ^& a3 a- R
- ! _, ?- Z! x% d9 _$ M3 |- b
- #include <linux/module.h>( t7 y/ G7 r% i$ P
- #include <linux/init.h>
9 A& x0 v3 I2 k6 V - #include <linux/errno.h>' p, ]8 J1 V: A1 Z
- #include <linux/types.h>
( y$ y, u* r' \5 B9 X, h - #include <linux/interrupt.h>
: \5 b3 d$ t0 z; j9 ?. r& A& ` - #include <asm/io.h>
' T0 ~) H8 x9 ^ ^% F9 ? - #include <linux/moduleparam.h>
. Z1 n a6 ~: v* \; ^, c - #include <linux/sysctl.h>0 j7 |4 J6 Q- U+ p
- #include <linux/mm.h>
9 Y% s$ B; `0 n - #include <linux/dma-mapping.h>
g" r$ z8 H. |5 ]' ?6 T2 `$ s5 z - # ^. s3 ^$ S6 O" j0 P
- #include <mach/memory.h>
4 @3 s& l! p" o2 K( g - #include <mach/hardware.h>+ ]4 u3 a; |' y$ n, h' P( W
- #include <mach/irqs.h>4 ~) ?( O' a1 Y
- #include <asm/hardware/edma.h>
. s1 R8 x |2 Y- x+ g
- H& V; {! Q; j2 K- #undef EDMA3_DEBUG
7 P ^$ _: m5 E9 D: ]& e - /*#define EDMA3_DEBUG*/
- s. _4 D2 d( `" V
# K) u9 G* I6 K- #ifdef EDMA3_DEBUG* c8 o7 q5 ]5 X, O9 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, }4 E/ ~5 Y7 e4 p6 x0 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Z3 m) Z! U4 K# \7 l: L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 a& ~) z. |9 n0 @ Z - #else0 X. c+ _6 T( i
- #define DMA_PRINTK( x... )3 J! A! e# T- a# j0 [
- #define DMA_FN_IN
! a" F$ d; j& e+ f4 e+ o( `. s - #define DMA_FN_OUT+ b! D! |) n! P' l! f
- #endif
5 p& k5 b0 J2 M4 {, S- e
- o- a$ ] ?6 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 q2 s$ S& w0 V9 w5 b- G
- #define STATIC_SHIFT 3
8 n3 v9 H9 h1 p' E! _ - #define TCINTEN_SHIFT 200 r: [2 x" L5 ~% b% k1 k
- #define ITCINTEN_SHIFT 21 V' p9 \: ]& U# r7 P! Q
- #define TCCHEN_SHIFT 22$ \. e( o) F( t& ^
- #define ITCCHEN_SHIFT 23
) W7 z: ~5 e) m - 8 R" X B' Q3 [( r9 e- `$ c
- static volatile int irqraised1 = 0;
. p3 S/ D/ Y* g0 o+ Y$ O - static volatile int irqraised2 = 0;. @ h# f; d" l6 h; c$ L, S
: r6 ]1 L1 ~0 I$ \1 B" ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* @( e$ W5 o4 v5 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S- _# H8 @2 F1 d1 F( S' x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 W1 V4 t0 n6 B# V' V6 v
/ V. i1 s2 g! ^# {3 I- dma_addr_t dmaphyssrc1 = 0;& i' M8 _8 G1 J
- dma_addr_t dmaphyssrc2 = 0;
% s6 w- x- x/ Y6 E% B6 j - dma_addr_t dmaphysdest1 = 0;
7 M& |# }7 l3 F4 J7 A4 x4 G - dma_addr_t dmaphysdest2 = 0;2 F' j7 s6 r; y% }! i1 P2 P
. I4 k. T \& f8 D3 t; I- `3 E1 K- T- char *dmabufsrc1 = NULL;+ G0 A5 e1 D' r2 ?8 e
- char *dmabufsrc2 = NULL;6 h; k3 x* e2 S- ]: ~1 i# \
- char *dmabufdest1 = NULL;
0 k6 t7 j4 W0 M% B- D1 L+ Q8 B - char *dmabufdest2 = NULL;& w3 N- N! V4 F+ d9 o
- 9 {: g, }4 X1 p5 y
- static int acnt = 512;1 l1 p! Q" y4 N, o
- static int bcnt = 8;& \! H& t3 ]" o I2 t4 r$ \; B/ P- b
- static int ccnt = 8;7 ^0 p& [& G! g% t2 Z
- * O9 X8 `! x6 `
- module_param(acnt, int, S_IRUGO);
$ I* Z4 l) H3 V1 n3 E8 }: ?% ` - module_param(bcnt, int, S_IRUGO);
6 h% ~' F( L7 V6 ]) K& C( P - module_param(ccnt, int, S_IRUGO);
复制代码
* A `4 i" }6 U8 \# `% _6 n
0 F' a! X: r5 s: ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 {( |7 ]9 a. m2 |1 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ m5 Y, W0 Z0 p4 ~! B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! q x, H4 z: J9 o$ t
3 r9 I# x: l- p6 }, D7 A. ^2 K: r8 I4 Z7 D
4 f6 V+ S! B( Y0 n |
|