|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 w+ q5 k3 A) `9 m
- [code]EDMA sample test application
% C0 r9 ^* I4 z1 A0 H u# { - /*
' e4 ~' ~3 |5 b' y2 ?4 t, k, ? - * edma_test.c8 [7 z3 |- W" F% }6 o8 l- g
- *
$ B3 u9 l* [+ T! D$ ?' Z1 R* T - * brief EDMA3 Test Application
, p' ?6 C8 c; W8 K& p( o* [; K - *9 l% h6 @- {& l& Y' i
- * This file contains EDMA3 Test code.5 |2 |+ X6 P$ o) G7 |3 b3 p
- *# [# u% m P8 _) {5 P9 t1 W* L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; E* s6 h& X* x6 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ i( i" _5 V$ @3 B. g
- * TO CHANGE.
& v8 r; ` @" P1 I - ** G. M X$ F8 K* i- q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& w! d! W4 @+ R% D6 l
- *9 n' |6 p, `, ?+ M
- * This program is free software; you can redistribute it and/or7 ^2 a4 C. k: w' W/ |, n
- * modify it under the terms of the GNU General Public License as
$ g1 ^. o$ |0 L' F, i- S - * published by the Free Software Foundation version 2.
T! y# o5 N: |8 j% L - *
! T# J% E/ Q( k; C4 o w# J) B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 V) s/ T, X2 i7 p. U: f - * kind, whether express or implied; without even the implied warranty
& i0 ~6 _- F! O! m' i( v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 \/ _) F$ r; f g) G8 _% T
- * GNU General Public License for more details.# c! Y+ p! L Z: U8 c. }% B' |6 m
- */
& l6 Z( j/ G E+ r
" H! s8 C; S$ Z! w+ t- #include <linux/module.h>
' f2 y* r3 n* t' |; d3 X% Q; W - #include <linux/init.h>
, j( u; R( [% A- F - #include <linux/errno.h>! y' H6 s0 ?, F7 t
- #include <linux/types.h>
' f* S) I0 G( `0 X) J - #include <linux/interrupt.h>& i5 t, M) r; s4 {; L% K/ J9 ]
- #include <asm/io.h>
9 T. ]" O0 l1 e5 E; n - #include <linux/moduleparam.h>
5 h; {7 {2 _! B1 b) }) Q - #include <linux/sysctl.h>4 X* H, u0 A& y+ y/ O
- #include <linux/mm.h>
* n$ X3 ^9 S1 d6 f g - #include <linux/dma-mapping.h>
. Q* h( [% t1 v2 z: S; K2 f$ N
3 |* F% y% Z" |! d& e/ \- #include <mach/memory.h>" C& Q5 h4 c4 J! ^
- #include <mach/hardware.h>- K, _; d, L6 D# s$ X- p5 d% V
- #include <mach/irqs.h>
* ^: f1 ]. y/ X5 }1 N3 {% T - #include <asm/hardware/edma.h>1 g% o8 R: r2 @6 F' F8 H7 ~
/ F2 V9 L: _! i- #undef EDMA3_DEBUG! t) \6 q! v+ S0 d
- /*#define EDMA3_DEBUG*/ o( z! ?) @) O% w* l6 A$ K
: R' R) H e2 n" R" X( L- #ifdef EDMA3_DEBUG6 n" Q$ `! l m% ~7 X( w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y$ z" o' K. `( F$ l4 m* K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# A0 Y! V3 A- g8 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, S% H" {5 M5 _ - #else
+ A' [7 o7 h, o$ i2 z3 Z - #define DMA_PRINTK( x... )
4 s0 Q- d, O, T3 a3 x3 `/ G4 i% w+ ? - #define DMA_FN_IN r! a( ?8 y/ z: Q
- #define DMA_FN_OUT
# W% ~1 V U4 u9 f- ~! K - #endif
/ g1 g; N7 l) j9 B
6 v, W; x, J2 P- |* |# H) r) g2 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 J/ l! D! l0 g! W - #define STATIC_SHIFT 38 {0 q% [$ P( |6 p7 v9 q
- #define TCINTEN_SHIFT 20: ], {& k' h% x O
- #define ITCINTEN_SHIFT 214 \" Z y2 P1 E! _* v N
- #define TCCHEN_SHIFT 22
: l0 S* ]" ]8 \/ c. } - #define ITCCHEN_SHIFT 23. t, K( A& O7 }8 s) x g7 ^: ]
) s" h% l+ _! o- static volatile int irqraised1 = 0;
9 B$ ~4 w" [( Y! q4 O - static volatile int irqraised2 = 0;
. _3 E: [9 t7 P* K - $ z; j+ X# e+ x- O6 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ v. r& S% S- ?* H6 U p! N; j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( W4 f( D. s: i0 Q: e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]/ x C4 V3 A" ~
- 3 Z% O7 e, }+ ~8 W; ^; H
- dma_addr_t dmaphyssrc1 = 0;
/ ]- J; r: p+ t$ m) y9 ^" V$ e - dma_addr_t dmaphyssrc2 = 0;
7 r" h$ B( ]+ E( E- v% L! C - dma_addr_t dmaphysdest1 = 0;* K! `2 p" Y7 X3 G0 t
- dma_addr_t dmaphysdest2 = 0;
1 M# {0 P3 z! J3 k, o* u$ h/ ? - & K6 z* ?" J5 R6 ?
- char *dmabufsrc1 = NULL;
! x8 R' C( {" E) z. Q/ h% J& |$ ] - char *dmabufsrc2 = NULL;
4 L8 ]: e9 a' B& Q - char *dmabufdest1 = NULL;. C- A; V: V. d8 b3 c z
- char *dmabufdest2 = NULL;! `& v. N" ~1 {9 e
- / _5 h7 n0 o% g1 d, B
- static int acnt = 512;" ~9 s! O- v* n. h- U% m4 m+ E
- static int bcnt = 8;3 Y O- u/ y5 @5 a K7 x: u; C
- static int ccnt = 8;
1 @& ?( ~' C, w z$ P$ ~. M
' Y& y" f2 G% E8 A& w& X- module_param(acnt, int, S_IRUGO);
" T- l, r/ L7 b, | W( q* v - module_param(bcnt, int, S_IRUGO);/ o) y9 _: [/ s. E% y- [* |
- module_param(ccnt, int, S_IRUGO);
复制代码 ( R: n$ v$ Y& k9 C( D1 j$ C
) v7 d/ x3 t6 G1 C8 I1 y9 E! g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ c8 z8 j7 f6 a( }+ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ H8 X9 v9 j$ _5 ]( \6 Z$ v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' r- q1 w- C; H' }7 _
0 |8 P# \- Z, m2 H2 y4 A& q1 R
( b* p! A; Z/ h7 p1 g! Y$ l |
|