|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 c# i& z4 u x( R7 i! g& g, t1 N- [code]EDMA sample test application% g6 q5 A* H# C4 t3 T; [8 t
- /*8 e+ x0 a& \) l3 g3 _& a
- * edma_test.c
! P7 P+ _6 a$ i$ Q" F - *
( ]5 ]: e4 l) d( x6 f( G0 a - * brief EDMA3 Test Application" u8 P4 E2 p5 H( }
- *; f' P5 ^1 P" |' e; l+ V3 I# ^
- * This file contains EDMA3 Test code.
M; S* A7 F/ i, _: |4 f2 T - *
/ R1 g, r2 K* F ]& S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( e! s) B+ y; W( G ]( {; s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ w4 Y. y4 y9 N - * TO CHANGE.( u+ j( N, l7 H. M- r4 h4 ]* V
- *" W2 ~8 B* W8 m- c" M- C( d/ v, Z/ O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Q. T! Y$ \; b6 q' q2 m$ @2 L - *
' T+ w2 c+ R1 X# j3 B7 s( n - * This program is free software; you can redistribute it and/or
$ [4 g! ~3 J% x- |+ V3 V8 b - * modify it under the terms of the GNU General Public License as
0 l* e- G. Y2 m0 U: S* c: V6 U - * published by the Free Software Foundation version 2.! G( [5 `- h3 |# j. h! g" ]
- *
* M2 n9 {7 P: v( q9 K+ W6 M3 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 W; {$ ?& g1 e8 C# r
- * kind, whether express or implied; without even the implied warranty: y* y9 o# m0 V# I" o: k+ p. P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% y0 U7 B. _( Z U# j0 l0 L/ a - * GNU General Public License for more details.
2 E+ C p- c; X' }3 Y - */
% t% n1 v7 K: l% D6 b1 `
& b" ~( S. A6 |- u- #include <linux/module.h>
- L7 ^& b! F2 B o - #include <linux/init.h>
2 c0 l. }1 W) z* D' M- R - #include <linux/errno.h>
0 g7 C$ R* e; V p+ z. [ - #include <linux/types.h>
$ U8 ]) ~( _5 F) D$ x) n - #include <linux/interrupt.h>! _) E) x/ i7 P( q. U0 ]
- #include <asm/io.h>0 t5 N% M& B6 x; y6 {" V
- #include <linux/moduleparam.h>) M f6 K5 E) i# H
- #include <linux/sysctl.h>- g! J- Y4 M9 a F0 x8 [
- #include <linux/mm.h>3 i$ ~( r I) U8 n. J
- #include <linux/dma-mapping.h>
5 p; |8 `; G }4 Q( |; @
9 x! D: E+ h2 i. c% v- u- #include <mach/memory.h>
6 p& u4 r Y9 G3 e- |2 F& A5 H. W - #include <mach/hardware.h>
5 |6 w' f& Z% o7 b6 h" m% N& J - #include <mach/irqs.h>/ d3 L) j0 T: U! c8 ~
- #include <asm/hardware/edma.h>$ K9 \7 w1 S4 Y1 R: V' a0 g) V
- % Q# h7 W/ l# j0 f# ]& g) T- c' S- c$ T
- #undef EDMA3_DEBUG
, h: \! ] d t& g/ _- ~7 | - /*#define EDMA3_DEBUG*/6 U% q+ [" ^6 _" V$ W' x' v
- ' p2 l0 W$ ^) F0 B
- #ifdef EDMA3_DEBUG
6 y) h+ V% r% p4 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b: \: h, \7 g6 l" ~; o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" V; {5 q) G: a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ }" x3 ^. E, ~; Y
- #else
t0 ^9 t) r5 j5 q, n) _2 [ - #define DMA_PRINTK( x... )
3 S: V- R# @7 y z& }. ` - #define DMA_FN_IN' M8 V# m5 q- |8 |+ g1 R
- #define DMA_FN_OUT$ N- R- v2 O5 ?, Z% h) ?
- #endif7 j* e( o/ F( G2 w- i0 z! X% i
- # P' S( } O+ L, @: _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) {3 [1 f7 I& h! I) K
- #define STATIC_SHIFT 3$ E# s& t$ M! l) t+ p. I
- #define TCINTEN_SHIFT 20
3 Z2 ~; |8 o; D: f! { - #define ITCINTEN_SHIFT 21
5 _3 R: w8 n0 W0 o - #define TCCHEN_SHIFT 221 m, s7 _7 H2 K
- #define ITCCHEN_SHIFT 234 ^3 v$ h: F) c% v* ]
- z1 d( p5 ` B- static volatile int irqraised1 = 0;
% L |: _# W" X5 W; ^$ u3 \3 O - static volatile int irqraised2 = 0;
7 x1 L/ v) P( }" h: m/ [& t: V, | T& W - 3 u' S ?* F& M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* s3 u, A; p1 J" [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; H7 R1 h+ `% \. l" u d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j' z; S) U9 a
$ |1 }0 p$ D5 n- dma_addr_t dmaphyssrc1 = 0;
) c( s) x, Q2 Q2 Y: g3 F! u2 t - dma_addr_t dmaphyssrc2 = 0;
. L& \7 W% R+ t# K/ D1 Q0 [ - dma_addr_t dmaphysdest1 = 0;0 W3 Z, N: R0 n
- dma_addr_t dmaphysdest2 = 0;: `' ?) N# \, H2 J: g
- # E# u8 Z0 C9 |% J& d+ D
- char *dmabufsrc1 = NULL;8 m/ Z- T) a& S/ l8 E* T
- char *dmabufsrc2 = NULL;
% R; @8 g' v: |' b: L9 Q" g$ | - char *dmabufdest1 = NULL;1 J& W& g/ U( U- X* ~- r* k
- char *dmabufdest2 = NULL;( N2 g) R6 \/ k0 w1 b+ ~1 H
8 ?) m5 H w$ t- static int acnt = 512;
$ K9 A4 f: I& q1 O8 c - static int bcnt = 8;
, m* ]; c, Q' V - static int ccnt = 8;
5 N, _# y$ X- D8 o* m( J3 g
: b; e7 A- M' P! J A( h3 U- module_param(acnt, int, S_IRUGO);
, ~8 G; q! \7 D" b- M$ x2 ~ - module_param(bcnt, int, S_IRUGO);
- ?2 k7 ?. p( f+ t: _ - module_param(ccnt, int, S_IRUGO);
复制代码 ' o' V8 @ J- }( z6 i( U9 R- f% k
/ ]2 i& w+ M% N' o! s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ U3 \2 N# G# E1 m8 k$ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 @$ C8 P& p6 K1 d o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i& x/ s" |0 ^6 I7 Q
! n3 p! p D; c1 p3 ?( e
# C7 E% z- h- Q* L- u7 W! s2 }; v |
|