|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o2 F* N, K7 W0 i" `3 g. x+ `- [code]EDMA sample test application. O* v1 v8 J# J+ |# S) P/ x
- /*
/ ^+ r- i5 p6 b$ b0 B - * edma_test.c& t+ A4 t8 j2 `8 e7 z2 P' ~
- *# {" k& D3 w7 n
- * brief EDMA3 Test Application
& m( c5 J! V, G, k- ]3 a2 N- i( { - *
/ ]3 v( B& R+ W/ b0 r - * This file contains EDMA3 Test code.( ^) R: ~( d* ^
- *
- g& G' t' n6 z1 ~6 f' g9 x A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! }4 m7 n# O( y% u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b2 N% b# M9 f+ ?9 J$ N5 \: Y" C
- * TO CHANGE.
9 b" X7 }' q0 b( J - *
; W2 q4 i5 l- A: q: v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 A4 G4 P+ K; y* ] - *3 Z; c& o t. {, V
- * This program is free software; you can redistribute it and/or
" C: u( I. A0 ]8 E. o8 T9 w$ I+ L, z. P - * modify it under the terms of the GNU General Public License as
$ E) q# f0 @9 n! t4 U) t - * published by the Free Software Foundation version 2.6 @ F) |8 P) G1 [
- *
) W/ \, y# z) z% A8 t5 A# P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 a) Y+ s/ @4 _& S: Z9 v - * kind, whether express or implied; without even the implied warranty5 u$ j+ m" e! Z p8 m; Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 }5 n% n" p5 [3 U1 ` - * GNU General Public License for more details., Y7 o" l/ }# j2 |2 Z
- */- T& ^3 z0 [5 ?# M- |) G
[0 u( m: M) s/ K7 V- #include <linux/module.h>
* m; y) I8 o: ?% X) y' Y - #include <linux/init.h>
* @+ [# h# b( [! U! } - #include <linux/errno.h>
' l2 V( W- q- z! W - #include <linux/types.h>2 ^5 c9 n/ O' O1 c7 E" H, E
- #include <linux/interrupt.h>
9 K: {" A% |! K - #include <asm/io.h> R4 U; W, V) Y2 d- N7 h
- #include <linux/moduleparam.h>6 I1 ?7 i6 }6 G; W
- #include <linux/sysctl.h>
% s) m3 |" s$ p1 J# { - #include <linux/mm.h>
7 b& ?* a) C7 w - #include <linux/dma-mapping.h>' g" L* ^# m0 e' u
+ A1 p/ l) n$ k2 x- #include <mach/memory.h>
: P6 U# |/ q2 N( `2 M - #include <mach/hardware.h>6 E) y0 w9 _ n q1 V5 J
- #include <mach/irqs.h>
! @7 c# n. P2 E7 ~7 { - #include <asm/hardware/edma.h>
4 d4 {& X6 B+ j4 w/ A+ `! f0 F' g" O
; F5 Z D! Z6 B: m/ L& }+ H" n- #undef EDMA3_DEBUG9 x: f5 T U# h9 [2 ?7 o
- /*#define EDMA3_DEBUG*/; h" z6 r+ \! B
! c: [! T+ `& B+ z5 [% r- #ifdef EDMA3_DEBUG
& P. Z$ Y2 f/ k: s9 J- Y4 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 C9 A) a$ R2 o$ K, t" y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 U$ Z- p" C3 H8 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- b: J/ i' {+ x5 c! F - #else9 J3 a- w" d6 U3 I, m. n
- #define DMA_PRINTK( x... )1 Q- b% b* V7 |6 U5 u# e2 f: z
- #define DMA_FN_IN
& z0 @0 k) N; j& J- c - #define DMA_FN_OUT1 E- i& n& P8 w1 g- _/ X4 v
- #endif
0 R F* v, }$ F - 3 P, q& n7 Y3 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' Q! R- i0 G0 S$ X - #define STATIC_SHIFT 3
' ]7 B; H: x8 m: z - #define TCINTEN_SHIFT 20
6 F2 b0 `# o( X! D7 q - #define ITCINTEN_SHIFT 21
) q T1 x" M/ T% U0 E - #define TCCHEN_SHIFT 22
0 |0 v0 {% P9 U( b% b( h - #define ITCCHEN_SHIFT 23
6 [2 r4 m ?8 Z1 G6 [/ Y+ T% ]8 y
+ N2 s: Q$ N8 B5 S- static volatile int irqraised1 = 0;
" {; w7 F9 x6 I; f; x: M9 y - static volatile int irqraised2 = 0;2 Y5 l( S' p6 c1 Z5 J/ c! e
- , C0 U/ m: i a0 X, P& ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A( @% _1 i; A' {% ^4 D* ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R$ n* o6 s0 w6 w* h! k; F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 u, d! }* s* m# j
: F" V* Y \ I6 _- dma_addr_t dmaphyssrc1 = 0;$ S" i/ f: o! J3 j; b( z& f
- dma_addr_t dmaphyssrc2 = 0;
* R: B: T6 I: ]% ~ \! |; d+ y - dma_addr_t dmaphysdest1 = 0;/ L3 Y6 q# ^2 U/ \4 _+ y& T3 ~
- dma_addr_t dmaphysdest2 = 0;
7 x/ _/ \9 u: g7 _! } - 1 Z3 n6 @2 O5 h
- char *dmabufsrc1 = NULL;
9 e, \" ]* X- |% @9 c0 y - char *dmabufsrc2 = NULL;
- [& D% a& B0 o4 c - char *dmabufdest1 = NULL;. U& ^5 Q" V P8 f
- char *dmabufdest2 = NULL;/ P$ K8 U- X' K3 ]+ w4 q
) K/ l3 Q( `: \2 d- static int acnt = 512;
9 R4 N& {2 k5 d - static int bcnt = 8;: L5 b7 M6 ^* A" @# A2 A. P% l
- static int ccnt = 8;
2 ]7 p: k8 O/ Q( a8 q1 z
' w5 E. ^. ]' D K; y0 ]6 ^- module_param(acnt, int, S_IRUGO);
3 V; _: G- f' q$ t7 p! |# G - module_param(bcnt, int, S_IRUGO);
; b- d! O1 L# P8 h8 X! x8 s - module_param(ccnt, int, S_IRUGO);
复制代码 - @: ~: u% b) K* V
: S4 C5 ]& r7 I& A- O% V& k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 w# M6 b3 |+ T. g Q- \5 ^2 z) F% D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' i0 n# e0 d3 T: w; w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' |: S9 |3 U% w( Q+ q, E( ^
( w) S! U/ H5 D" `. }# _( J, s2 d% }0 E. X5 Y' Z
|
|