|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 t! f) Q3 A& U. j7 |. I7 p2 }8 W
- [code]EDMA sample test application, D' E7 m; p# k3 ?( i$ J
- /*
2 ?! W$ N6 w% b0 A% u9 a k1 X - * edma_test.c' q# G# f( T& z% ~1 b; |) A! z
- *5 N! u9 A4 E) T- o/ G/ a$ U
- * brief EDMA3 Test Application
) ]; C1 k/ `# f2 X; t$ } k$ F( Y - *- }8 K& T# @; W; b
- * This file contains EDMA3 Test code.
9 u5 k: |7 H; G( ^% W8 r- E5 E - *& [6 a( m/ d! S* A, _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" f2 P0 I, F/ V/ ^5 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- i4 @0 O7 w) J- G1 ^
- * TO CHANGE.7 {7 E, }2 H0 e
- *
* r! `; U: C0 W' ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% I. S$ `7 B$ I" q - *
. f! w9 {- ?6 F) }4 q! J - * This program is free software; you can redistribute it and/or. a# K- i) b# U$ R9 C' Z
- * modify it under the terms of the GNU General Public License as& u: S6 E# i4 X* r
- * published by the Free Software Foundation version 2.
& L7 q# }9 @6 V3 Q: p. p) q - *
% ]7 J) f2 {1 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' g d% x" s0 l+ J+ S3 J" I
- * kind, whether express or implied; without even the implied warranty
4 U2 \9 k4 u+ I6 ]; B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) h: _" L7 P. p$ v7 z: n
- * GNU General Public License for more details.' m/ p, G O! |, O; f
- */
$ i/ f% B! Q2 {* N) D - 4 r V& ] _$ d* Q0 ?( U
- #include <linux/module.h>
. {) G0 K. a; ` Y& u R! t+ [ - #include <linux/init.h>
5 b( B) ^; t2 P8 T) | - #include <linux/errno.h>
# p3 v; U% o3 [) M3 ^2 M C- J - #include <linux/types.h>$ @ M( b' ^! I
- #include <linux/interrupt.h>! u( R b6 [ s, x `. z# B! K4 Q
- #include <asm/io.h>% l& ~, y. A& m# l# B$ i( y$ q6 [& n
- #include <linux/moduleparam.h>6 b$ d5 ~0 h( i$ R# c; U/ y2 c) E
- #include <linux/sysctl.h>& V5 I8 q$ p# F
- #include <linux/mm.h>
; N3 ~! W, y- }2 n! q! d9 x - #include <linux/dma-mapping.h>
( {4 N- ]) Y6 @" s% l - : P. r$ ?& V; T( z* v9 W' F
- #include <mach/memory.h>
- G. [) O& g/ u" N - #include <mach/hardware.h>
/ C' N6 S+ b3 ^- G) @; {4 a" G - #include <mach/irqs.h>
0 m8 D7 b% S( Q$ `0 q8 _% x& w3 Y' _ - #include <asm/hardware/edma.h>, j9 b' O4 D" k0 Y8 m& Z
- 5 \% \% G3 X% K) J$ w
- #undef EDMA3_DEBUG
' l$ x/ s0 ~4 U3 j: Q - /*#define EDMA3_DEBUG*/8 C7 d" t4 X( h& i5 H2 H# j
- ! e6 z4 B( k9 y) J2 _1 T7 n E
- #ifdef EDMA3_DEBUG6 k4 M6 U6 A5 S( N8 ~9 n; Z8 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 k) L: @1 v4 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: Y5 ]# Z- e3 X% _% X0 U8 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# n: W8 s- U- J, L - #else3 k* k4 l4 l' E
- #define DMA_PRINTK( x... )
8 Q3 ~6 e) ^( z' R1 M - #define DMA_FN_IN
1 u2 D8 ^8 ?& p! C - #define DMA_FN_OUT: w( r S5 l/ p7 l
- #endif) N2 }% Q' m0 R' \$ ~" }
- 9 i4 `+ ~2 c. e& |/ S+ c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# X9 ^! ]3 l/ K% M4 j! v y - #define STATIC_SHIFT 3$ ] s" ~& D" ]
- #define TCINTEN_SHIFT 20
. {/ ?1 w7 O% h/ T - #define ITCINTEN_SHIFT 21% Y1 n& w. \; ]. R7 y" D
- #define TCCHEN_SHIFT 224 ]/ s$ e& G4 |; B% [3 ]2 P4 l
- #define ITCCHEN_SHIFT 23% s$ F+ x$ l& Z# s, I
( v" ~5 b) k( {6 |7 f* F+ T7 j- static volatile int irqraised1 = 0;9 [1 O) l" h: \6 f* ^
- static volatile int irqraised2 = 0;8 U& b* c7 p5 n: v
- ! e3 i: [- r( m, g6 \8 ~& v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. }% l, @6 u( F4 t9 i# V/ X* P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 P: S( V* v( p9 v% F) E; i* j- [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c; z0 l8 C- s
. Q. y x/ N: T: g( R7 [8 A/ G- dma_addr_t dmaphyssrc1 = 0;! g+ K+ e$ c( ]1 L' W+ `6 x
- dma_addr_t dmaphyssrc2 = 0;
3 G- f6 A; z; T3 P - dma_addr_t dmaphysdest1 = 0;6 h7 r; q9 F# V' P* j/ p
- dma_addr_t dmaphysdest2 = 0;
; S' ] \! B2 t, D, m2 _* k; g8 H - / _* P, T' K! @, O% K$ u
- char *dmabufsrc1 = NULL;: F% I4 F5 {3 x5 F: H" O& U9 v. x2 I
- char *dmabufsrc2 = NULL;) y' y5 N) l8 z6 q: s% f" y
- char *dmabufdest1 = NULL;/ W' t7 I' }7 s& d4 a: ?4 V( v
- char *dmabufdest2 = NULL;: J# _! O# {, K: Z6 q4 Q* K' \
- ; E% _) J% K( c/ H5 k* u7 @
- static int acnt = 512;" }. [$ ^& o% w n& v
- static int bcnt = 8; z' F! V4 f3 y9 g3 j* X
- static int ccnt = 8;
; V' Y( l% x- H2 T0 r - + \& E( w( t7 x
- module_param(acnt, int, S_IRUGO);
6 \% \1 z: D8 Z$ _5 m' ^3 v - module_param(bcnt, int, S_IRUGO);
, n {6 U# Q' C1 B& E6 k8 l - module_param(ccnt, int, S_IRUGO);
复制代码
2 f7 a1 ] J: s* U5 W6 p, z* Z6 X0 j+ J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ^5 j r( T6 T! `+ x8 I1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D6 I; L3 k& \* s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 \! A& T, c5 F* p0 q0 T' T
! O$ h& ]) E% t! b$ g+ A a9 A" P. N
1 ^3 h$ c9 f% M8 v* o! U |
|