|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( @5 h0 a) J, S+ V- [code]EDMA sample test application) I& D0 J1 l9 h: I6 l
- /*3 d* H7 z/ o; `7 K3 Y
- * edma_test.c
6 @4 Y3 \4 P. V$ ^- L- H - *7 t, ^# Y, o0 E1 A
- * brief EDMA3 Test Application% m2 p" t9 H! d9 m7 ~1 y% ]
- *
7 M2 G1 j- L0 D5 j - * This file contains EDMA3 Test code.6 B/ m' j5 _. p& f7 Y# f
- *: P, `2 N4 U4 _1 R+ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O Y; C3 S: ?! |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v# C/ v) V5 \) ^+ F" Y
- * TO CHANGE.
3 b" j: H* B7 y: v5 E9 u3 p3 c0 J - *
" I" u# u' u" x/ p4 G6 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 C$ o* R/ d% @/ G
- *5 P8 k/ B# d: V# V6 Z
- * This program is free software; you can redistribute it and/or
g8 h- X9 z# y4 @' ^; | - * modify it under the terms of the GNU General Public License as9 f, }/ b; g1 i; {
- * published by the Free Software Foundation version 2.. }- y, O0 p5 {& j; c5 b
- *
' t8 o% @+ k" E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 N6 C1 I# M; j2 h1 f2 q) ?. L - * kind, whether express or implied; without even the implied warranty
4 n' N+ M8 f: E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. n" d- O- ?# N- s
- * GNU General Public License for more details., ?+ }( j6 b4 J
- *// y7 c; C$ Q' f3 z+ R
- ; r4 X }* J' a- `! K
- #include <linux/module.h>
4 V5 s; I( `7 T! T6 w1 T1 { - #include <linux/init.h>
7 K" V9 }! G4 e# ?7 r - #include <linux/errno.h>
# y: ~" K! G* d* \, A- l% _ - #include <linux/types.h>
8 \5 ~; ~) i! y0 V" Z7 \ - #include <linux/interrupt.h>; Q q T W( q/ |9 j |
- #include <asm/io.h>' _& k6 o9 M2 n( V" L
- #include <linux/moduleparam.h>7 V6 P4 z/ R0 N- H+ O+ `; q4 s
- #include <linux/sysctl.h>7 ?3 N" ]! r1 W" n2 d
- #include <linux/mm.h>
' K8 X0 _7 F" T; @! h - #include <linux/dma-mapping.h>
" j. X. z& F1 S& C/ J - + p3 I) P$ J$ B7 d8 m! r
- #include <mach/memory.h>5 C+ s3 w* n2 o% x
- #include <mach/hardware.h>
& p g) j. c1 W5 [ - #include <mach/irqs.h>8 o% _6 Z3 q6 d* ]
- #include <asm/hardware/edma.h>" k1 t! F, f' F& J# y! \
0 \+ I, K# M% w1 {+ }: r' q- #undef EDMA3_DEBUG
G' f: j, s) G9 G9 b - /*#define EDMA3_DEBUG*/% x. Z& Z( Z( Z* T( g6 t9 [( o
- K: L- M) p* q- #ifdef EDMA3_DEBUG
- i2 h' e' P$ `$ \) L0 K+ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 J6 l% c( v5 \. A& _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 v- M1 u5 f5 y; [6 u6 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% L1 H6 t. q0 B9 }7 T h& ?) q% M
- #else
7 q, Y) N3 |+ X# s+ Z2 s0 T. q5 G2 i - #define DMA_PRINTK( x... )
* k+ w6 E4 V) a - #define DMA_FN_IN
R v5 @3 H1 q5 r& ] - #define DMA_FN_OUT
3 i; T2 k& a7 C: g: ]% b - #endif$ `4 E! \- V7 ]9 m( V
8 D5 J. m5 t; B) ?2 L3 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 q2 F9 {" b+ l! H6 A8 z* B- \9 R, a
- #define STATIC_SHIFT 3
; J( T! X* u3 i( y; l - #define TCINTEN_SHIFT 20
/ T$ W; }3 \3 ^5 |( C j# u, N - #define ITCINTEN_SHIFT 21; w: x6 O7 @6 ^* L) K6 a o1 ~: |: Q
- #define TCCHEN_SHIFT 227 ]% T. V ^% S( B- m5 _
- #define ITCCHEN_SHIFT 23
$ L9 w8 q$ v5 F2 J: h! L" z2 r
, J1 T1 V1 \9 K# Q: Y; N- static volatile int irqraised1 = 0;
+ T3 ]+ i/ ^5 K, M# N3 n6 V - static volatile int irqraised2 = 0;2 [8 E [( p$ d
8 c# {# ~) u0 ^! _/ g# U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, r0 s+ Z) |$ m; h4 y6 N2 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T+ y( e* \% x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- M, E! a. r5 W
9 d6 j8 W0 T& Y2 J, l& K+ ]: O- dma_addr_t dmaphyssrc1 = 0;( w. ~0 U8 { H6 d6 M7 P# v
- dma_addr_t dmaphyssrc2 = 0;1 g, q" ]) x- S% W# [" k. ^4 w" S
- dma_addr_t dmaphysdest1 = 0;
: f( S: j& M/ N9 }. |3 I6 y - dma_addr_t dmaphysdest2 = 0;
) t+ O$ C# \+ W: }* o+ m* Z
* y9 w; W$ V, A9 v. F# G- char *dmabufsrc1 = NULL;) S9 ~. e$ _+ u4 H7 y' s: o! {
- char *dmabufsrc2 = NULL;& u2 D+ [4 z+ C9 v! V; a6 O' q+ i
- char *dmabufdest1 = NULL;
1 j5 W! ` N* t1 `6 M - char *dmabufdest2 = NULL;( e# Z+ e* Q0 e
- 1 N& N! Y" X/ t8 R9 Z6 b1 \
- static int acnt = 512;9 _( B7 [! I8 m5 x% D
- static int bcnt = 8;
' M$ A" |& r9 a/ c/ p, ? - static int ccnt = 8;; G8 I; E3 p$ _
- * c1 L, c% d" y; j9 @
- module_param(acnt, int, S_IRUGO);" z" l4 `- a6 t* w) L/ E4 e) ~$ n
- module_param(bcnt, int, S_IRUGO);
$ q1 H& i5 o5 E8 K1 B4 o - module_param(ccnt, int, S_IRUGO);
复制代码 . ?; B6 U) I$ ?+ G3 j: C; q) D' Y
& V) s" q" M5 Z" U# C8 J" X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Y9 u* r# y+ r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u& j; w, o# o; _+ i/ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( y2 E! j; T4 g% N! J$ d% n( Z- b( s0 ^5 t1 U4 O
- y/ |9 Z; b4 ^1 ]. ]3 ?3 V/ E' n |
|