|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ d0 Z9 Y$ V% M2 }% n- [code]EDMA sample test application* B w; f( ^% l! ~! {
- /*
2 [4 a7 u7 W- l* Q - * edma_test.c
) w, U1 N; F7 g" c y% E6 D9 H+ A - *$ U1 W0 ]& D: Z. L+ I( O& `
- * brief EDMA3 Test Application
. S: _8 O4 x' D; j* t - *, l; n/ U4 f y& X' C" B
- * This file contains EDMA3 Test code.
/ }+ {7 F/ ?6 c) F8 D8 m9 h - *# @1 ]5 z; E3 `) x7 ?' f: U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& S6 i( H' X& ~* Z R1 _" a6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! A$ S8 w5 Y( ?; W% I - * TO CHANGE.
, s, [; y& i' ]2 E& e9 { - *
! d1 s9 [: B6 t) Y' a Y; @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! o: g( \8 O, I) s( k; B. Z - *
2 @" H! W$ X, Y8 z% i+ t7 o" J - * This program is free software; you can redistribute it and/or! J% K* \6 I1 W; m
- * modify it under the terms of the GNU General Public License as
" N* V- n3 L% }) C- \ - * published by the Free Software Foundation version 2.
% m# D) j2 n$ a) m6 B6 J - *
6 _; z; P& y4 D1 |3 l2 M: j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 w N( y: n" X& b6 G5 r
- * kind, whether express or implied; without even the implied warranty7 x2 q0 P2 K+ e" R( l& l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, P8 g7 ]* ?: ^# o. \- @ - * GNU General Public License for more details.& v- ^/ N( ]7 p) c$ Z' i
- */
* {1 A5 S& Q, ~# r) i' I
- C) ^3 q7 j3 ]5 w6 i" \- #include <linux/module.h>8 t% N- f9 k' U) ]
- #include <linux/init.h>
6 u7 |, Q( |# K! ? X6 C% M$ r. a) b - #include <linux/errno.h>
- M P( h4 f0 `# q6 a) ^ - #include <linux/types.h>
" N O6 S+ u) ` g' a! x9 ~5 X - #include <linux/interrupt.h>
4 U/ _6 A' q0 ]9 }" @1 A - #include <asm/io.h>. n! z7 W: `( m+ |! q" ^4 q
- #include <linux/moduleparam.h>
: t j/ o: t6 G( p - #include <linux/sysctl.h>
r8 n; D* I9 a/ G. v - #include <linux/mm.h>
5 e! h- n, e9 \( j* O# @ - #include <linux/dma-mapping.h>0 p( o; X9 a# _5 ?9 F6 A4 h$ _- N
( |4 Q9 A. C N/ B3 u; }- #include <mach/memory.h>) W, I: R, f/ Z: d6 k
- #include <mach/hardware.h>
% x j$ \ w3 r/ H - #include <mach/irqs.h>7 x. Q! L6 E) _( \5 C
- #include <asm/hardware/edma.h>
|1 m; A) y4 G$ l( E7 ~9 [) S+ ]2 \ - + t8 w* W/ t" y% L: w3 A) j. c
- #undef EDMA3_DEBUG8 _- H6 v! u$ ]
- /*#define EDMA3_DEBUG*/
+ C9 L2 G! o4 X& t& o0 y1 I+ f
' |; t) T3 T& ~$ g6 }$ S# P% E- #ifdef EDMA3_DEBUG( a, ^/ x s# M; f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 c1 k1 {5 Q, N% R- ^1 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( M3 t' }7 ?" g( _# R2 j. Z6 C6 w) } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) l" e/ K; Y5 G9 P- l6 i% M" @ - #else3 ?5 E: Z. {8 ?6 S$ |* o2 b& t
- #define DMA_PRINTK( x... )
' o8 r* k; d9 ^+ y - #define DMA_FN_IN' d, D2 S/ X/ K9 N$ o5 p0 ]
- #define DMA_FN_OUT
, e, @$ p0 h r; h6 w; `/ {. ^ - #endif
+ h; c- W6 j( V3 u2 T) N - 4 x& C; n7 n7 g! o7 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 \: c6 o' B. y# x; W
- #define STATIC_SHIFT 3 o3 G2 }6 u5 w: `/ P5 @
- #define TCINTEN_SHIFT 20
: @2 L Q% j) h) J - #define ITCINTEN_SHIFT 21
5 J$ L5 m0 C/ q H9 Y9 H - #define TCCHEN_SHIFT 22
" r2 w. F; r- f- o0 i1 U - #define ITCCHEN_SHIFT 23
7 I9 M3 d: ]3 y7 D0 O h5 X ^ - ) T, B& r/ H* n: ~; Z- s" ] v
- static volatile int irqraised1 = 0;: ?# H) G' s. S& x h7 Q
- static volatile int irqraised2 = 0;
8 f0 X2 T p u# {. V6 k8 V6 Q - 6 g9 U1 n8 m' O" d7 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' j4 i: |8 t1 |4 x5 h8 P% @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W8 f# L6 y. I% w) i6 ~ F# _0 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q1 v4 T4 Z* L0 X B+ x9 y
- ( A! a' j; {6 x2 k) Q
- dma_addr_t dmaphyssrc1 = 0;
2 a: r6 V1 v O/ i: v D - dma_addr_t dmaphyssrc2 = 0;
: `5 I$ s9 b7 _) {; ]" D: B# t - dma_addr_t dmaphysdest1 = 0;' H9 Q5 y" Z. ?& d# P0 a* J* a
- dma_addr_t dmaphysdest2 = 0;! o$ z; b5 ]9 S2 H
- 3 v5 D$ r- u/ U4 C( r3 g! s. n
- char *dmabufsrc1 = NULL;' V6 Y! x* |2 ?/ p
- char *dmabufsrc2 = NULL;
" `% l0 r5 c! z/ ~, ?; p - char *dmabufdest1 = NULL;' {/ \! \: O4 r G) M: F: u
- char *dmabufdest2 = NULL;7 E B4 ], }# b
- p" \ a% q w+ Y- static int acnt = 512;
( H% x; Y6 Z" a: X# R - static int bcnt = 8;" y. T" P7 B% a% e7 z* K6 E
- static int ccnt = 8;& |5 x) L9 q" U5 o9 U
$ U8 G! Z1 u+ v7 W2 V% u9 ]- module_param(acnt, int, S_IRUGO);8 A% b# @' G9 d( r
- module_param(bcnt, int, S_IRUGO);
$ N! Q+ k0 d/ M+ C- K9 n; B - module_param(ccnt, int, S_IRUGO);
复制代码 " z3 i2 i0 Z6 I5 U5 I1 `
" b% ~5 p$ r7 s+ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H) V: s. ?& N b( H) @& p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 y3 w: K: h" _7 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. R- M } `# x9 P3 k
* j1 l4 y% ~- v, Q* i* K4 P
4 O- B* _8 [+ F# j
|
|