|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / }' m. V2 G$ }/ a7 V8 D6 ?! Z' O
- [code]EDMA sample test application
) x: K" o" @5 A% r. l2 E - /** e. {! O9 l7 r' X4 F3 L6 B
- * edma_test.c
0 L% ~) g6 e% n; S) p( q - *
) L/ Z$ q& |4 G0 |! T. f - * brief EDMA3 Test Application7 R( S$ U; ~3 P& B
- *
3 ^ ?% L+ p- q+ L - * This file contains EDMA3 Test code.% d: _: p( b% S; X" b, k
- *9 \* h% R) G& s9 @0 z$ U4 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ], Y% r) F5 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* R7 M4 i/ `' b; M+ H+ d
- * TO CHANGE.
. x B9 t. n4 h- V; _ - *" j& c4 g1 N( O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- Z2 S* e" }8 i% _1 L - *
6 L0 Y& ]' R0 T( I+ `: ]( v - * This program is free software; you can redistribute it and/or
! Q/ p; L5 I& J8 C+ k) b# n% @ - * modify it under the terms of the GNU General Public License as2 `# D1 T$ H# K `" [+ ?0 ^
- * published by the Free Software Foundation version 2.' }) p" _) L9 Q7 U
- *
: ]3 X9 W- |! w, V. d8 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. M! `( ]/ A4 A4 V
- * kind, whether express or implied; without even the implied warranty
; ~- e1 k1 [. h# k0 C$ a: k) J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 D3 X* @% i5 i
- * GNU General Public License for more details.
) F$ @9 _+ \6 `5 c8 v& U - */
7 i0 C8 m+ q4 }' d. \+ N+ {. i$ V1 R
; p5 @9 E) R# \& Y1 m- #include <linux/module.h>+ x4 g/ c/ Z$ F3 ?
- #include <linux/init.h>
/ U e. N# C, r - #include <linux/errno.h>
\, o8 i' `. z! t: }; _3 J' q2 f - #include <linux/types.h>
9 \0 X# s. }7 c - #include <linux/interrupt.h>* h& G. k& X0 N$ w; Z# b
- #include <asm/io.h>
. w3 W) Y. g' ?/ M( y - #include <linux/moduleparam.h>
9 c* W3 R: ] e8 c; U& Y- v - #include <linux/sysctl.h>
: a; C0 n+ t1 L, z5 E3 i" w3 N - #include <linux/mm.h>! f; j( m1 P' E. o3 W
- #include <linux/dma-mapping.h>
( T6 ?. Z! {8 T0 T' f9 S8 Y3 R - 0 x1 H- n8 M" ?: I# z( k
- #include <mach/memory.h>
6 @0 K. J1 n2 v# Q F - #include <mach/hardware.h>
) b: D; ]+ h2 O6 C j - #include <mach/irqs.h>8 D+ E/ b4 x2 c7 ]
- #include <asm/hardware/edma.h>3 i7 U, ?" B, t
6 j: U& y, `6 N- #undef EDMA3_DEBUG/ p% S- G' x! k3 D$ y3 t; s# x
- /*#define EDMA3_DEBUG*/
! d, K9 G4 ?! m - 2 ~( D* S/ Q0 D. [
- #ifdef EDMA3_DEBUG9 w7 |+ I2 }1 X4 f7 A5 Y) T* R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! N$ R8 ], q( f& S/ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z6 `( }& t4 v, b* k! { E; h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _9 o% d- k0 E# |3 n/ Z9 d
- #else
9 ^3 X" ^( l. o$ H - #define DMA_PRINTK( x... )# j: f$ [3 [$ k m$ d
- #define DMA_FN_IN
% n0 c+ s o" ?1 g# L - #define DMA_FN_OUT
% [" h- P0 x8 q* e3 l3 B& ^$ r - #endif
. ~# ~3 T; U" p; C2 T9 Z - . P' p& T4 ]6 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& v) \# g2 j) i
- #define STATIC_SHIFT 3
' L/ K$ b. i, b8 d - #define TCINTEN_SHIFT 20
* i# t4 ]8 \- k' m' g* D) E. S - #define ITCINTEN_SHIFT 21. I) K% q' h) |0 \: E& q1 S2 }" Z
- #define TCCHEN_SHIFT 22, y# X0 y. X' @3 s* a: Q
- #define ITCCHEN_SHIFT 239 b8 ~/ q& `# D; l, T
- / q1 T( u- ]/ s' c6 u9 D( T" D/ X
- static volatile int irqraised1 = 0;
# z+ Y) c/ ]4 L$ ^ f* ] - static volatile int irqraised2 = 0;
. f6 W0 |9 | n - 5 e: m1 a" F2 \/ q1 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [. c4 g$ ?( D0 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 P2 r4 y z7 T# o9 L8 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D: y: s' A7 O) N4 j, B! t
5 J5 m' M- r' J9 b# E1 o$ g- w% N# F- dma_addr_t dmaphyssrc1 = 0;
. Y( E8 Z" \% C S* U) M: Q - dma_addr_t dmaphyssrc2 = 0;
+ C. o3 F* s4 {6 A - dma_addr_t dmaphysdest1 = 0;
- o# v6 S: @9 F5 H$ w% R; r - dma_addr_t dmaphysdest2 = 0;& \$ `. F" N' ]8 v( c0 O7 Z9 ]0 f
5 w' s5 {) Q) Q2 ~* E& j' W6 p( G- char *dmabufsrc1 = NULL;
7 v* y N3 t, ?" z4 H5 { - char *dmabufsrc2 = NULL;
3 C5 ~3 F8 p9 p1 ^- W6 x6 S - char *dmabufdest1 = NULL;
; l' h( B" T \$ |, ~5 Y - char *dmabufdest2 = NULL;
2 a- h0 {( X8 W6 @ - + ?! l5 g1 U8 i+ O- O
- static int acnt = 512;
( W- t o4 `4 _1 e; v* k) l - static int bcnt = 8;
' x/ g8 C: T, r7 k2 n' c$ P - static int ccnt = 8;
. N5 E o/ d- K4 r K9 C2 V, b - 0 W6 l B( f) e% w- j' o
- module_param(acnt, int, S_IRUGO);
6 n; @1 \+ @6 t7 i% h - module_param(bcnt, int, S_IRUGO);( C' o" C( C+ o& f- \/ m3 }, r- l
- module_param(ccnt, int, S_IRUGO);
复制代码
0 E2 R- I, ~! p/ S# p* k/ ?( ~
# s, ]" o' E9 L$ S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g. g" ]2 ]+ ^: Q p1 T9 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" F9 V1 t+ f6 i% N5 N) @& e2 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 m2 J; N& z* ?+ e2 I' N/ H
, I; B/ Z" ^9 x* [( R" F j- m+ C, @3 J
|
|