|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . ?! c) a( o- k$ D
- [code]EDMA sample test application" K& M( G, d4 R& Y
- /*
9 z- O/ C+ h+ s. P) S - * edma_test.c
, m4 T2 W% l- I2 i - *: M, |* e3 R; a) p* e ^5 j
- * brief EDMA3 Test Application6 R6 ^8 ?! a, u5 z0 ^+ N
- *
?" A6 j a5 I# H2 @: Z% b: d0 J - * This file contains EDMA3 Test code./ J+ d3 u$ U& k
- *
( I+ C! L% J t9 ^1 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ f* s- u- U6 T9 u& P: Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ~$ }$ g! k K7 R7 q
- * TO CHANGE.* f1 \) K% B1 v2 E. G9 h1 S2 \. E
- *
! ]; D" g2 J( z' ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 A0 Z4 l/ l0 f) g" _ - *
1 W7 ~; I5 k5 v7 p - * This program is free software; you can redistribute it and/or
6 S; A' u3 ?& w% x" k - * modify it under the terms of the GNU General Public License as1 x# s! W- d0 ]5 {: c6 d
- * published by the Free Software Foundation version 2.
1 A, k1 ^8 V, N - *4 o/ \7 f6 U3 o: P/ o* Z& |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- {5 e1 A5 Z! M' Q+ Z - * kind, whether express or implied; without even the implied warranty0 G" `$ s! f/ \+ A4 w/ q0 n1 P8 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ l3 f; N! e' `3 _7 O - * GNU General Public License for more details.: p( ~& [# M9 W) t/ r; L
- */
0 K% m8 c. B% ^1 h2 q3 Q* L
9 E# B: n' z" U' a7 X- #include <linux/module.h>) Y9 T' n3 Y; Y2 M
- #include <linux/init.h> ]( J, e" x# o s. Y
- #include <linux/errno.h>
4 F& l( S: d9 a5 J+ E; W - #include <linux/types.h>
4 O6 S5 D/ F. n1 x- s4 Q C& A - #include <linux/interrupt.h>5 h+ I# P- `/ W6 \1 Q3 {
- #include <asm/io.h>
( g) @* U9 b% ` - #include <linux/moduleparam.h>
: h: p+ j9 ~) a - #include <linux/sysctl.h>, e% ~# F* F1 {9 v" R# L; t4 _
- #include <linux/mm.h>
; r1 ~# n9 I$ I' o7 d! V$ j; s1 e3 b) y - #include <linux/dma-mapping.h>
/ g3 j* S* B2 f! c( y m1 |0 T - 1 D0 G0 @1 P# ^" e) g# |
- #include <mach/memory.h>. W7 @6 ]; r" ?0 E/ [
- #include <mach/hardware.h>' O! M6 H; y0 p: R% t% `1 a
- #include <mach/irqs.h>
& ?8 U u+ m2 R8 i+ p8 i) n - #include <asm/hardware/edma.h>5 w9 ]; x9 L5 ]% B+ O$ D
- * N' M p" v# H6 y9 q7 e
- #undef EDMA3_DEBUG5 g* d& L1 i+ P3 q
- /*#define EDMA3_DEBUG*/
* d' K( U; c4 A- v - 0 |. t0 c: S a% \( ~4 x4 X6 o3 Z: q
- #ifdef EDMA3_DEBUG4 ]. p- N, p" A h, s2 M: y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 O8 F/ r. \( K# m# k( N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" B3 l6 _, K) k; x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
s# p2 b9 z: v6 p* U3 a4 z - #else$ i% _. j% T$ B& ~* Z/ Z( B
- #define DMA_PRINTK( x... ): C9 f# N! q+ M, l! z: q& V
- #define DMA_FN_IN
, S. d& B' V: ^; z a# ]5 d9 p7 p. | - #define DMA_FN_OUT: L* |6 x6 Y ?3 U8 x: \! ^1 j5 L
- #endif z* o; j. n$ L! K3 D* S4 E
( U4 E O$ z! d2 N j& \( ^/ I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( k" ]6 H4 U/ P1 b2 N1 G
- #define STATIC_SHIFT 3
( T; v2 A% H7 D- U3 j - #define TCINTEN_SHIFT 201 }* S0 M* t! h7 n1 R( C& Y
- #define ITCINTEN_SHIFT 21$ ]1 j9 G& Q4 N1 T2 S" |6 v
- #define TCCHEN_SHIFT 229 G- h) m3 O8 k4 h* l- ?% L
- #define ITCCHEN_SHIFT 236 S7 N5 Y$ o r7 {9 L. A% _0 s
3 T) R6 L' p' v4 {8 Y7 k1 x+ i- static volatile int irqraised1 = 0;
2 @1 j9 g. k$ W2 u3 ` q - static volatile int irqraised2 = 0;* |% j7 Z s8 B
- ' G1 d8 P2 J' b) Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% l+ _* { L8 }6 t O5 k A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S" Q, F/ u; p/ R& n9 _' J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" w$ G4 A ^8 O5 Z
$ a2 Q( G9 M$ U4 x* X* i- dma_addr_t dmaphyssrc1 = 0;
9 V+ z3 W9 e" A- k0 i - dma_addr_t dmaphyssrc2 = 0;
; z# m: l8 M3 X% ] - dma_addr_t dmaphysdest1 = 0;' ]+ u! t' F) Q7 x1 P O. P
- dma_addr_t dmaphysdest2 = 0;' }/ j( w+ r# x# p, n
+ p& E# k& U) z! Z. t1 u& ~- char *dmabufsrc1 = NULL;
+ n# Q; w, s) s0 I - char *dmabufsrc2 = NULL;
/ H! a& H: Z# f5 M - char *dmabufdest1 = NULL;' k" L( R! g! {! a9 }" R+ H# ]/ g
- char *dmabufdest2 = NULL;9 M% ?+ v% M5 o2 o% [/ d1 O. W3 f
- 2 m! `4 M1 t' r
- static int acnt = 512;
: y* N& ^9 X; N6 _+ q/ x/ [ - static int bcnt = 8;% R- y# \& e* g. ?6 L9 ?
- static int ccnt = 8;
4 N0 d9 R* k6 n$ T; e - " s$ v$ F! u+ V+ y8 S! U, e. @
- module_param(acnt, int, S_IRUGO);
}0 s/ u# N/ F; d8 J/ J - module_param(bcnt, int, S_IRUGO);9 M* l' V; z( |; B$ x$ d5 }2 `) u
- module_param(ccnt, int, S_IRUGO);
复制代码
- r) { O( W% K$ r* {: f; V/ x6 N5 ^ X, F3 x2 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 w( A* C/ d5 R; Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ o0 i, r1 }/ h1 R( K2 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* _0 E3 ^) d( x& J( f! p
+ u) ?( w {$ c$ a- H" Y! q
7 {9 P& u. y2 I$ T) `* V2 w |
|