|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }2 `- ]1 I# v7 m- L# d8 h- [code]EDMA sample test application/ Q4 D+ s1 T* @
- /*0 W: @# w- X. g5 g
- * edma_test.c
2 i; l1 s% J9 E1 `; M$ @9 Q - *2 N3 W" P4 V( l6 d! Y2 C$ ^
- * brief EDMA3 Test Application; m! q7 w* o( S+ e, H+ m: g
- *
2 y- v' V2 v- T5 }1 {5 } - * This file contains EDMA3 Test code.( Z- l; y' \: _# T q
- *
' s2 l/ F& T% M& o& I1 q& T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 B. W3 ^( b2 h$ Q+ c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ f5 l+ x' N" y( Y4 O8 L6 T
- * TO CHANGE.
7 H9 s# b3 c3 q) M - *4 d1 W) Q8 [+ _2 _) L9 D g: A, A B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ K" g% A M! h5 S - *
7 }/ C* H# w8 f. S$ l6 ? - * This program is free software; you can redistribute it and/or
( v3 w; w! L5 v3 v+ [ - * modify it under the terms of the GNU General Public License as; w- i2 e- H+ n0 h
- * published by the Free Software Foundation version 2.
- T6 C& U' f3 ~* | - *. }/ C- t# j0 F6 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( \% Q' R1 l* r0 K7 d* [5 u4 W - * kind, whether express or implied; without even the implied warranty2 `* b) V& A. v& p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ @% Y% D- ~2 f
- * GNU General Public License for more details.
5 K* [& y# t# M$ ^7 Y7 \ - */
" d! o" Q: h0 M. ?! g" S$ Z - , j2 V; K* [" L; ^
- #include <linux/module.h>3 c7 k) o! g7 m( u9 T! T8 C- S
- #include <linux/init.h>
1 O. z, R0 z/ y$ \2 g$ y - #include <linux/errno.h>
& X0 c2 Q" O$ H' U+ t# H - #include <linux/types.h>
0 T, e u% P1 p' n/ d, m - #include <linux/interrupt.h>+ X- t" U- z' [; Y2 k2 B
- #include <asm/io.h>2 d' `8 C) ?& r# p: d" E
- #include <linux/moduleparam.h>
9 q$ M( l5 P, Y5 x3 h - #include <linux/sysctl.h>: o% z! s& E- k$ x/ `
- #include <linux/mm.h>0 R( F6 n; B7 o( M
- #include <linux/dma-mapping.h>
6 U# L: o8 W2 u% T, H" T7 @. H
1 ?, O" G5 s- [, C; y/ J- #include <mach/memory.h>! J x7 D5 P" o; V8 u
- #include <mach/hardware.h>; y2 G1 H; n$ z3 p* B1 L
- #include <mach/irqs.h>! Q9 `, t5 W: F3 P
- #include <asm/hardware/edma.h>) n- I4 j4 ~: V1 g, B+ |+ W0 l3 S
+ |. g3 t9 I* A4 o- #undef EDMA3_DEBUG
7 \7 Y0 v" ]1 s2 n2 M# v* |4 K3 n' p - /*#define EDMA3_DEBUG*/
( H( W# [. a4 ^# F$ ^ - 0 @: V$ f5 o7 ~3 X3 R
- #ifdef EDMA3_DEBUG
7 v2 q( D( p0 o) m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! d1 R8 q/ O/ ?+ I! k7 q0 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Q: o$ V$ B7 `5 j* g9 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! W- }$ f2 }" f2 z9 P2 X
- #else
# b7 X) P! v! z - #define DMA_PRINTK( x... ); [% N- R$ A3 f5 X0 O* H( [
- #define DMA_FN_IN( E2 j6 Q% ~' [- V, K3 c
- #define DMA_FN_OUT
" n5 Z6 u0 x7 b( x w. I - #endif
# ^" L* E1 V" i7 u: i - 2 q8 `/ D3 n# c2 S' G$ E) k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 v. Y) I7 K/ h6 v0 a0 h# | - #define STATIC_SHIFT 36 x. ^6 U+ S0 m1 K0 @+ _$ s, Y. s
- #define TCINTEN_SHIFT 20
$ R, e4 U& B, P - #define ITCINTEN_SHIFT 21
* g9 `( H+ l: c - #define TCCHEN_SHIFT 22
* S" v4 t! t9 ~( E1 H" k5 r$ M - #define ITCCHEN_SHIFT 23( M. |, @1 k6 M1 M
$ }, ?' e- A, k7 v( @- static volatile int irqraised1 = 0;
. z: H) S4 ]4 r8 Z6 h- H( v - static volatile int irqraised2 = 0;- O) X/ W. _! v1 q# _; R" I8 h
, X7 b; J( Y3 K' T2 W7 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I, E: i3 T: b: O. X- p [& N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( j! H* }' ?2 I+ [6 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( y6 B- q: A$ E8 m" Z( c
# [* [' n9 z! q# b' b3 \+ }- dma_addr_t dmaphyssrc1 = 0;
# V2 O' h# U0 ]7 C& Q - dma_addr_t dmaphyssrc2 = 0;
3 s, J% _- y2 V E - dma_addr_t dmaphysdest1 = 0;
2 C4 ]' ^) H" q0 ~% d+ F - dma_addr_t dmaphysdest2 = 0;7 `8 l4 T) W: g! j4 n3 ?& `! Z# S
# g$ {3 Z/ C$ k' E- char *dmabufsrc1 = NULL;
! X# L& S! n# q8 U - char *dmabufsrc2 = NULL; E! A9 o' s4 p# c7 ]1 h# _3 a0 ]4 T
- char *dmabufdest1 = NULL;$ |, Y- e$ x( {0 c
- char *dmabufdest2 = NULL;; a( l4 w/ L0 F8 ]8 i) U
- 0 v, w/ W, c) `2 T9 E
- static int acnt = 512;) v, X. l* C9 W8 [
- static int bcnt = 8;
: y. T$ t- ~4 f& N$ i) K6 D4 h' w - static int ccnt = 8;
9 \* L$ P5 ~! l% Q - 6 C* q% C6 L* v- e& f$ v' m$ J% k
- module_param(acnt, int, S_IRUGO);2 ?% _0 N* r8 a* F/ h
- module_param(bcnt, int, S_IRUGO);
' F5 e {% q7 V; z, o0 X - module_param(ccnt, int, S_IRUGO);
复制代码
# c) k) C/ S5 q$ ^4 r2 m; D. J0 p6 j1 i7 f# u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D8 _3 O% j" Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e; n4 P% B, Q! l( r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, y- K5 c8 E: e; M' {: @! C% h# n5 b& s' i$ D4 |0 u
( V' D( T4 s7 {$ S* s
|
|