|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; j# N/ c# w9 i- [code]EDMA sample test application
/ {* t/ B+ O3 c: i: R - /*; ~ P! J' Z3 V, R( _1 W
- * edma_test.c) T6 l- Z1 W+ m/ J. D
- */ X/ H# l- j2 n2 A! b6 n% X
- * brief EDMA3 Test Application
/ f. _' X8 x5 O* I" U. _8 W* O8 V0 N - *! |/ ]0 p9 |9 g9 e
- * This file contains EDMA3 Test code.
1 g& o. R; x, z2 ^ - * h# S9 O3 j3 N8 p- k1 ]3 |& f" ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 k+ C$ {5 B1 P) Q. Z; e d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ]- Z8 S+ S. R0 E% J& m) t4 ?. } - * TO CHANGE.: y0 x" f5 f+ y" \5 b
- *6 y( x9 K, {! m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 N0 a: j8 F9 B( F - *
9 b/ v+ M& b3 v - * This program is free software; you can redistribute it and/or
, Z+ m8 I- _' T i1 |4 F. X+ e - * modify it under the terms of the GNU General Public License as0 N0 b+ \1 T' v4 j, C
- * published by the Free Software Foundation version 2.
: `2 d, C' J+ K' v - *
1 Z3 B' z8 o7 Z3 O9 I! O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: {! x, B' b. _' L: I t6 ] - * kind, whether express or implied; without even the implied warranty
' }' }% s3 P8 y) C! } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' f3 h" O5 i. o5 ?7 n2 r - * GNU General Public License for more details.) Y) O" ?8 h7 b) i3 L$ m2 i$ W: l
- */
$ o6 Q/ A0 T W# W! V8 `. A5 X9 ~
" H* [, X3 J# b$ U. N- #include <linux/module.h>+ d+ k) Y' x8 L/ b, B
- #include <linux/init.h>5 w/ a" U+ _5 q9 Y2 ?: Y
- #include <linux/errno.h>9 y! G8 O6 \: [9 v% d. P
- #include <linux/types.h>! j& w; k* f1 A8 M
- #include <linux/interrupt.h>
& R+ H- m3 h. d- T' a2 ^ - #include <asm/io.h>7 L; P' ^3 L5 c/ y6 a
- #include <linux/moduleparam.h>! X/ f9 H! P3 L/ i* {$ g; ?, b+ ~' X$ X
- #include <linux/sysctl.h>5 N; z; @! S0 R' v8 k8 R
- #include <linux/mm.h>
# v/ d7 w7 ^* k- \- f5 s - #include <linux/dma-mapping.h>
- D( Z* u T" W( _: f - ' F9 `0 r, I/ g9 f2 Q
- #include <mach/memory.h>( S* K$ }- e: U8 M
- #include <mach/hardware.h>
8 h7 N2 l7 n0 G$ M - #include <mach/irqs.h>
/ `2 a) K8 o6 F1 x( P2 ?4 X - #include <asm/hardware/edma.h>( k% V# `+ @% z! | E* e
- " Q7 c) m+ r( X) d3 L$ ?
- #undef EDMA3_DEBUG" |1 F* W" \' _1 w
- /*#define EDMA3_DEBUG*/6 S; O+ M+ }! X6 E
- ( ] g, z, u1 P# R
- #ifdef EDMA3_DEBUG# r1 j+ z l- n+ q! l1 D1 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! h) P" g$ ?( ~& z2 k, B) h' b' m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& O6 w2 `7 l8 y. j- t: ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: h0 @% X' a( w& n2 ] - #else
; i$ _) k$ ]. Y& K5 z7 l - #define DMA_PRINTK( x... )
7 Y+ K r6 f( r; W, f - #define DMA_FN_IN/ v( S' t: q, Y3 i8 p. X% d2 D6 v
- #define DMA_FN_OUT* R& Y" l- ~( Q* n
- #endif6 r* e- G& W, u" E2 w' G, |
- 4 ~ B$ T9 [) Z) w3 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" `7 z& x" K) N9 C: V; _9 s
- #define STATIC_SHIFT 3
0 X! V6 U7 }) S" ? - #define TCINTEN_SHIFT 20. C. T4 {8 j2 I- q
- #define ITCINTEN_SHIFT 216 L) J1 c* F, u$ v
- #define TCCHEN_SHIFT 22
& p9 X- z }' s; L8 U - #define ITCCHEN_SHIFT 23& i, a3 y% Q, v; R$ B5 F
5 T3 r2 K5 f m$ T8 Q! i- static volatile int irqraised1 = 0;2 _! s$ ~9 T; k" o! E% R, M
- static volatile int irqraised2 = 0;
6 l, B# c o1 C L4 {
4 {" R' | s# x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! \ g/ B6 M; o9 A9 k6 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 A' ?) e2 E6 d1 C1 i2 o0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H' ]3 \- d# l* i: z
- `& t+ Z3 o1 d- dma_addr_t dmaphyssrc1 = 0;/ C' p2 F& U8 S
- dma_addr_t dmaphyssrc2 = 0;, d, S9 E+ Z3 W% ]: _: J
- dma_addr_t dmaphysdest1 = 0;
1 @$ f+ B) F5 a6 T6 G6 O) ` - dma_addr_t dmaphysdest2 = 0;$ H# u3 S1 {/ H/ L* v" T5 R
- + J5 D9 p3 ]; M" _' u# k0 Y; I
- char *dmabufsrc1 = NULL;# M( R3 S1 ?2 i2 T9 O
- char *dmabufsrc2 = NULL;
9 I0 x( f9 Y9 } - char *dmabufdest1 = NULL;
" c( b* ^9 Q+ r8 r, G) W8 L6 R8 ^ - char *dmabufdest2 = NULL;
7 {( ?& \; L) M" c+ w - 3 f8 ~! f6 X- t
- static int acnt = 512;0 f3 \# T3 H/ M6 u
- static int bcnt = 8;
& J& n: z, s1 g9 N. X - static int ccnt = 8;
$ y2 ^/ H! v4 n. `1 K
) j+ K& b! ~+ E# `: t, w6 c% {7 ?/ y h, C- module_param(acnt, int, S_IRUGO);
; D. u: a8 U9 U/ O2 u* Z P5 | - module_param(bcnt, int, S_IRUGO);6 W l" M# @/ Q+ p* ?
- module_param(ccnt, int, S_IRUGO);
复制代码 2 _: q( t+ S9 [
7 z7 e% G! d* w0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ S) H! v) i7 N; B# u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C6 G0 t: j3 I: h3 I" ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, p; e7 w: T \2 c; J. N
. ~, H& Q7 O# G$ v
1 s; @0 _+ s% m( a; c8 S4 g* t |
|