|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & q* _/ Q: h L
- [code]EDMA sample test application( J8 m: I) F0 N2 g3 P$ v* D
- /*
" e! ~) \* w1 x+ @ q - * edma_test.c
" @: C- V+ J5 e) `9 T3 q - *
- C0 L6 R! o1 g3 R1 j - * brief EDMA3 Test Application
3 g* Y$ E7 y9 R* w9 ~; ~! u5 U - *. _/ m" G6 y# F: z3 Z
- * This file contains EDMA3 Test code.
) B9 H! ?1 x* U - *
8 d/ Y! m0 o4 k( j) w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, J4 q, H4 R% C- l& b5 |5 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ~- r$ X6 B2 F3 S7 M
- * TO CHANGE.
/ Q* @4 T; }' c; A: H - *
7 t$ T6 V( p1 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ d2 Y# Y" R, I$ D
- *) o+ e! M+ l1 m7 ~
- * This program is free software; you can redistribute it and/or* D, }7 t- J7 c+ t6 ^. W
- * modify it under the terms of the GNU General Public License as2 _. }. i' H" s/ ?
- * published by the Free Software Foundation version 2.! ? A/ S. U8 o8 v+ `
- *
2 o* R7 J$ f9 v. n# O _4 X5 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~7 J5 @( F. Y
- * kind, whether express or implied; without even the implied warranty5 V, J4 J3 x1 r/ I6 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( x; |4 h# s: `* [ ]; F
- * GNU General Public License for more details.8 @6 A3 r% x2 X* P) i
- */& ~, F' X9 J! T6 \0 y
" M+ U' b3 m. C7 K6 o- #include <linux/module.h># `4 _' w O$ V" z- c
- #include <linux/init.h>
& u6 k# ^& T( b( c* {1 @7 ^$ n( f# H - #include <linux/errno.h>
+ o/ J- [4 N, f* N# |0 G - #include <linux/types.h>
2 G% [" M( q3 |( | - #include <linux/interrupt.h>
2 j) x$ d+ W5 f* y - #include <asm/io.h>. Q1 U/ U6 }% |! A6 G2 q& V
- #include <linux/moduleparam.h>
0 D! ] L7 p& |# D9 A' @ - #include <linux/sysctl.h>
/ @* n" g J& a; h% @ - #include <linux/mm.h>
1 ]5 X T- E1 k - #include <linux/dma-mapping.h>
9 w# O4 D% l2 }5 J- p6 V8 U# Y; V
! [4 `1 r3 r& ]! K- #include <mach/memory.h>
8 f: v' g" W! Y! S. Q - #include <mach/hardware.h>( r5 G, [! G4 r) B3 I5 T/ B& X
- #include <mach/irqs.h>% [" ]6 N6 {4 N: M! z
- #include <asm/hardware/edma.h>
3 l5 F! ]' R0 L% g1 d; Z& p3 j, `
+ u- o' ]8 k9 t4 N- #undef EDMA3_DEBUG$ ^4 C0 F! R" g# {) X
- /*#define EDMA3_DEBUG*/: c! Q2 O2 f3 P+ }+ U
- % J4 [) k7 C; C
- #ifdef EDMA3_DEBUG9 q- ?! x0 a9 ~+ v* L, O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" z, p4 U" H- n! t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) a# |. Y/ y- G! o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: M5 Z! {4 V3 ` - #else6 |- o+ F5 T1 g( X0 {6 r
- #define DMA_PRINTK( x... )
$ N' f* v8 i. }& z' c+ a - #define DMA_FN_IN& O, E% }+ y6 s9 o
- #define DMA_FN_OUT3 i# J4 ]1 [8 j, S
- #endif
0 j) G9 f! o2 M" g5 W* ] - 9 F) x& W& J5 c( r( R. E3 Q5 s/ f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 o5 K+ [/ I. g1 S$ g8 s0 h, O - #define STATIC_SHIFT 3
$ [* d% Y0 c$ l$ c9 } - #define TCINTEN_SHIFT 202 n g3 A( Q6 {3 h: s3 S) w* k7 H* \
- #define ITCINTEN_SHIFT 21, d/ F9 h" y' G7 r) p
- #define TCCHEN_SHIFT 22
9 N" {* j7 T/ | - #define ITCCHEN_SHIFT 23; s( }0 T. }6 o/ i3 F, u, j9 N
- 6 i; D6 `1 V9 ^. s
- static volatile int irqraised1 = 0;4 }0 k) z( W( x0 S# _5 z- v
- static volatile int irqraised2 = 0;
; @7 z6 Z4 }, v1 I9 U4 n f
]5 h; ^9 U' c8 d- N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% I# q$ p' K% k1 Y" j, M% e" D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L3 w/ j: T. U2 i+ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o$ d! B% u9 a% M) U; F6 y
. m" L. r" D% D* k- dma_addr_t dmaphyssrc1 = 0;$ V9 i, u: K, t0 B: C# A
- dma_addr_t dmaphyssrc2 = 0;0 A' w. W! j$ f( }" G& }+ H
- dma_addr_t dmaphysdest1 = 0;
u) R! I. q! W) ^7 w) y - dma_addr_t dmaphysdest2 = 0;- \6 n7 G* g2 q: g( _5 ~ {
- , ]& q( S3 i9 ?
- char *dmabufsrc1 = NULL;7 i) l, {, G9 ~% V2 c" q8 Y. r
- char *dmabufsrc2 = NULL;
# a4 U' \8 l5 c2 B/ q* }) L. X - char *dmabufdest1 = NULL;" z( N2 K+ G# e! U8 v% c8 _; F) x! i" i
- char *dmabufdest2 = NULL;. ~. A; A$ s! I- P
- C( ` w. }2 t8 P4 x" E0 x- static int acnt = 512;- o& W8 z( ~ Z" R( T& f
- static int bcnt = 8;1 E9 ~* w3 O6 C
- static int ccnt = 8;5 L9 [) l$ x6 J" \
- / l0 l' g6 K* Y! q+ S4 [
- module_param(acnt, int, S_IRUGO);! F% R# o) o, |' `- n, D6 g
- module_param(bcnt, int, S_IRUGO);
' }' N. U2 r( @$ w - module_param(ccnt, int, S_IRUGO);
复制代码 3 Z# y) A' L3 F. M0 Y2 e3 G
4 G- g: b9 ?1 m: w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 }' Q4 l4 f+ y3 w0 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* T$ Z/ M, T. o! X6 ^) X$ K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 f) }- x+ Z& S7 y( Y& e3 L8 L: U
! S* ]0 h/ ^ ?- ~5 m6 N- n% S$ i5 d$ I$ h9 U4 b( Y
|
|