|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 s) z5 d! G6 l, D5 [2 Q3 B
- [code]EDMA sample test application
2 ?3 B$ b1 n4 f1 J3 D9 d - /*7 U, W" Z8 `; U8 n
- * edma_test.c
3 e/ \2 w0 s7 N" y! {. y - *( S2 |& f$ d: [& u" ] {7 Y! Z) V
- * brief EDMA3 Test Application8 p5 T, U7 k% g: `, ]
- *0 G. x: @& r, q8 _) y8 ^1 ?+ M3 C
- * This file contains EDMA3 Test code.: j& A) H( S6 y, o5 ^, P9 P
- *
8 J- V& U! Y6 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T; _& C T- U. ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% j1 {1 m- J) U h8 r: a - * TO CHANGE.7 q) f7 i% o- y
- *. U. c3 Z/ @0 U0 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- i8 N7 y7 O1 \: S( H% F
- *8 x+ I" T c$ N- @4 i: [
- * This program is free software; you can redistribute it and/or
4 y, x# t; _9 }# J; d! A - * modify it under the terms of the GNU General Public License as' J2 |* g/ E6 q; u5 j8 R
- * published by the Free Software Foundation version 2.- b: j o; Q$ B( u
- *& O ]3 P9 ^& Y/ Z) F( N& U1 {5 R: d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f) X- b& c) l
- * kind, whether express or implied; without even the implied warranty- l1 o U* b8 v+ j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 i) k( W( V, q$ k6 _ w - * GNU General Public License for more details.
) ?$ N2 P3 n7 H o* O% @ - */% ^# o) U. N- `8 r: K' O3 _; z5 E
/ y+ s* I3 s, O% m: [: p- #include <linux/module.h> n' c' `0 f2 _% |& R
- #include <linux/init.h>4 I, m: f+ b8 T; M( m6 E2 b
- #include <linux/errno.h>
B6 r" q D# |, J( D - #include <linux/types.h>
8 Y8 O5 D6 j" T - #include <linux/interrupt.h>/ ~. V" @, n9 e- {7 p' J- K
- #include <asm/io.h> q+ z7 ]+ }8 q2 M; {
- #include <linux/moduleparam.h>; _0 d1 _/ ~& e0 _3 I4 F
- #include <linux/sysctl.h>
( q# x/ [- K# P \ - #include <linux/mm.h>' V2 i Q) S8 Y; @
- #include <linux/dma-mapping.h>
/ v" k1 y3 V2 M0 \ @" K
3 | n! T }" D8 ?6 X2 |- #include <mach/memory.h>
4 q1 S+ v; W# k7 B( r - #include <mach/hardware.h>( B9 t* o0 y3 n/ ?& X
- #include <mach/irqs.h>
2 c- V$ Z( _9 z; z7 z7 l6 [% @ h2 ]5 f- K - #include <asm/hardware/edma.h>
6 y7 c0 |; t" D/ u/ G& X/ W
3 Z/ b6 Z. U# t" L! ~7 y- #undef EDMA3_DEBUG
) }) q0 ?5 ~4 c - /*#define EDMA3_DEBUG*/. |0 Z* g$ U$ o$ ^; Z+ i0 t
- ' z# }7 B- _8 t! _+ Y. X# ?
- #ifdef EDMA3_DEBUG! x# M7 }" L- v* }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* s# \7 n/ G5 w% L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: F" q5 p# `! V0 {' [; y5 x3 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 B/ H% ^3 r6 N }( P; ^% J - #else: K, D5 N- X3 |8 K, E
- #define DMA_PRINTK( x... )
2 m! p! r3 p }! m" `, h - #define DMA_FN_IN7 ~/ C8 T% m+ D8 g) V- }7 D2 V( x
- #define DMA_FN_OUT {+ m x+ X( o8 y1 c2 B3 _
- #endif- o4 M9 Z1 P F& B9 }! \# Y
6 B! j. n! Y1 G2 P3 v4 E/ \7 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 f B% t5 q0 _) A% ~9 n/ \ - #define STATIC_SHIFT 3
1 `3 a. L. M3 k( ^ `: u8 [. | - #define TCINTEN_SHIFT 20
. K6 W5 n# y* X6 K& F5 i - #define ITCINTEN_SHIFT 21
( T6 d. c, i) Q; `5 T - #define TCCHEN_SHIFT 22
7 B2 Q. g" G3 O4 W - #define ITCCHEN_SHIFT 23
6 S$ C0 r# p, O0 g( Z1 u - 7 |; w" d1 w) ?/ @- a
- static volatile int irqraised1 = 0;' J9 w) b; q" k2 F0 T( b# h
- static volatile int irqraised2 = 0;) W9 \% v9 Q P! Y( M: r& v
- $ H' \' A2 u z4 Q2 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E/ M% l9 N& P6 J9 Q' g5 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m9 v) o* J) ]6 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c0 o0 |) }$ Y% x. J. w
- ' j. _; q) [* y; v- q
- dma_addr_t dmaphyssrc1 = 0;0 |+ i/ f: M& |9 N: a
- dma_addr_t dmaphyssrc2 = 0;" e1 n$ s" z4 y1 J
- dma_addr_t dmaphysdest1 = 0;
& D" ~4 h( \, {6 e+ [1 R& j, b - dma_addr_t dmaphysdest2 = 0;. w4 j0 b2 ]$ P- P: ]1 [5 o
- . H- m+ ?: w0 J. @
- char *dmabufsrc1 = NULL;% B# T+ ~/ K) e- ~
- char *dmabufsrc2 = NULL;
% l1 A" i) y0 c( W - char *dmabufdest1 = NULL;
2 V8 \0 Z( i& L: U+ H; i1 V - char *dmabufdest2 = NULL;$ ?; A. w# m$ G. l' z% J
1 u+ f1 x" }' @+ X% ]* K% Y0 B- static int acnt = 512;
0 v1 E+ g! a! K( Z4 }4 f" b - static int bcnt = 8;" y: ]0 S6 D. |9 m" t
- static int ccnt = 8;
) D. c' `- E5 w6 q, X6 Z( U
3 N4 R! i$ B# Z! @2 g, c( S% f2 k- module_param(acnt, int, S_IRUGO);& ^ d h2 S; f
- module_param(bcnt, int, S_IRUGO);
( o6 t1 l. i7 w2 @ - module_param(ccnt, int, S_IRUGO);
复制代码 9 P) i" \9 z+ v! f( U
% m/ v" b0 C" [" s/ S8 t L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [( |0 {2 D) g/ n8 O- T; V' N0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 A; X1 \' |" n4 c% |0 Z1 @8 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L0 T, g$ Z2 Q+ m( H% ~5 q, W
7 T( J" \( g6 s6 B& q! J* P8 a5 r( Q; K' {; Z
|
|