|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , G+ t0 [+ @7 K. S, ]
- [code]EDMA sample test application3 J% ^3 ?$ \8 X+ z2 J/ h6 s) x
- /*; f) g4 g+ n& g0 U. i; X; P
- * edma_test.c% ]: q/ |5 |2 C$ w9 E; y
- *
D5 G6 ]" j i - * brief EDMA3 Test Application# J. [$ N$ X% L" A2 z3 t# C" V7 U. M
- *
; O. _1 V+ F5 w3 o& G; I9 w - * This file contains EDMA3 Test code.' c: u6 e: p9 }- m, T+ n+ ]1 t
- *
' i$ a( S* t0 F4 X8 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* O3 P: N' y7 g* D% |- E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- b9 F- p* Q, t$ B( S
- * TO CHANGE.
1 G& n; t' _! |2 ? - *, E! |: r+ g1 r4 i6 C' h' _2 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. @1 M- w2 ]7 q - *2 L L; C) T2 m: }9 K" A5 v, q+ r
- * This program is free software; you can redistribute it and/or
g5 S$ K; |& R; P - * modify it under the terms of the GNU General Public License as
4 @' I$ w& P( s# n6 |* ?8 b5 j5 B - * published by the Free Software Foundation version 2.
' b _/ A9 r- w, I' k5 E - *
+ p% B0 o6 l3 V7 A/ G8 v2 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' _+ v! X! `$ b7 R
- * kind, whether express or implied; without even the implied warranty
6 x; |# y+ r, c- ~! B& Z) U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ]5 R: x( U4 t1 y
- * GNU General Public License for more details.* w Z% U9 L2 q/ |# n; S7 X
- */
/ v' Q$ I1 g- z% D4 k/ V - % w6 m6 V4 H$ |4 w
- #include <linux/module.h>
1 s2 p- ^4 d# z A* i" ~2 g - #include <linux/init.h>% l# A1 I- m8 w( V Q' t
- #include <linux/errno.h>
# z% I3 h! [( W. ~1 Q& d - #include <linux/types.h>
9 Z/ P7 e, ^6 B7 N/ C* Z' o - #include <linux/interrupt.h>
: i" I2 S3 S: \$ C - #include <asm/io.h>+ ?9 l" y1 \4 q$ Z, G: R
- #include <linux/moduleparam.h>+ b# p! g B) [ }! L* W
- #include <linux/sysctl.h>
+ N, \# H$ X; e) z - #include <linux/mm.h>, ^/ e- E) `- _3 w' Z
- #include <linux/dma-mapping.h>
; J f2 U; d7 k
% D, |& y# \, }% J- #include <mach/memory.h>
! ^9 ?; F+ v) j- J) I - #include <mach/hardware.h># S7 Y8 r$ F" ]$ p1 J
- #include <mach/irqs.h>
% N; C7 y5 z4 Y. n' ? - #include <asm/hardware/edma.h>
: N+ y3 k: h5 ]
6 I) J: G. V! {6 ^: }- #undef EDMA3_DEBUG
2 v3 N! X( C/ w/ p6 Y - /*#define EDMA3_DEBUG*/1 C( {- F6 K+ F
& r4 Y% }( q5 G( V! L- #ifdef EDMA3_DEBUG
! P: g; r+ \0 Z* f1 `0 i! H7 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 P+ @% Z2 P8 _$ ?0 ]0 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ d* z* [& U( q" T$ U9 W& D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }: B! D" O9 E/ X* n8 {
- #else& F% H7 V+ s1 D: ]8 J
- #define DMA_PRINTK( x... )
; I' z+ Z+ I1 @0 O - #define DMA_FN_IN4 k/ o c2 n0 T9 o
- #define DMA_FN_OUT
4 ?4 u; u9 }( K. c R4 G - #endif
) N: |/ ~1 {1 `2 A2 e - ! W8 n! h1 X$ Q% E7 c: ~0 R, T5 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' x) g3 ~/ c( o - #define STATIC_SHIFT 3
8 A! A, J% o3 m. k - #define TCINTEN_SHIFT 206 H% ^) W2 ?! h- I& ^
- #define ITCINTEN_SHIFT 21/ c+ I R; c+ g. E* A) x
- #define TCCHEN_SHIFT 22. B0 e9 X: y" E# _" n, H
- #define ITCCHEN_SHIFT 233 O/ _% C, M! @& a. |0 F
2 A8 Q5 W" v5 @: r+ H; m- static volatile int irqraised1 = 0;
8 v! a' t8 L( h1 D* a - static volatile int irqraised2 = 0;& B3 \5 P( R; O. r5 @% h! o
- % s/ M ^5 A: i. D" P* ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 `6 z$ P* a9 {: G$ F1 d; r7 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~/ N8 ]6 C5 d) g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t2 E$ ]/ D0 t% X8 a: t/ X( ?
( d4 L2 \3 W5 w" f+ ]$ M- dma_addr_t dmaphyssrc1 = 0;" h1 e7 b8 R/ [0 L% h0 p
- dma_addr_t dmaphyssrc2 = 0;( m9 o4 [7 A# z
- dma_addr_t dmaphysdest1 = 0;# Y7 p: B4 o5 w# A
- dma_addr_t dmaphysdest2 = 0;
2 H* m/ J! {, Q" h1 n - ; C" ~7 V2 x6 [2 W9 u, s) {
- char *dmabufsrc1 = NULL;
+ h. h$ S# O8 w) [9 l - char *dmabufsrc2 = NULL;
8 y" c4 j( l e6 m) @0 S1 y - char *dmabufdest1 = NULL;6 E6 B4 O& S$ A, {4 G
- char *dmabufdest2 = NULL;
3 j2 O, L% n( I9 ^ A5 ] - " O" O) @; p5 u9 J8 Q& y% l( R
- static int acnt = 512;
' I: w) K! P8 p6 S9 `$ } - static int bcnt = 8;% C, e8 r1 L' f1 n4 A* Y
- static int ccnt = 8;( U# ~6 b" t" q; z3 Z
- # l7 [, r& \, h6 J
- module_param(acnt, int, S_IRUGO);
7 W# i2 L0 |' C/ K# k - module_param(bcnt, int, S_IRUGO);
& v1 V& h- m/ P, z; a. l0 {; W1 f+ s - module_param(ccnt, int, S_IRUGO);
复制代码 9 [; @9 P0 _* ]4 I" [: B
( H) z* E1 u2 u4 S/ u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l- D8 u4 y$ J% r; Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* l: {. [( l' ]8 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ G7 S+ {9 ^0 a1 k
2 \2 Z; V+ \! D: s* }
8 ]! m" ]: H9 A' b2 `) t |
|