|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]$ [3 V. l8 e7 W2 \ W6 U- q3 `! z- [code]EDMA sample test application$ g- X; q4 X6 K. {
- /*$ U3 L6 Y8 z0 \. C9 r5 y, N
- * edma_test.c2 N1 l: Q0 k% P' A$ l* U
- *6 R. U( V3 ?7 O) v
- * brief EDMA3 Test Application3 W2 \$ q$ Y/ y% O0 L$ n C. b
- *& M t& [8 F5 k: ~
- * This file contains EDMA3 Test code. X( c9 b9 l" @& Q J
- *0 n. [2 x5 L" _4 P8 L; }2 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 e0 I, Y3 z7 I2 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( w* f- u1 Q/ l# F# M - * TO CHANGE.' H) Q4 C7 W! k W4 S3 @
- *. ?1 k1 V1 }$ R8 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% C1 L2 ?$ G9 ~, w( s - *
8 `' J1 e: O5 ?3 [ - * This program is free software; you can redistribute it and/or' ?3 w$ L# A/ Q
- * modify it under the terms of the GNU General Public License as
1 C- _( x, S+ h. t - * published by the Free Software Foundation version 2.
2 y. V) q$ @" k6 c; b& [ - *3 M* I& D# _4 U/ z; s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y: d- g' R3 A4 U
- * kind, whether express or implied; without even the implied warranty
, U6 I& A% k/ c1 o+ |1 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, g+ a7 e: d# I4 [2 S3 H
- * GNU General Public License for more details.4 t2 I( F1 @8 r0 p. O+ R4 Q. [
- */3 x" _; f/ V1 C
- # O/ n j: x2 {- z
- #include <linux/module.h>; T5 {9 z# f- w( X6 k- g4 s! | e
- #include <linux/init.h>
6 t T A% g' H+ U% O - #include <linux/errno.h>
3 q5 k& z' y) ` O - #include <linux/types.h>3 n3 j2 q2 Q' _8 B# n
- #include <linux/interrupt.h>* D0 u: X$ g0 p) r5 u8 m7 c
- #include <asm/io.h># B/ [( W9 w2 ]1 ^
- #include <linux/moduleparam.h>
, X& Z1 t5 t5 K - #include <linux/sysctl.h>! O, A: K! d/ L, C8 R
- #include <linux/mm.h>
, r, w( |9 y; Z% p% g2 v$ A( X - #include <linux/dma-mapping.h>6 A8 Z/ W! f6 q
- $ S9 O* k: o$ R
- #include <mach/memory.h>
! t8 X2 X- ?0 r1 b1 N0 |* v - #include <mach/hardware.h>
$ K/ _, y5 e! L2 f- m6 O j! _ - #include <mach/irqs.h>( d: e+ u" _$ K; `. k# M) U
- #include <asm/hardware/edma.h>
8 l7 o' I; A: m! q- q7 ^ - : E: m, E. t |. P) @
- #undef EDMA3_DEBUG! x& p/ F- \, z/ X" e3 z
- /*#define EDMA3_DEBUG*/
p" z8 X8 p2 a: C
4 G1 J% u& {( T! v" }- #ifdef EDMA3_DEBUG9 u" r( s h' a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T( _$ ?+ W+ I, O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M& p8 T1 F; `( N1 a% o# _6 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 v7 r t. t8 U9 d+ @ - #else
. h6 ?6 E. Q3 K" a, n/ a7 s$ { - #define DMA_PRINTK( x... )5 U, f) u h" C4 G+ H3 A
- #define DMA_FN_IN
* d: t4 Z- _: {" w- K: a+ Q, t$ d - #define DMA_FN_OUT
5 o) c: f2 X1 A7 k" Q" P F - #endif8 b1 {6 Z( K) a3 ]
. O9 j! R9 `( I: v% |' ?7 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 W: ]- i+ ~5 g: j% A
- #define STATIC_SHIFT 3
# F& F1 Y2 D3 z - #define TCINTEN_SHIFT 20
3 G" b2 s& j; p( `: y - #define ITCINTEN_SHIFT 21
. ?4 F- X+ V5 s, m4 [6 Y - #define TCCHEN_SHIFT 22
/ q# C$ e. M. |8 K- V - #define ITCCHEN_SHIFT 23
3 J' m& \# L3 c- O- r, w# t: N - ' G% l' s9 N7 y% `& K% \7 |: c
- static volatile int irqraised1 = 0;
6 P0 u0 I5 x: S - static volatile int irqraised2 = 0;
5 o" y3 {" B. j/ D! C2 Y - $ \7 G9 E9 c v3 I l8 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N2 @3 B+ ?" o1 k3 D, j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 E' u- z4 i+ Z. k5 [' ]) Z- P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) o% E \* I+ d
" O& J7 d* b# x. J- dma_addr_t dmaphyssrc1 = 0;
2 ?3 s) d7 T2 S$ j3 o4 | - dma_addr_t dmaphyssrc2 = 0;
2 T: _% j( M4 f e0 l F3 w4 w. }& N3 t - dma_addr_t dmaphysdest1 = 0;1 Z( ~) H/ f; B
- dma_addr_t dmaphysdest2 = 0;
' T& c( v6 y5 ]8 v' L5 M' f - " j0 ]6 C/ ^* ?4 q" `$ A! H& a. k
- char *dmabufsrc1 = NULL;
3 F, O, B% j$ H* n/ i* H - char *dmabufsrc2 = NULL;1 t, ~0 W6 \8 V: D7 h0 g
- char *dmabufdest1 = NULL;
( j! r7 E; U; T/ e: j$ i - char *dmabufdest2 = NULL;0 R* D- a- t- @, H+ s
8 ^, }; [! r7 c/ U ~3 H- static int acnt = 512;+ v$ y" e8 o# L( N, D
- static int bcnt = 8;0 r) ~1 U" X t, G8 y$ {8 Q
- static int ccnt = 8;3 C2 }5 K7 m7 q# j { q) q. u
- . p, J1 Q3 X* q: A# A8 ]/ t0 y
- module_param(acnt, int, S_IRUGO);
" s& S3 ^) u7 G' j! J - module_param(bcnt, int, S_IRUGO);
: U0 w$ i- h) A5 e/ u: A - module_param(ccnt, int, S_IRUGO);
复制代码 . G' G- \. F6 ]+ G
+ q7 s- k( i- A6 l: C" s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" }) f7 q; [- d3 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
@+ k( S# y5 J( s! G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ M% X, r' G$ g' u
6 q) K8 J. [: J( s0 j; \# c
! {" ?+ S( L- f# F1 w |
|