|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : P m n9 Y7 ]. x, e$ R- @: w. Q6 g
- [code]EDMA sample test application$ a5 w4 g0 L$ E; E @
- /*
; \* s& [3 h J( ^1 V5 w! b, O - * edma_test.c
+ J0 N2 t- I8 R7 H) s - *
7 p6 m9 [: x* s( Q$ Q - * brief EDMA3 Test Application! n; b( |5 z M, L+ B' K! v
- *0 w" _4 ^& W9 y" M7 D
- * This file contains EDMA3 Test code.$ C; o3 \% f# |
- *
) _3 T8 `1 o$ F3 g7 v/ K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( x: q( ^! u0 ?: \ t. X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 h0 C' }0 V" O+ Z% l5 S
- * TO CHANGE.
D, W8 c7 i: F& E - *
: L g) J. |6 R$ i+ _. U& ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ k' i8 I8 R0 W6 v/ b) r3 o - *8 \4 v" W. W6 T/ M0 K" C/ K
- * This program is free software; you can redistribute it and/or
, A; |1 l& a: g: Q- l' X - * modify it under the terms of the GNU General Public License as9 ^/ d3 \1 V. H3 _/ d
- * published by the Free Software Foundation version 2.
" x' l7 w( F: N, g8 C: q: k - *+ B: I' W g! [4 q6 h% R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. w. q$ F% r( c8 B1 u2 ?$ Q7 ~% m8 k
- * kind, whether express or implied; without even the implied warranty
) ]* o: J2 m. j- U5 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ d4 U0 X2 C+ K: d: P9 C
- * GNU General Public License for more details.4 [% ^$ C( ]: u7 x: p6 @* o
- */
5 Z0 q' n2 l$ H. V3 x, A' G( M. p - - j* S$ Y+ ^6 s5 b/ J
- #include <linux/module.h>
* E1 W8 v# n% ]6 g - #include <linux/init.h>; \, K7 S6 H" w4 h% h! ?, m2 i
- #include <linux/errno.h>
T" Z9 R0 Y- A$ b9 y - #include <linux/types.h> w2 Z- Y/ t. I) ~: q1 a0 ?5 P* I
- #include <linux/interrupt.h>( X0 N$ l+ j: |( t! _* b: C7 p
- #include <asm/io.h>% ]4 l; C' }8 N
- #include <linux/moduleparam.h>
! |3 P2 e0 p0 ~+ f+ ? t - #include <linux/sysctl.h>
" r/ {# X2 }; i" r# M* ~ - #include <linux/mm.h>
6 A" a8 j; j! D6 u5 Q' V& A9 U - #include <linux/dma-mapping.h>* V) d+ d* W! U& i/ r% J
6 ?3 O! O! z4 m: y" Q+ @! }- #include <mach/memory.h>2 k4 s, ?: u% q( }' |7 p1 C8 ~
- #include <mach/hardware.h>
' I! i$ a' A3 U4 D - #include <mach/irqs.h>* K* q2 D9 {& ^- k
- #include <asm/hardware/edma.h>
6 w7 _# V7 L( @$ F5 w/ r8 `
2 n- l4 v; v& G- #undef EDMA3_DEBUG; m$ U ]9 a& f( Y ?6 Y7 V# `
- /*#define EDMA3_DEBUG*/, k$ O ^5 ]% P' ^! V; a Y% I6 i
- 9 D& e+ y1 V' B7 a# r- L1 ?% j
- #ifdef EDMA3_DEBUG$ ]- }& d% c( m7 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ~# M& h" U; x- G- Z; D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 }; {. v$ h9 r+ w. |' t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 u& F- Q# }: d; \. J% ]4 n( q
- #else
6 F) Z: U4 @8 b, _$ [* b8 m2 r9 w - #define DMA_PRINTK( x... )
7 Y3 U: h- I4 `" u3 `0 S - #define DMA_FN_IN5 t5 A' K% B2 }' N+ U+ S
- #define DMA_FN_OUT
, F m% _2 Q) r% ]( P - #endif$ X. r3 R* u* g/ T1 m8 [/ B
! u/ D8 T: A: l- f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( I H) a/ o7 O6 h+ o - #define STATIC_SHIFT 3
# O9 w- @1 Z" L - #define TCINTEN_SHIFT 20) M1 a# a9 E* B# A- [
- #define ITCINTEN_SHIFT 21, M P! ^1 N. ~3 A
- #define TCCHEN_SHIFT 22$ v, g$ j* ~6 n! N8 x8 W
- #define ITCCHEN_SHIFT 23
0 Y5 }7 V& u+ K( R3 X - ' b$ i( G" P0 T+ ~8 c3 o
- static volatile int irqraised1 = 0;
! F# m7 r* m1 S: T$ U1 H - static volatile int irqraised2 = 0;
- _4 G4 E/ x( q! {/ y) Y. Q
x4 ~$ ~2 x4 d4 ]. k! S) X1 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& z" D# ]' f7 W* G. t5 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q. r2 Q. X. m" J9 b) }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); k4 ~: L9 R( H
9 \/ A0 D S( T( G$ x- dma_addr_t dmaphyssrc1 = 0;
1 h3 C# x+ V- H" [* w5 x - dma_addr_t dmaphyssrc2 = 0;
2 l4 ^( \% v6 H$ ^3 i4 \ - dma_addr_t dmaphysdest1 = 0;$ A) a$ O6 Y% p e1 D+ b% L1 a. V
- dma_addr_t dmaphysdest2 = 0;7 V% w& }; u; k/ n' b" p0 K6 e
# f2 p5 O" C( R& g- char *dmabufsrc1 = NULL;
# w1 o S( K/ u2 ] - char *dmabufsrc2 = NULL;
9 r' [5 \) z4 D6 @$ F - char *dmabufdest1 = NULL;
_9 y, A% u. @. |4 R1 b - char *dmabufdest2 = NULL;5 N9 c8 }) b/ {2 W9 n+ j; S
* V! b# F! D. X" o! L# {. q- static int acnt = 512;
8 m! a0 p4 Y. L& D, h4 G - static int bcnt = 8;+ w5 c2 ^5 h4 N+ t+ ~- C W
- static int ccnt = 8;
+ V3 `) T) H& o9 g; V( s
, Q; x1 Y- W I! V/ F- module_param(acnt, int, S_IRUGO);
/ f) {. T0 h) G D - module_param(bcnt, int, S_IRUGO);8 W5 p) k1 A8 c+ n
- module_param(ccnt, int, S_IRUGO);
复制代码 2 Q( A% d" Y/ A2 N/ E A9 D
. [' b0 g6 W7 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S- c& }3 z" qarm-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 l% ?6 X8 R" @+ c' Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; [/ b1 a* U, t8 e
5 U8 z( H7 b) N, P! N; d$ V
: q4 Q& ?; X3 q) P |
|