|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . U$ }* `( N- @2 O$ h
- [code]EDMA sample test application
- V- s4 X- L4 ?" C% R" l: D; L - /*
3 e/ H/ B& {# |5 R& {8 k9 D% l - * edma_test.c/ N9 y- L* f2 L& y* k1 {7 H' J
- *
$ X1 I L# ]; X. d$ W; ` - * brief EDMA3 Test Application3 E; ^2 m+ j- o$ ~2 D6 U+ h6 O
- *# ^5 p& W: U' W7 d7 ^% i4 V0 e4 O
- * This file contains EDMA3 Test code.
' Q/ `9 a. g' N - *" [- c- `- l+ ]3 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" R7 A$ [2 q7 G% D# K6 @. P- _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' k% Y3 ~& d# P7 A4 U m4 W, A3 O - * TO CHANGE., }6 \4 F' m- R8 V7 t, J6 `
- *# E' b% C; {7 u3 a5 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
s3 X5 Z1 b0 B/ e9 n% t) D* e0 } - *
9 ]( E2 T/ n f0 c2 o1 J3 q3 t4 H - * This program is free software; you can redistribute it and/or" h4 a6 x0 W( v2 _$ y! }9 a
- * modify it under the terms of the GNU General Public License as
! `) o* K" X% M, J C* ^ - * published by the Free Software Foundation version 2.4 }" `' l. M( t; A$ F7 V
- *
- r; d4 ]; G6 p9 x' \- ^, x) R) n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any l0 o- A( g. {2 Q
- * kind, whether express or implied; without even the implied warranty
- q4 r' D* o, l5 e O8 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% e2 m0 u( G. c, h - * GNU General Public License for more details.
2 z6 [/ ~+ P" T8 J - */1 o& n0 U! [+ u5 o6 O _0 q
" z5 {6 P+ L0 E; T3 \- #include <linux/module.h>9 X6 u/ d1 I/ C4 j! r
- #include <linux/init.h>
& i" O4 s4 m |% D! o - #include <linux/errno.h>5 I+ e& L# ^' Y& L
- #include <linux/types.h>/ H o; ?' c' X S @' q H
- #include <linux/interrupt.h>5 c5 w& |, {* H$ c7 I4 A
- #include <asm/io.h>0 z8 w% {& k; O1 A6 ^& R
- #include <linux/moduleparam.h>
3 ~1 V' q% f2 s: q$ F+ s' E; M - #include <linux/sysctl.h>7 P3 v q( D. V2 z# @. `
- #include <linux/mm.h>
4 o+ `6 q! ~( Y" M8 Q0 [ - #include <linux/dma-mapping.h>
& K I% _) d% o" h+ U - . [# R5 y# e! y: l2 I
- #include <mach/memory.h>: ^' y8 K( b, d. @% ?: f
- #include <mach/hardware.h>
# `8 W6 E( C7 L1 Y% n' ^% h2 V u - #include <mach/irqs.h>
/ `9 `4 [: L- D* q( g7 x - #include <asm/hardware/edma.h>
N: x5 x E6 i& U! ~" h) ? - . D+ _& ?. u3 P" C& s
- #undef EDMA3_DEBUG- H7 c2 e9 }6 O2 I
- /*#define EDMA3_DEBUG*/
+ N2 M- h2 e: S4 X9 ]0 H( x Q
6 U# l5 C" I$ Z- ~; G- p% d, L) }$ w- #ifdef EDMA3_DEBUG
4 ]0 ~( \5 \ y) \- J# \3 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 J( S, d% l! B# Q1 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& `" ^; B5 Z" h2 o# A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 ^: E* X1 e: Z6 _% f8 p - #else
( M* D! @0 f( M1 ~* ^: s! j$ t4 R0 o9 @ - #define DMA_PRINTK( x... ): x5 v# H; Y3 ]
- #define DMA_FN_IN
4 C% a# i7 n/ [( L- M& e4 ~. [; j - #define DMA_FN_OUT
& B A, T* l6 R - #endif
+ [' ]; {3 R0 w d - - s! X5 Q. J4 L" m2 _! ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 o5 d) @7 O/ F( k; I8 \4 m - #define STATIC_SHIFT 3
0 ]* v- l( O: J2 q" Z" u4 U - #define TCINTEN_SHIFT 20# X% I' Z: a" Q8 Q& ~& `: ^# f
- #define ITCINTEN_SHIFT 21
7 @2 T" l, O0 t9 Z1 i - #define TCCHEN_SHIFT 22) w }4 s! i1 o7 e
- #define ITCCHEN_SHIFT 23
# U5 A" K: r* Q0 ^, {( l - 4 I, ?2 n7 P" A* ]! [: h! k
- static volatile int irqraised1 = 0;3 n, \6 r) B4 W0 y+ l5 T
- static volatile int irqraised2 = 0;
" ?& [$ N- V) Z: `* Q$ o& n
; C( t1 T- ~+ ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% l1 A) w ]: R; e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v- f, N/ C0 J* z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- J. d: m9 A- n; G* S - ( J# u# I8 x* K, E
- dma_addr_t dmaphyssrc1 = 0;
$ Z& o! W5 c/ \/ Z7 v; U - dma_addr_t dmaphyssrc2 = 0; M, k9 h& [/ h9 d
- dma_addr_t dmaphysdest1 = 0;% p( Y1 [9 L, I- W" f: |
- dma_addr_t dmaphysdest2 = 0;
9 j. o' n; m- u4 Z) ` - % W, z9 t* @2 E$ _6 d$ r1 ]
- char *dmabufsrc1 = NULL;4 A4 F; _$ g/ a2 S d% g
- char *dmabufsrc2 = NULL;
( P4 p+ o) ^% k - char *dmabufdest1 = NULL;2 R' w3 ]$ R4 N3 s3 o
- char *dmabufdest2 = NULL;
8 z$ B6 G" r# I0 K - % _: t/ J. A( @$ A. X$ _0 z, D4 m
- static int acnt = 512;* r2 W9 L% E3 R1 I
- static int bcnt = 8;- N. A9 g2 W# ^1 _- s
- static int ccnt = 8;
?9 |& f2 Z k& s
& ^& n/ D8 m" ~# ]- U& b- module_param(acnt, int, S_IRUGO);0 t2 O: r3 [1 T) Z2 ~9 P
- module_param(bcnt, int, S_IRUGO);
: V6 J! ~0 U: t! n8 p3 H+ n - module_param(ccnt, int, S_IRUGO);
复制代码 9 R3 d* W; z- I
& x) Q( d! J# W. K0 {% b2 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; J. p+ D1 t3 jarm-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 T8 y: v4 W0 i% d. a9 z3 O* W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 D' d4 h' ]4 R7 T8 N( V, N
* i! p% P- L/ \8 }7 x# c; N `; V% C6 J$ [! @/ S1 D& x) j" p
|
|