|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! s, a6 ]- c4 e* m3 R$ ~, W) x- [code]EDMA sample test application( V4 q) k- e2 h% ~6 y w/ v8 X
- /*8 x' r- I) p k7 a# h
- * edma_test.c" E# g6 `" L7 o
- *3 V4 J2 w2 V1 `" ^7 B+ s
- * brief EDMA3 Test Application; {+ c) J0 q" {5 `6 R. }2 A
- */ d6 \/ ~4 ^$ f; c/ \' a1 X
- * This file contains EDMA3 Test code.
8 P: e5 O3 {) v/ { - * `7 U" h* Y6 z$ P7 i0 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( }+ t% j" B, t4 k8 k+ A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) E; d; i0 j/ m3 ^. T, c+ {$ k& v1 { - * TO CHANGE.
# d- a& V6 M+ w" K6 u - *7 |. q3 X+ P6 A w5 K8 r, g5 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# b* I5 G9 J, v u* V
- *
3 A- F+ k, c5 O& J - * This program is free software; you can redistribute it and/or: J9 s2 Z: C# {8 v
- * modify it under the terms of the GNU General Public License as
1 p2 }/ D* l3 n |5 k; S - * published by the Free Software Foundation version 2.7 W3 l% d; { v' P. L0 d
- *
0 P X1 z. ?, A0 j' {2 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 z3 j! W; t/ Y+ w7 X, V - * kind, whether express or implied; without even the implied warranty
( h- `& h0 y! m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 a1 N# a) j, `) C3 \# u% G - * GNU General Public License for more details.
; |4 B: ]7 M( g. o - *// `7 M! a7 ?5 h. b
- ' K: W' r- v& B" t% S' ?; F
- #include <linux/module.h># q& Y3 o7 r2 G7 u
- #include <linux/init.h>7 w8 q: u/ z1 F. q$ T0 w
- #include <linux/errno.h>2 |6 F$ j% D" ]3 r
- #include <linux/types.h>2 I( C6 F! h/ g' s1 V6 E
- #include <linux/interrupt.h>
4 o# c8 O8 I( O. z* t" Z$ l9 z - #include <asm/io.h>. `' a0 L4 m! H* @# g
- #include <linux/moduleparam.h>2 ~7 X! I, b6 z, d* ~% v5 y; J
- #include <linux/sysctl.h>
8 g/ ?7 D" x* v: Z/ H) Q, W2 A: Y1 V- H! ? - #include <linux/mm.h>5 W* Z/ S6 u/ n2 A- E
- #include <linux/dma-mapping.h>
( r! C2 y' M+ ?% D. _! F - : V. d9 w+ @1 ^& i: n9 x6 ?
- #include <mach/memory.h>3 P2 V3 N% w4 S0 k2 k: V7 V3 j, r0 x
- #include <mach/hardware.h>9 u1 ?$ |# \- C& ^% U9 d0 X, K! R
- #include <mach/irqs.h>
, _9 F+ Y; y& z2 g) l# A - #include <asm/hardware/edma.h>, D y" c: M: Y0 v2 b
- 2 \4 I7 n* u. N0 W
- #undef EDMA3_DEBUG
( Y% a1 Q: L4 f) q+ ^- t - /*#define EDMA3_DEBUG*/+ Q$ ~( m6 ^6 R. E
- ( f( L9 o/ `3 T. D/ n
- #ifdef EDMA3_DEBUG
0 U2 A( S: j( R2 D7 g. ]4 j+ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 ]- E0 v: A8 M- U) b' v X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 U; B2 }* T, }! b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; E8 X9 g: j5 l - #else
9 |/ J) U! g" z* C' T( Z( a - #define DMA_PRINTK( x... )
) w3 j& |2 [( I" J3 S6 Q - #define DMA_FN_IN& x) l! o6 |4 X8 e, B7 X
- #define DMA_FN_OUT' O$ Z6 {& @3 X
- #endif
2 Q; h; w& `0 |+ c" D
. `. u: V' Q: f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" O {& [7 ` j* e - #define STATIC_SHIFT 3
7 c2 U6 i* Y- j/ U( ]0 e6 O - #define TCINTEN_SHIFT 20
7 |; {* l2 a3 k$ G* M - #define ITCINTEN_SHIFT 21
0 H; H: Y- h0 c4 {8 I, h - #define TCCHEN_SHIFT 22
9 w1 V) X9 \5 l0 G6 ~/ | - #define ITCCHEN_SHIFT 23
9 s, O* O; }/ X* p; v1 R a5 X
/ F+ ^4 _2 f" b. y- ?$ M! y- static volatile int irqraised1 = 0;
9 f0 M+ V6 ~% z+ N+ P+ Z - static volatile int irqraised2 = 0;2 ]! W W, R1 O
- $ \ e7 @* L, n" r; v8 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h( z- X8 O3 P$ x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C% `# E9 ^$ s* @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 l G8 @ d5 r- N, M - + ^" N( M3 V2 Q p3 Z+ K
- dma_addr_t dmaphyssrc1 = 0;7 K( T1 k4 g% z( k' z3 V9 Y2 @8 t
- dma_addr_t dmaphyssrc2 = 0;$ r6 Q6 X: R* g( I! `$ s7 D
- dma_addr_t dmaphysdest1 = 0;: W& K- _' l4 |5 h: F+ A
- dma_addr_t dmaphysdest2 = 0;
9 q7 U/ h7 Y) O0 O* K
0 M2 j3 b. @- m* y0 h- char *dmabufsrc1 = NULL;
. A8 ] z5 _+ f4 x$ U - char *dmabufsrc2 = NULL;
) `; D2 u% j6 a8 ~ - char *dmabufdest1 = NULL;
2 }) Q0 @4 c* }* J, T4 @6 W6 l9 o - char *dmabufdest2 = NULL;5 t. ]$ d! C! c1 K( u
3 {4 y: p: z9 G9 W/ ^5 `' m- static int acnt = 512;% @4 r1 B; D9 e
- static int bcnt = 8;- y \. }6 Z3 `& E
- static int ccnt = 8;% a9 S& g% F& M* M3 Z* ?
- : J' O: q( z! I/ [
- module_param(acnt, int, S_IRUGO);% Y" u- ~1 p1 f% r! S5 I; I2 W
- module_param(bcnt, int, S_IRUGO);& G, c* n3 u6 U8 m4 C
- module_param(ccnt, int, S_IRUGO);
复制代码
0 G b$ t; ^3 X2 \1 f. E6 L. F% r3 P. u% E: f/ m5 x2 s' B# ~/ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ R2 d2 f1 F! Q7 L$ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; b3 t% e! O5 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F7 I7 H" x! U/ y: n! W8 {" ]
- T5 a0 I7 S) Q. U# m7 C2 L
3 N: i0 ~" g$ k p; C4 b- b
|
|