|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 _- Y7 j4 y, P
- [code]EDMA sample test application- J$ y7 H( G8 K# p% s
- /*& } Q- I: J# p' f
- * edma_test.c' ^2 U4 I6 s' r, h
- *, T7 p" |" l3 o5 e
- * brief EDMA3 Test Application
8 H; D& ?; {6 b+ e c! Y* L0 \' T - *
# a4 `4 p7 \. y% k1 m! K. _ - * This file contains EDMA3 Test code.
- [$ E& T8 Z$ [1 x: Z9 Z - *: } ^- ^" e1 o& L2 X* k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& a% P' A6 j; S* }! u3 {6 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Y2 W+ R; l$ W$ T4 N
- * TO CHANGE.6 `% r3 L r1 ]1 ]
- *
, F4 Y! I8 ?1 W a% X$ C( l# c! _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 F. x; Z. P$ v4 N. O - *
; ~1 B Q9 ^- q8 R/ T8 u4 G - * This program is free software; you can redistribute it and/or- s( A# X1 b- J% D) X; p' H
- * modify it under the terms of the GNU General Public License as
) S& J: q! n1 `. s0 M& R' Y7 K - * published by the Free Software Foundation version 2.4 r$ j) f5 X, b q0 A
- *4 O( Y1 q2 |. E% N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: g% Q; y# w1 r6 a! ?) J G6 ` - * kind, whether express or implied; without even the implied warranty( @: K3 _9 e( ]* X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ K8 ]4 w: `/ l M+ Q
- * GNU General Public License for more details.
: t6 |3 T: W7 {2 L( {: e - */4 t3 K! Z" i7 [2 r; o
! H. N0 z% H* i& ]- #include <linux/module.h>! r2 |* i7 n( _* |" S" \# W0 t
- #include <linux/init.h>( m0 w% ?) H7 w0 T, I, e
- #include <linux/errno.h>. s I! F+ M F u7 u
- #include <linux/types.h>
+ B6 F7 o! o; M - #include <linux/interrupt.h>! ^& G: u; J0 \& \$ q
- #include <asm/io.h>
2 F5 C: e+ b) u2 B! w - #include <linux/moduleparam.h>7 q2 o( T' d& K' u& Y4 V
- #include <linux/sysctl.h>
; u) p% C" Q/ O7 S; m; x - #include <linux/mm.h>
! h$ `6 _0 ^, s) J* _3 o - #include <linux/dma-mapping.h>9 D9 |! F/ Y. h/ s- C6 E7 R1 y
. f. l4 \. W' M, I, [- s4 C. F+ z- #include <mach/memory.h>
( Z0 L+ V( _* ]1 S& T& E - #include <mach/hardware.h>
! j) Y2 {8 m) |" Y, c( u: o( j+ M - #include <mach/irqs.h>% g% W5 B& L2 l9 H
- #include <asm/hardware/edma.h>) ^, Q7 [/ h9 h2 k: f" b; k" o
- 7 F& _) l7 V3 W. [: x$ f
- #undef EDMA3_DEBUG. [! ]& S* h2 k1 q8 _
- /*#define EDMA3_DEBUG*/
/ `) |- ~# ]: N/ H9 @% U5 T+ u/ _+ X - . i6 Q% R$ B: k# T# z2 O2 g
- #ifdef EDMA3_DEBUG0 `/ f+ S0 b* e% s0 w- M8 p- o) b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( B. r: Z5 _! E4 x# ]2 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): h# `- f' r% Q% r' e3 {* A+ u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 O' D- c" I) I8 ] - #else
1 Z( M" P6 B u* m* U R, t - #define DMA_PRINTK( x... ) b& [; w/ a; _7 {( o' b. b
- #define DMA_FN_IN9 w( F t1 K) j' q' q( R
- #define DMA_FN_OUT2 p# Z& [8 X+ P { D
- #endif
' n0 Q- k5 Q, l( l5 q7 a% l - ! \, w0 `+ V* Q* n( o: l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# {" W! I% w; y; D; @6 }. I
- #define STATIC_SHIFT 3- k7 Y2 [, V8 a& d. m( `% [4 D8 n
- #define TCINTEN_SHIFT 20
, j. f& o, t- v. T - #define ITCINTEN_SHIFT 210 {$ x; E% Y+ S( K2 ?
- #define TCCHEN_SHIFT 22( T4 W V/ g( O7 `: d
- #define ITCCHEN_SHIFT 23+ r; v" \4 \: R4 a2 r/ ]
- # J- ~# _: n8 J1 ]3 \- q- f
- static volatile int irqraised1 = 0;
- a' s. ?6 W1 r: ^- V4 I - static volatile int irqraised2 = 0;) d" F1 R+ |' E2 O: J# l# z
- ) a5 @! c Z7 a1 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 i9 C! O0 \8 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X+ N$ Q$ ~9 j) {9 p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N5 }! H' h# ]1 ~% J9 `+ M" M
9 W% V2 F | n) L! e- dma_addr_t dmaphyssrc1 = 0;7 M5 ^9 p. {, Z1 X
- dma_addr_t dmaphyssrc2 = 0;
. k1 p5 p1 U8 T( n2 x& {. L$ H. h0 N - dma_addr_t dmaphysdest1 = 0;
% S$ S& v( G; y0 \. l' V - dma_addr_t dmaphysdest2 = 0;
2 K( W+ `9 L& E' K1 w S2 Y k0 P
: y% t- A% X& A9 u- char *dmabufsrc1 = NULL;) X; x; V7 p9 A- |; C+ H
- char *dmabufsrc2 = NULL;0 M' C6 d9 V8 {
- char *dmabufdest1 = NULL;
! t0 c. @/ z* e - char *dmabufdest2 = NULL;; f! u+ l; I( M2 n8 P1 ^" w
$ d* k0 @7 Q! W7 S- static int acnt = 512;0 G F8 M l5 T8 g
- static int bcnt = 8;, S5 K% F# m" l! W7 j: E
- static int ccnt = 8;
, v- a$ K6 j( D7 u- y! r' I
( w2 z3 Y0 l/ i% X7 w: f$ L- module_param(acnt, int, S_IRUGO);" a" z/ n; H6 F
- module_param(bcnt, int, S_IRUGO);: n2 b1 Z$ L7 ]0 p- a) D
- module_param(ccnt, int, S_IRUGO);
复制代码 * u, h7 ^) @0 P
# i* ^9 \) `2 a4 _9 E& P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 F: T" P& k. Z3 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 E8 X# q; n" u( [! \1 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ^ h$ A8 P- P; G7 j2 `; h
. g |6 a- H/ @; B
, ^! q/ u) P4 M, e, K% ~; ?
|
|