|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# y6 C. P; U c- [code]EDMA sample test application, q1 I, ]; E6 x( l3 v, Y$ g5 ^
- /** H( Q; g6 w, A3 b5 q
- * edma_test.c
9 I% {5 V9 Q, z$ e7 ~: i - *
8 M u9 n( g* X" ^) } - * brief EDMA3 Test Application1 n" ?& Z! L4 ]5 i; b! b) e
- *6 K- y/ g$ V6 {/ v6 L+ X
- * This file contains EDMA3 Test code.
$ [ ~2 U) y* r7 b% c - *, g4 P) A) ~) S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n Q1 C* E4 Y, |6 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: i* y4 x! h; F! \& A. d
- * TO CHANGE.
. V; k* s9 @+ M6 b5 O- U; ?, | - *1 X& ^. y! o1 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// |; Z( ~/ G* @; b) z
- *# g. _; q! p% C q6 l/ I* l
- * This program is free software; you can redistribute it and/or3 f. h" Q) s i' n1 n
- * modify it under the terms of the GNU General Public License as
! N! s% v |6 C' D, X$ d - * published by the Free Software Foundation version 2.+ k: m) Z( a- U v
- *. z9 z: r/ K1 L/ l j7 _1 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) y$ e) \7 r+ O5 B
- * kind, whether express or implied; without even the implied warranty
* M( u1 B: F( d( B! e2 ~3 V. p8 t2 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# e( C- B* i/ `8 \. T* f4 ~ - * GNU General Public License for more details.$ @4 F& g5 Y# H& ]' Y2 }3 l
- */
3 j( g+ R% r* S; L& T. @( N
$ C+ Y: o/ G. d! s. m5 b- #include <linux/module.h>
' [% i5 }1 ]+ n! \ - #include <linux/init.h>
, k5 `. C+ [6 U* r - #include <linux/errno.h>
2 F$ e, Z* ~ p( p' }1 B, ]$ ^ - #include <linux/types.h>
: E+ C2 g0 y: Y' u3 X - #include <linux/interrupt.h>$ q$ r0 k {8 E/ l
- #include <asm/io.h>8 L! y2 r! h6 I; d' P- `
- #include <linux/moduleparam.h>: C( q! S, W2 K' `# L$ I8 g
- #include <linux/sysctl.h>8 V7 B; m1 a# r1 f: T
- #include <linux/mm.h>
4 W ` l6 D$ u4 d# K# W3 r% A - #include <linux/dma-mapping.h>0 a# n% K! R+ J. M3 n
+ F f& @# U6 @" z3 S) M. z' \- #include <mach/memory.h>7 {* w$ p, Z6 C: a/ l2 |
- #include <mach/hardware.h>
" z* b) F% D b - #include <mach/irqs.h>4 }0 J& Z2 s- C; [3 M3 K
- #include <asm/hardware/edma.h>
8 \4 Z' L) I( H; q - ! c) F/ w( i# o$ S6 Y( b5 b+ s" S- R
- #undef EDMA3_DEBUG
- Z; e+ H! ]$ x2 f2 y( F - /*#define EDMA3_DEBUG*/
T, m: v7 b1 N0 ]2 d - ; k7 F, M( B9 z- s3 M7 g4 w
- #ifdef EDMA3_DEBUG; [- Q% |4 h" }6 e! r1 d! _) K+ o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), z0 c/ D* X0 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C" E# i5 u- |- T' Z0 \8 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 f' s5 i+ ?* s1 h2 V. Q! i
- #else: Z# _1 j: A1 s* w9 H" _
- #define DMA_PRINTK( x... )
5 v9 m5 F5 x. w+ w) X% b- t - #define DMA_FN_IN
, W4 V+ [4 N! m" o; | - #define DMA_FN_OUT
: l+ }9 b+ D8 b& K - #endif. E9 j* m" o6 n* ]/ C
" l9 Q/ }2 B; M X( g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ]6 }! F+ p& ^% d% Q5 G - #define STATIC_SHIFT 3
# D9 q- N4 N; I - #define TCINTEN_SHIFT 201 x1 k: i9 p7 J& Y0 v: W- u" t4 h
- #define ITCINTEN_SHIFT 21
9 D, c( E, S( t - #define TCCHEN_SHIFT 22
. G1 S$ Z' Q3 ^& r4 s! ] - #define ITCCHEN_SHIFT 23
2 X) {* v8 f% U. b9 _
; z# A* L' B1 d& ^! J5 z8 k- static volatile int irqraised1 = 0;
( W( V2 \ d9 M1 j - static volatile int irqraised2 = 0;. Z: X2 W7 W2 ]6 c
- ( a; ^, j1 Z2 U) P4 @- _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& P5 d9 a3 C3 c$ p; ~0 I7 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l' r/ l# M+ {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); b) M" ~3 I! V8 v# ~! \
: T" ~/ i$ W4 r- | [- dma_addr_t dmaphyssrc1 = 0;
- E' M- K$ e& d+ E - dma_addr_t dmaphyssrc2 = 0;
9 y! x2 S) ^# A V' ]* g - dma_addr_t dmaphysdest1 = 0;& y9 f& \# N0 Z( k
- dma_addr_t dmaphysdest2 = 0;: E6 U4 V' \- m+ l$ D+ f: D; f; M
8 U% j5 F ]/ k2 V8 Q* }# E- char *dmabufsrc1 = NULL;
* ?8 O$ v2 g" ~/ S3 U9 p - char *dmabufsrc2 = NULL;+ c1 F3 ^, x9 h7 U! m) N9 e) c3 A
- char *dmabufdest1 = NULL;, ~/ J' h6 P: R
- char *dmabufdest2 = NULL;5 z7 X. h3 U1 l0 Z; q% Z
2 ^5 q8 S/ \1 M8 Y4 W) Y. \- static int acnt = 512;
$ O' P. e* u% ~; O - static int bcnt = 8;: q4 {1 u5 H# V
- static int ccnt = 8;9 H2 A) P( `' y: n2 a; [/ v
, d5 v A; V# K5 ^* h, B- module_param(acnt, int, S_IRUGO);1 `, E1 W* A8 E" t, [; ]) Q
- module_param(bcnt, int, S_IRUGO);
5 A7 E" J y' U) h6 q- G: d$ U G3 A - module_param(ccnt, int, S_IRUGO);
复制代码
7 B# n7 l- ^8 t5 m, f Z4 g* l
! f- q+ e8 \0 }8 H# e: a1 i& G, B ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ^/ C5 T; ?8 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 g5 v3 e# t% e. p4 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# a2 p* M6 @: [% A* d
- J; g7 R: J$ P6 h3 c$ T* j- {
1 z; B# G" t. L, N) e
|
|