|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & I) R' S9 Y- k, |/ S$ \; v: S& ]) @
- [code]EDMA sample test application# J% b" b' G9 J- ^2 _
- /*
- j! r ~! W8 P' ^8 x5 B+ R - * edma_test.c- [) b6 B X* Q) M6 W7 x; t
- * x4 H8 [; o# o9 A4 }
- * brief EDMA3 Test Application
# J1 b& m+ z5 o( q2 x- F( j `0 Z - *8 A; f- r6 J6 e7 @3 V# v
- * This file contains EDMA3 Test code.7 ]1 n5 ]9 P8 o$ w" A* @4 d
- *
) x' o' \6 w {$ n; Z; P8 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ^8 l+ J9 k1 x6 ~' |& Y/ }6 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ h/ Z- i. N$ p- _3 ~ p' }% h
- * TO CHANGE.4 g3 D* u% V: }- U) y6 g
- *
! a C, e6 X! }; k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 t6 R& v. a, a! h! L8 L' G& l5 u
- *
0 V6 z3 E' t3 a+ G - * This program is free software; you can redistribute it and/or8 c& `1 e% i# P2 F% Y! s u
- * modify it under the terms of the GNU General Public License as/ {# b8 v5 I1 f! b/ q1 y
- * published by the Free Software Foundation version 2.9 }4 A3 J; m7 W e$ c
- *
" i+ ^: m( `( D6 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 R" L! _, d1 E W- f' B M
- * kind, whether express or implied; without even the implied warranty4 Z0 M( {. A8 k: F# V% |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 R! B2 _/ o1 |, g
- * GNU General Public License for more details.. V. m+ h) l4 k& Z" `
- */
: Y/ v, x! @6 p! p5 W) L
1 c' _% V* L9 |- #include <linux/module.h>
9 ?3 l% G$ w# h - #include <linux/init.h>
4 T9 y* }& N6 z$ @$ c+ b - #include <linux/errno.h>
9 X4 N; w' ~3 g7 p g - #include <linux/types.h>/ j+ m( k" ^5 n7 \6 e
- #include <linux/interrupt.h>; J# X, M9 E% d8 [9 o$ T7 c
- #include <asm/io.h>6 n% I: ?3 r& |; {3 t3 Q, W
- #include <linux/moduleparam.h>) W6 e- V9 W- E+ r. z4 i
- #include <linux/sysctl.h>
! Y# r; d+ c1 F3 V9 o% S - #include <linux/mm.h>
7 q* c: Z" G. H% r0 ? - #include <linux/dma-mapping.h># D+ ~2 d. B4 \+ |: [
) N; I: q U$ \; [: O- #include <mach/memory.h>, ^$ f4 a- I& }& ?
- #include <mach/hardware.h>1 {3 V. Z2 | z' E8 H" M" J _
- #include <mach/irqs.h>
% Z1 i5 g6 c0 x+ P0 I - #include <asm/hardware/edma.h>% Z6 ^, o2 N) j ] ~
/ @ v1 m: ]6 i- #undef EDMA3_DEBUG
& n+ q# S3 T+ B, A( f( v3 i( p2 m - /*#define EDMA3_DEBUG*/' y4 e- |$ `! f( Q$ E- V
0 d$ ~! G( e, a. S3 ^* D# y0 _) J- #ifdef EDMA3_DEBUG
}# [; W w- [$ P. g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* P8 \ W( b( Y- T0 f! }" t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) [7 \8 Y: R7 [1 O5 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
}# C! _6 h/ ?( D. B/ T - #else, o$ F- W8 N' H3 P8 q6 s W
- #define DMA_PRINTK( x... )
0 j3 v4 T! J, m7 o4 n$ l - #define DMA_FN_IN$ }& o d2 s0 F0 Y/ x
- #define DMA_FN_OUT3 c7 B9 g) S( p, I4 p- Z$ I3 ^
- #endif
( ~( @. m/ R" P7 `
* O X: Y! p; Z6 U$ k1 U0 Y+ s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; m/ \* e; c: W8 b/ t - #define STATIC_SHIFT 3
& ], u8 ]/ {' R; O0 T - #define TCINTEN_SHIFT 20
4 n, S9 @3 _* q4 }! ^ - #define ITCINTEN_SHIFT 21 H. W" x4 N, k3 t; O
- #define TCCHEN_SHIFT 22
1 A7 R% x, L0 _. K- Y) y- n - #define ITCCHEN_SHIFT 23
0 t5 N: y' s2 Y; b0 t9 `* @9 v: I
i; _" T ?, {* J6 Q; f- static volatile int irqraised1 = 0;0 p% j; d% N2 z; _' g
- static volatile int irqraised2 = 0;
3 C1 Y9 r2 Y! O* k9 k
. e5 l$ @: n4 D2 ^) |" ]1 o1 q Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R% ?2 @, D$ W! O7 H+ N7 N: U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W4 W: N% i+ t% _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* |- G, c9 P5 a, F
1 u6 r1 ^# e/ d0 \3 N- dma_addr_t dmaphyssrc1 = 0; F7 s/ V4 k; l3 [* N
- dma_addr_t dmaphyssrc2 = 0;
5 P" E- }7 W6 v& x2 ] - dma_addr_t dmaphysdest1 = 0;
2 ?' P* H7 V$ Y& e' H, I8 P3 E - dma_addr_t dmaphysdest2 = 0;
- B; H j2 ?) n# O+ d9 }
" f5 `& D0 ^9 y: h0 }- char *dmabufsrc1 = NULL;$ ~* R) w$ J; y. \7 c
- char *dmabufsrc2 = NULL;4 i0 V+ [1 B H4 W" R
- char *dmabufdest1 = NULL;
, Y2 g7 ]8 B' M% U - char *dmabufdest2 = NULL;; p, ]3 Z5 i) n# W
+ b q( _% z" q, Y' b9 {. a8 m/ s- static int acnt = 512;+ m D" ?4 S+ ?# F0 U* J G
- static int bcnt = 8;
% _2 {& Q2 |% H2 W5 f8 L- s" R J - static int ccnt = 8;' k/ n( l: n* Q- Y0 `4 y3 D
( N3 l1 a! u: ^- module_param(acnt, int, S_IRUGO);# l+ l7 I$ V6 ?1 S5 P+ ]
- module_param(bcnt, int, S_IRUGO);2 U9 d* h$ C5 G7 f
- module_param(ccnt, int, S_IRUGO);
复制代码
8 B: ^6 [) j0 M" b& W# {! V3 U: [& \! b K6 L2 m+ O5 n3 Z0 n5 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, z) j; d$ K& f) ?6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( |5 ]& P! s% n" ^1 h2 x/ U- O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, `- Q8 n( C$ I& e( h
7 ^! Q3 e: o+ ~5 Y0 A+ v
( M+ B& M+ D @6 i! T+ H6 ~/ }; P |
|