|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - X9 Z7 d2 i, H6 R; Q' Z1 J
- [code]EDMA sample test application
. H/ Y" N. `+ S4 ^ - /*
5 @& V$ l B |+ S- D# E - * edma_test.c# q$ d$ }3 M, o4 m) W% M; ?
- *$ K- K* J ?* E+ Y* A5 S4 f
- * brief EDMA3 Test Application2 G! w) Y: B- I
- *
$ x! [/ U( D* t$ j& E7 p* v( N1 O - * This file contains EDMA3 Test code.
9 R/ [' z$ o* v' v6 b+ Y - *( u; s/ l- J! y9 u5 ~4 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" `, X5 B& J( ]" A" H( G4 i! W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ?. u, z6 d* b( B* G* p - * TO CHANGE.
9 @( c1 n, s% Z2 [$ `9 @ - *( S+ r7 X/ V9 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- k9 b0 F D2 T% S$ }) A7 O - *
5 m- y; V: l7 D( e - * This program is free software; you can redistribute it and/or
$ T. S4 N' j# h - * modify it under the terms of the GNU General Public License as
- U9 z7 f; ~8 U6 e. [; U) D - * published by the Free Software Foundation version 2.
, e U. Q* N2 ] - *
" Z+ R- V& I- x q/ ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- h5 {! Y& S/ T. s
- * kind, whether express or implied; without even the implied warranty7 w6 R0 c l- O6 P8 ~ I" e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ s, u6 t! T# U' V' j; k - * GNU General Public License for more details.* y$ x N$ p: k$ u l& i
- */
+ q' F( A) W( G! r8 U; `/ H
3 j# D4 b Z2 G5 t6 |$ Y0 q7 C- #include <linux/module.h>: n {) a7 N- q5 E j3 w" F
- #include <linux/init.h>2 ?+ N% A$ L$ z" U) {- h; t- ?" t
- #include <linux/errno.h>
8 Q8 j4 e, h8 j# @% C/ `: U - #include <linux/types.h>
/ e; k! d! y" H* E! N - #include <linux/interrupt.h>7 N V2 X3 F# n) A; j- ^
- #include <asm/io.h>
, n- x- X$ U" G/ @/ O - #include <linux/moduleparam.h>. ^* x$ t! ?' T! I0 M. a5 J
- #include <linux/sysctl.h># ^2 y& v# N2 b& f$ N- T: ~
- #include <linux/mm.h>
5 F! O: Q7 v* k/ g4 s2 A( s - #include <linux/dma-mapping.h>
% Q5 ]. v* p5 T2 ~2 L$ K) Q+ _' o - $ T' [ x* q. K$ h. A4 W
- #include <mach/memory.h>
& ?# n. ]* U) q6 m! B - #include <mach/hardware.h>; c& l6 q1 F1 J5 h5 C
- #include <mach/irqs.h>
$ R4 `9 a, b- {, g' |5 T - #include <asm/hardware/edma.h>+ N9 ~7 y$ P! L7 p$ X
- z8 S. I+ Z! m2 ?$ X" i- #undef EDMA3_DEBUG
5 c Y; K+ T2 T6 W5 j9 Y$ ]; [ - /*#define EDMA3_DEBUG*/
( _- b. l2 @! V0 {5 Y6 ]: ~ - 9 y" c( Z0 F* f. k; ?
- #ifdef EDMA3_DEBUG
+ Q% o" s9 T7 G+ j* N6 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 p1 B1 D$ T2 C% M, [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `, q7 O* V# k* B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ^9 x8 a/ t+ Q# b* q
- #else
; `& V+ i5 ~+ K; m7 C& E# V - #define DMA_PRINTK( x... )
# u' _ b. Y" ] G7 {- a% Q& N - #define DMA_FN_IN
$ t# M6 D# Z1 v - #define DMA_FN_OUT9 {% K( e* `& U! R1 G2 _& E
- #endif
/ P3 @4 r3 u) d+ P2 b) \
" i& v, C- ~! V0 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ {4 `3 m$ p% Q& q
- #define STATIC_SHIFT 3# }( P6 d/ ^7 S7 ^& X/ z. _, R
- #define TCINTEN_SHIFT 20
+ K2 ^" I+ Q; z a - #define ITCINTEN_SHIFT 21& E. @1 g- m2 E6 j& W
- #define TCCHEN_SHIFT 22
) V- _8 |. e. d! o$ ^" C - #define ITCCHEN_SHIFT 23
8 i. r, r" j5 [ M Q- N! I. \
; Y5 g A. J0 J3 G, V/ O ]+ ~- static volatile int irqraised1 = 0;; c8 b( k) E) k
- static volatile int irqraised2 = 0;
' t" g; }* Z( C7 Z( p" u+ O( Z - 8 W: d6 D2 i+ b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u t1 `/ ^8 N7 ~9 I8 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s* l" t/ B' L' b: @8 V5 ]- F9 [; P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n; B6 f4 H. G
3 r+ \& K+ [; ^6 C) ^- m- dma_addr_t dmaphyssrc1 = 0;1 f+ j! e: A% g& \7 F e
- dma_addr_t dmaphyssrc2 = 0;6 k$ M1 C6 M3 \! J
- dma_addr_t dmaphysdest1 = 0;' c7 e+ i8 o3 D+ M
- dma_addr_t dmaphysdest2 = 0;
; \' T/ V+ d% O7 Q. W
" v5 G5 D y" k$ b- char *dmabufsrc1 = NULL;2 X D! C9 {& Y0 S
- char *dmabufsrc2 = NULL;4 ~( {) R/ _; Y; N( C
- char *dmabufdest1 = NULL;) C- J; C. n6 w4 q. j. S+ s
- char *dmabufdest2 = NULL; i" e4 r# y) i* J' |/ c# V- ^
- 3 g1 I& L3 M9 }8 R+ F* r
- static int acnt = 512;9 N c) c) y' d/ C' _
- static int bcnt = 8;
' |! t9 J$ w: y# @* W - static int ccnt = 8;7 u: o! s$ J( { b2 P; k# y D
- 5 n. q. E' A) }& _
- module_param(acnt, int, S_IRUGO);
# z7 a! k9 u8 i/ G6 Y$ k U( M - module_param(bcnt, int, S_IRUGO);- l3 R7 W- r; c2 u5 a. @* j. J8 N
- module_param(ccnt, int, S_IRUGO);
复制代码 " t& v% ^3 p+ c7 v: l$ ^! {3 U2 H5 ?
, e9 S) \4 v% {5 j i1 `3 b& y+ u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. _7 e1 t" k8 d! Q. [0 A6 C7 n0 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, V& P7 x" E; I+ Y! M, d2 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( o' G& K! Z2 r R5 X3 y
& w- G; h) e! o N x
1 D" |; C4 i7 C |
|