|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b( t- c( l2 G! z" X" u6 s* O2 h. M
- [code]EDMA sample test application
; M9 k1 `) S w8 Z+ p - /*; s! n/ ], p+ w0 r5 D) _4 n
- * edma_test.c) w' A5 Q2 G# j: _
- *
5 t w- C" J+ U" i1 b) d - * brief EDMA3 Test Application
/ u& S# J. T# |, w9 p - *
# l+ k3 N3 L& m/ {' r - * This file contains EDMA3 Test code.. u8 K7 M2 I5 F+ [" M1 g g
- *' e) f! `; `3 s: n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) L% V* k' g* d) W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( o9 W0 H. A" e( d' `# t+ b# w - * TO CHANGE.
2 r# u* U% U# q. i - ** N& @) ?3 d$ J. ^5 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ S: u1 E3 c( N+ U h - *
# |' [2 W6 H& ? - * This program is free software; you can redistribute it and/or! o N ~ a# h& V
- * modify it under the terms of the GNU General Public License as$ q5 [: X* Y4 j7 n7 J7 X
- * published by the Free Software Foundation version 2.
& U1 b B; x! o3 t$ e - *5 A! `6 Y- z0 S+ U/ U* m1 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" F: f% s/ N! u+ C! L4 v$ _0 D9 K
- * kind, whether express or implied; without even the implied warranty0 @: ~2 e, r; [+ ]& ~1 k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; N% m7 b: c/ B7 f2 h; H } - * GNU General Public License for more details.3 _5 ~: E+ C; @8 t5 r' P0 r3 B" b
- */
. I" C( c0 T W: k% `5 {4 ?: Z - . ]& k: b# `" c& o
- #include <linux/module.h>
/ ]& @3 U! f, p - #include <linux/init.h>
0 K: J4 {6 a, q6 o; V/ c - #include <linux/errno.h>
1 X8 F6 `6 L: I8 l& r/ L - #include <linux/types.h>3 J7 b1 G/ G/ C+ `5 H4 F) [9 z
- #include <linux/interrupt.h>
) T5 C4 _$ e9 j- v3 m5 e - #include <asm/io.h>9 Z S: r2 f! g8 i; R2 Z) M& a
- #include <linux/moduleparam.h>
/ `2 y9 L& Y0 m - #include <linux/sysctl.h>& {+ s4 e" @3 d5 E
- #include <linux/mm.h>; }2 E6 a: u" I# A/ V
- #include <linux/dma-mapping.h>: l! q: e0 t" [0 i+ a' a( A0 E
; P9 B! B6 G9 C# t6 F- #include <mach/memory.h>- i. X4 ?& r( {3 K
- #include <mach/hardware.h>
3 r* ^$ g+ X$ Y) n, f4 r& ~3 z - #include <mach/irqs.h>
/ W; E# Q- r d$ L% z - #include <asm/hardware/edma.h>. {2 C4 Z2 X% a6 m, n
% s6 q* s1 M+ k! b h* j' `- #undef EDMA3_DEBUG
6 L, M$ C4 j, a0 l2 z6 ^/ O: K. l4 F& H - /*#define EDMA3_DEBUG*/
( S6 A0 w" e. p. d# {5 I: ` - 2 C7 [5 S1 `) m/ _
- #ifdef EDMA3_DEBUG
9 m+ y) G& e N& T& ]0 `, m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! r8 |& R( G `6 z& c$ B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 A; j5 f; @$ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); K. L8 l: q. _$ K7 N% [. n
- #else6 j8 R- r. l9 R
- #define DMA_PRINTK( x... )0 L% ?' Z5 T# t! Y
- #define DMA_FN_IN/ _( h# C# `$ a+ a% i$ ]
- #define DMA_FN_OUT2 M% }0 G: ]' l
- #endif
3 y' y3 e3 H, n0 H5 T, e - : G1 h5 }, U0 s& j* e1 k" O8 ?: H, a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 J9 n# ~3 ~& n3 q; r9 f - #define STATIC_SHIFT 3* G6 a- C$ _ A' _6 V. W5 {
- #define TCINTEN_SHIFT 20
) f6 \$ ?3 H) u0 Z) V8 d% X F - #define ITCINTEN_SHIFT 21
! Z( W6 o2 U/ D - #define TCCHEN_SHIFT 22& z6 ?! w, c# q @! G9 m$ W
- #define ITCCHEN_SHIFT 23
, x2 R8 o, i& T" H! n. e - ( C7 W% M( {! \9 A
- static volatile int irqraised1 = 0;
. }$ W- i* h% c+ J% b - static volatile int irqraised2 = 0;/ K0 Q- J* ~) P, K
- 2 P) H- N* ^ [4 _7 X9 Y( Y7 k5 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [! O- ~9 z* |4 r( [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u: j5 X$ l% w% u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" i1 q$ |- V7 H" F
6 y/ a) |1 Z1 u! V( q3 u/ A( `- dma_addr_t dmaphyssrc1 = 0;
% ^7 ?. c/ M9 K* v- R2 s7 ~ - dma_addr_t dmaphyssrc2 = 0;
( n# s) c9 c: B4 E% U - dma_addr_t dmaphysdest1 = 0; V; S+ e4 c$ [, O
- dma_addr_t dmaphysdest2 = 0;
% }4 A7 I% R8 M: F5 o& ^/ a - 9 v( A& h7 T& J- i! Z
- char *dmabufsrc1 = NULL;
8 T$ [4 a7 a, {2 M0 } - char *dmabufsrc2 = NULL;
3 o' O2 v# F3 C4 I* m - char *dmabufdest1 = NULL;1 E3 |1 O3 ~% y: a' D- j
- char *dmabufdest2 = NULL;, c% C3 S# v+ b! _3 w
- / k) B* V0 @7 L$ M% g
- static int acnt = 512;% w. j8 s+ a9 y8 Q9 O+ H
- static int bcnt = 8;3 b/ ^+ A7 f/ [3 [8 G6 m: l. |! L+ {
- static int ccnt = 8;
8 ]! i: K! \& w/ Z; s8 [
+ Z; c! X3 N4 ?9 @: Z5 L& j- module_param(acnt, int, S_IRUGO);
% s2 v" i R6 |% y' R1 b* A4 q - module_param(bcnt, int, S_IRUGO);3 w( p q$ i6 c
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ~. ?" f9 u( t8 }& Z% f0 j5 W9 ]" H& {0 m6 l Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ p$ l; |4 O: x) Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 R# H3 s) s9 o/ ^6 R) I4 ~: S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
B7 |9 u4 ]6 T$ X' T& x% { h0 J/ q: a& z
" Z' l* v2 [4 o- q; {$ X5 Q
|
|