|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M% t# q! t% x" u* S r
- [code]EDMA sample test application
/ {2 K, G/ O- ~ - /*
* ^3 q5 I% Z, Y* G9 {% z" l$ | - * edma_test.c
* |% }* C9 R& K% | f( m* U2 y - *
, _( Q u( e" o* a - * brief EDMA3 Test Application+ s$ t- b5 z, j0 m6 W
- *
1 `# a2 r, p2 V" X - * This file contains EDMA3 Test code.
. [2 p$ ~% Y6 ?4 y4 ~" I - *
7 A& F; i3 [$ H* a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& K) C- u: k, e4 ^2 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! q$ @! n+ G8 _" J$ \) d. N7 ~ - * TO CHANGE.
1 e' J8 K& e# p* J - */ {$ \# K. T4 [6 n& h z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) O9 J1 e% ` k/ d8 A0 c' ^/ c
- *: [' Y1 Y/ q/ |) h& P" r5 D: V% n
- * This program is free software; you can redistribute it and/or4 d0 }3 E5 H+ X2 D: K5 | p
- * modify it under the terms of the GNU General Public License as
. z& d0 n0 U9 h9 V g) y# P - * published by the Free Software Foundation version 2. X1 a: V: [% Z& E
- *' M3 G1 y6 q& ^3 T: t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any _# B0 O( U% I- l6 \4 v) ]0 X
- * kind, whether express or implied; without even the implied warranty* w1 Q/ ?, F: z# l2 F9 W7 K* D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 E3 k+ F6 [7 c6 W! |! h
- * GNU General Public License for more details.
+ S- S/ D; `0 V. J4 a# g - */
8 J# S" U2 }9 k B% x! E - : k7 J8 D" b6 i# g! x3 V& ~( P7 e
- #include <linux/module.h># ?& U2 j% `6 i
- #include <linux/init.h>+ w" @& H4 N- C9 p. u
- #include <linux/errno.h>9 y& w) K" t$ t m
- #include <linux/types.h>3 t+ |6 b7 T9 Q: s$ l. ^3 m
- #include <linux/interrupt.h>' d( S, C# g) r
- #include <asm/io.h>6 K% o1 B, G" G
- #include <linux/moduleparam.h>
' R; P" J( \5 r" T. x8 j - #include <linux/sysctl.h>* o2 M1 V. d9 g' S, M1 r
- #include <linux/mm.h>
, }4 p/ A6 x9 T$ M: p, H - #include <linux/dma-mapping.h>
% T: m& u* F+ k- q" T - * ?; ^ x* |9 [
- #include <mach/memory.h>1 B0 H* J% w' D0 Y1 v; m
- #include <mach/hardware.h>
% X0 Y; M. ~. o9 T" i - #include <mach/irqs.h>
$ c0 _) {! V! A* ? - #include <asm/hardware/edma.h>
$ s1 |! J7 r7 U0 h' c - 1 p# `/ W \9 a
- #undef EDMA3_DEBUG) s$ C6 S9 q3 X) P! ?
- /*#define EDMA3_DEBUG*/
- Y- p, b; F0 b) {5 t! n/ _ - & R9 o4 P1 |, T, d$ z
- #ifdef EDMA3_DEBUG
! ]) o# D0 M1 `/ N0 u4 U. d: H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 E+ B+ w" r/ t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! x3 @$ s9 e6 P2 X' r) K2 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% F+ T1 s7 i* Y& f7 l8 ^* N
- #else
9 O2 u3 m* d: L# h0 ] - #define DMA_PRINTK( x... )
/ l3 T/ K- a2 q3 U6 \4 P# m) n/ X7 h - #define DMA_FN_IN! _! t! ?2 k" Z f( N
- #define DMA_FN_OUT
& O# h/ H6 X: ?% b, a8 b! } - #endif6 v; G; H* F# ~* u4 @ v
- " n, b1 P! Q& F( f8 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 Y8 o% J' N$ K3 _
- #define STATIC_SHIFT 3
; o/ O0 ~+ A8 W - #define TCINTEN_SHIFT 20% _+ P2 ^& Z2 ?0 ?. d: u, O# ]7 G
- #define ITCINTEN_SHIFT 21- [) m- H' E& V6 }1 C1 G- v# T! V
- #define TCCHEN_SHIFT 225 b, g4 k; ]" ~5 }% `
- #define ITCCHEN_SHIFT 23
* m* h0 c; g$ k' N- }
3 R N3 E2 Y! f- static volatile int irqraised1 = 0;2 r8 `1 j) K: x# Z) P6 D4 s
- static volatile int irqraised2 = 0;
* D9 O" \: j% H# a - ) B( p( i8 R- x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( g6 b5 a% B9 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T3 f% w5 y, s2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I( I+ U& b. Z. ?! E, m
( r/ k2 @1 Q1 F; V3 c' W5 Q- dma_addr_t dmaphyssrc1 = 0;( l7 P1 _7 O; A: V1 q9 ]( h
- dma_addr_t dmaphyssrc2 = 0;
6 R8 [1 d6 d, R4 W, V* U8 ~9 n - dma_addr_t dmaphysdest1 = 0;- \/ P$ @/ l" Y- `( d: b
- dma_addr_t dmaphysdest2 = 0;
2 j& {/ a, l7 U/ e6 |+ r2 e
5 B; ?2 X6 c7 z! z- char *dmabufsrc1 = NULL;
- l! m) Y* F, l' R2 b4 t( c - char *dmabufsrc2 = NULL;, d* n; Q7 u: Y8 l1 F1 T
- char *dmabufdest1 = NULL;4 ~7 P Y- O9 b8 G% H
- char *dmabufdest2 = NULL;
- H/ \- }) B) i7 f: Q7 u+ E
$ ?- [: ~# f- I- static int acnt = 512;
9 Q/ k2 \& e W9 Z/ S- M0 a - static int bcnt = 8;0 O& X5 n% T. D! S' j9 A- `* K0 r+ E% r
- static int ccnt = 8;
) D. N8 l6 [; z
7 H& Y6 Q& j3 i0 y# u6 h4 [- module_param(acnt, int, S_IRUGO);
# V8 O! w9 J9 {5 ?- m7 F! @ - module_param(bcnt, int, S_IRUGO);
0 P9 d2 e% S+ S9 Q - module_param(ccnt, int, S_IRUGO);
复制代码 7 {) S4 g+ B1 E* [
3 [# f5 K5 H0 W0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# l, U( l3 u. \6 O1 ^. p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H3 e8 a6 u6 ~/ O, [& o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 h( w- ]- S2 ^+ x- c+ I# s" e) |- u7 ^- ~
, ?( z; S. h4 u+ k- f' n4 |4 H
|
|