|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
h: U, }/ g2 E- [code]EDMA sample test application
, k x0 _+ \, Z9 E) h) B4 a( b - /*4 x0 C# S! k& p2 l2 B* l* {
- * edma_test.c* C( d2 t" \) } g0 B: [! G: I
- *% W) O$ n& i7 _5 o$ P- N% R [
- * brief EDMA3 Test Application- U3 x8 G3 d6 q5 [& Y) ^
- *& r4 w ?6 }3 W) C5 v& |" k4 X5 \0 [
- * This file contains EDMA3 Test code.
( f0 ^* U! ~9 h/ r& k" t - *
i+ m ?4 L# J8 |4 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ G7 y' n' @, k* X. R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) e& \& B2 x) A/ Q% A2 R5 a& g/ } - * TO CHANGE.
. N; @! A( a% W+ ^+ `# o7 |8 G - *! f" w- o' c" G7 z N% V" j# M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ?0 B" k# T( r* x! ]/ q7 Y, Y/ f
- *
8 ^; B, d4 P) E1 p! S7 I - * This program is free software; you can redistribute it and/or: N8 C6 t' q2 y9 M, n. A7 d
- * modify it under the terms of the GNU General Public License as [) p! Q- U- m$ T
- * published by the Free Software Foundation version 2.
7 n3 [- @4 n7 n- e! y& e" A. J - */ @9 n" w' N2 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, \" U/ o" |6 ?4 f- a - * kind, whether express or implied; without even the implied warranty
) E$ l5 @3 y" D9 b: Q4 p1 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 K+ w7 z+ R+ I6 C$ d/ j
- * GNU General Public License for more details.
+ N! F. H4 I; W/ S - */
, m: y" o" s& v5 h1 H$ R/ ?+ l& A - 1 G7 V# a- i% C7 q5 f) [: m4 c
- #include <linux/module.h> ~% _/ z9 x# X8 G- {- F& {
- #include <linux/init.h>; U/ E% g! b+ n: J
- #include <linux/errno.h>
( ]' l6 o, ~& y4 Y U - #include <linux/types.h>
% x5 A) t3 B/ [6 q% O: o$ C - #include <linux/interrupt.h>$ Z% ~8 G1 L2 w: q, z) T
- #include <asm/io.h>2 g3 ^% s9 n: H* L; H
- #include <linux/moduleparam.h>) c" j, L" ]3 N- k0 R# e# \
- #include <linux/sysctl.h>. d3 r5 e0 N: V( x& d' w3 _5 G L, b
- #include <linux/mm.h>9 r) C9 i, n2 D# @% r
- #include <linux/dma-mapping.h>: I2 I% ? M: n, ]
v J1 j* I1 @4 n- #include <mach/memory.h>
9 G9 f3 p+ X+ @& x3 W; P - #include <mach/hardware.h>) f% t7 Z9 `+ s; A: n: p/ h
- #include <mach/irqs.h>4 @' s4 j8 D0 ]$ `
- #include <asm/hardware/edma.h>& `( D3 q& p" U
% b% \1 V- E/ ]% v& w- #undef EDMA3_DEBUG* N8 m8 T$ Y5 z+ @" E2 w7 B
- /*#define EDMA3_DEBUG*/
% r4 j- R0 v r* L, O) w6 V
V% Q7 X1 O* @8 J9 a7 R. f- #ifdef EDMA3_DEBUG& Z5 z8 n6 m% J* e2 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* w- y8 q F/ { b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 W1 O9 }/ r# Y! \$ K' A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 ]3 N4 s) N# l/ F% v9 S$ \/ a - #else, k1 V$ J, }, n; D
- #define DMA_PRINTK( x... )& e/ w7 r2 ?$ w
- #define DMA_FN_IN5 @+ M' f9 U' i7 i* m
- #define DMA_FN_OUT; `4 m: j) t! `7 y/ l6 L
- #endif2 H4 t& h+ v$ x, _+ n
1 T+ Z. N* q& [ @( o+ B( ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) t6 m! C7 |# K' I. }' U
- #define STATIC_SHIFT 3
% n x' r/ S# m; l! ` - #define TCINTEN_SHIFT 20
7 {7 K7 \& |& n6 k' X8 i) [. o - #define ITCINTEN_SHIFT 21
* f& Y6 E2 e' Q - #define TCCHEN_SHIFT 22
$ ~! \5 u+ I* E+ S - #define ITCCHEN_SHIFT 23
+ o! I4 c w1 [& u: G8 `( U. k5 { - 5 j. z0 S. f" V0 v D3 P
- static volatile int irqraised1 = 0;% o' d" B" U7 P2 l3 M- J
- static volatile int irqraised2 = 0;# W+ A. `6 i$ ]' [! D* b& P t
- c J) e: ]$ x* Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- |) q5 t/ v8 v7 R4 V; U( M+ A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" f% }& F t' ~4 d; d: w8 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y& V$ V9 [/ q; R' f8 A. D" W) b
- ; [9 ^$ u w; T
- dma_addr_t dmaphyssrc1 = 0;& c2 J) |3 f u, o$ k* }
- dma_addr_t dmaphyssrc2 = 0;
0 }6 i! J* F! D$ _; p6 B& `- q - dma_addr_t dmaphysdest1 = 0;9 [% v% _# t6 X u! @
- dma_addr_t dmaphysdest2 = 0;
' w& l" N# e/ a+ F# I! j8 _ - 8 v' s0 s; c- i" y: V1 x
- char *dmabufsrc1 = NULL;5 N: `7 E1 O# \ Z
- char *dmabufsrc2 = NULL;
! V1 g; C; w w/ D! c( l - char *dmabufdest1 = NULL;
. D# c! l1 L7 f4 O - char *dmabufdest2 = NULL;
y2 G7 Q/ \( M - 3 G6 r2 O/ {* g/ _3 W3 ~4 k' p4 C& L
- static int acnt = 512;
" ]( A; \% t3 X - static int bcnt = 8;, z: g1 ~5 Q, s, @6 D
- static int ccnt = 8;8 ^" I4 [! N4 O2 f3 z2 F
- 2 n- E$ B$ \) g" e0 K; D
- module_param(acnt, int, S_IRUGO);: g* h2 k! X0 U; p/ G
- module_param(bcnt, int, S_IRUGO); E. h( w5 d+ b9 O/ [+ |7 l: ^ n! ~
- module_param(ccnt, int, S_IRUGO);
复制代码
; m: d( K0 l/ _: H# I' V, [, O' |( W7 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# P2 m' V' M+ karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) j# |' z8 {& Q- b. W4 n2 d$ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
|& _8 s( t" B1 S
9 N- _( n7 A* v5 h1 Y% B6 ]* t( _* s" c7 U" h, }
|
|