|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b9 D2 v" |% X- [code]EDMA sample test application
5 `2 @$ ]3 y6 b1 T9 E - /*3 O9 j2 \$ `9 ` t+ }" z1 S
- * edma_test.c) J4 f& t8 f' g4 @/ n; x
- *
, Q8 Q6 W( e' _ - * brief EDMA3 Test Application
; L4 y2 u ?3 ]" u# D6 p, ` - *$ P( `- A' A3 d/ c
- * This file contains EDMA3 Test code.
) D2 @1 C9 I! y$ ] - *, f k8 i- O1 I+ I# }7 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a! ]4 |" S/ Q, u8 ]# B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 o6 z+ K: k* I
- * TO CHANGE.
0 L' p- z0 J2 \- Y7 L% i, Q - *
! a' K+ r0 X ?$ T6 ]! m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& |7 d) ^4 Z8 K: @ v - *
* a* w; C# C" y: m, O- t: E; F - * This program is free software; you can redistribute it and/or/ ?8 e* C% X$ f( A) x* } y
- * modify it under the terms of the GNU General Public License as1 ^/ b9 n; h4 l/ z* j
- * published by the Free Software Foundation version 2.
1 Y9 p% R. T1 V - *
' \2 X2 E& [; x E4 \+ X/ _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; j) E1 M* G. N6 n" v, I+ c# ]+ a- | G
- * kind, whether express or implied; without even the implied warranty- u' X( u2 k8 U8 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 M( U, p8 B* ?+ f/ Z
- * GNU General Public License for more details./ G9 |: ]# v1 B2 x$ |
- */
3 i9 M# z, {& M. f w8 t9 u
' ?7 [6 \; t2 Z. s- #include <linux/module.h>
' r y2 q* {5 x7 B+ O# x - #include <linux/init.h>8 G5 s% v/ x; d$ Q1 |( i
- #include <linux/errno.h># ]* d3 V# h( V$ X# r) H
- #include <linux/types.h>
& t, R. {0 R8 a, v. o+ z - #include <linux/interrupt.h>
8 i* C2 N, L5 j5 H6 Y8 W9 ]3 U! f" V - #include <asm/io.h>
3 `; x$ P) H. f - #include <linux/moduleparam.h>
# f2 e! }, e4 D7 n* O0 C - #include <linux/sysctl.h>
7 E3 ^$ `) a% O - #include <linux/mm.h>- M& B) W1 p1 i `
- #include <linux/dma-mapping.h>
6 P% u, g+ S" }( d - ! B W6 r! W" @1 P
- #include <mach/memory.h>' w! f/ H7 L! e3 Y2 `6 R( r
- #include <mach/hardware.h>5 ?' Y' W0 _0 `4 U
- #include <mach/irqs.h>
. R+ O0 Z9 t; V4 V: G' @6 T% \- E - #include <asm/hardware/edma.h>6 |9 x) o7 d3 N
- S7 g, h* P5 D/ i( @7 ~, r
- #undef EDMA3_DEBUG
) o$ Z: Q; I. p" l7 L4 M+ O - /*#define EDMA3_DEBUG*/, u: e) v! P+ i4 I- _
) p" n) k- M6 D- #ifdef EDMA3_DEBUG0 t9 v$ N" Z- Q! c7 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
Q5 k. z' N% L2 Z4 _5 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A1 m/ O4 ]) p& _/ q+ B, s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Q7 n+ A" C1 ]2 v
- #else
! f( D) O8 }& a7 D7 J4 R - #define DMA_PRINTK( x... ) B: R" k/ Q) p# {
- #define DMA_FN_IN
8 c$ V+ f. A3 g - #define DMA_FN_OUT" x. Y5 t. v9 e$ S& t
- #endif
7 r( p' q: H6 w3 P0 F7 p% ] - 4 a# o+ q/ R N; i- X" [4 q, Y$ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 A; }8 K- g; Y/ A - #define STATIC_SHIFT 3
1 E2 z( f0 o! l* Q! d: j& ~5 B0 j - #define TCINTEN_SHIFT 20
8 r- F3 j$ k. O1 X - #define ITCINTEN_SHIFT 21. G8 e/ A3 I: o) i# K- L5 h2 K/ W6 a
- #define TCCHEN_SHIFT 221 l( n# u; }& p/ ?" d! Y
- #define ITCCHEN_SHIFT 23
8 f2 W! j) n- V - ' y7 Y& {' z8 g! Z* }; U/ t
- static volatile int irqraised1 = 0;( H. C, i* b; p5 a& l
- static volatile int irqraised2 = 0;
2 q, n9 ~0 i N; s0 Q/ R - , A& e7 s% n2 g: n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 }# h/ K4 L: i" l% C- T9 f- v% s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s) ~) K& u0 [% A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q1 {: }1 p. v+ \! L/ `4 E
* @7 H: w. m B. H- dma_addr_t dmaphyssrc1 = 0;
- f- k1 N/ o% W& S0 B3 c) _ - dma_addr_t dmaphyssrc2 = 0;. K1 I8 @6 [& q* d: B0 K
- dma_addr_t dmaphysdest1 = 0;
- Y" s0 V4 l* i( \4 U% c - dma_addr_t dmaphysdest2 = 0;% k0 n {% g4 y: k7 R
: N2 R. s( b: m% Z) |- char *dmabufsrc1 = NULL;8 ?; W# K! A8 B- q! i( f$ L6 N
- char *dmabufsrc2 = NULL;' u: H, ]! Z$ |4 c, a6 s8 C5 h4 S
- char *dmabufdest1 = NULL;
! \2 Q) F1 c0 {: D; Q. S7 o) u - char *dmabufdest2 = NULL;" t2 a0 a: J0 D4 ~6 ~
- $ j, e( d/ V$ ~4 a5 \' t; w
- static int acnt = 512;
1 T' N) \( x( `2 a) r - static int bcnt = 8;. p# d' h: O3 h* r
- static int ccnt = 8;, y k" |6 P! ~: }
5 t. W: o5 [; J9 L3 P0 p- module_param(acnt, int, S_IRUGO);( V0 Y9 L' ~5 x7 h
- module_param(bcnt, int, S_IRUGO);
+ ?1 V& r# \ Y, ?/ }+ D1 n - module_param(ccnt, int, S_IRUGO);
复制代码
3 e: Q9 U, g6 D% R! ]; T
( R$ m: V. g% v9 B" Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ]5 L# b% ?3 y3 ]- A% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! {+ {0 f. b! P) W! c _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \+ q w0 \+ \' I. w- ]+ |) X- s) }& T5 p: f" \# L& a
; A1 m. ~+ @: G |
|