|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 i1 J. A( O* ]+ [* p' l) ?- [code]EDMA sample test application7 s3 T( m, J. V( P' q
- /*
3 ]. j) I/ {" C4 J3 q4 U - * edma_test.c7 B, d; [- B% C" R& S7 f
- *
% [, z3 g( j: D7 l) O) I& J - * brief EDMA3 Test Application
4 N. F N- v; Z6 }9 y - *8 k% n1 Y# D) B3 t2 [
- * This file contains EDMA3 Test code.
; `' ]4 U# g) X5 b& U# a+ T( v - *; _, w5 M2 {3 G* k+ ~) b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 b6 [. f+ p3 B) G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! e8 W8 M1 P) o) t7 ~( j2 v& G
- * TO CHANGE.5 X, e# ]1 z; t- J z* l. a! ?
- *9 k+ F% f- B2 Q. I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 c& a, T) N# Q: j - *8 R o Q( x3 i$ J. ]* _ Y( P) L
- * This program is free software; you can redistribute it and/or3 [6 O$ |5 r0 \: y
- * modify it under the terms of the GNU General Public License as( p, p9 g0 y; T( O! g
- * published by the Free Software Foundation version 2.
2 d8 e* `2 x% w% A) n/ s - *' O/ E( E+ b, l1 H- g3 i3 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @7 U0 T% E" e
- * kind, whether express or implied; without even the implied warranty# V3 p9 b3 z. f4 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 a' z9 l% k5 O: N2 c1 o! w
- * GNU General Public License for more details.
7 Z+ v- w* [* D7 F2 l- k - */1 j2 R* M L- J
- * A- S# n/ N- W% T) T1 \
- #include <linux/module.h>2 l% ^3 z7 d" g8 z2 i) |1 M
- #include <linux/init.h># Z& l$ n( Z1 W* n
- #include <linux/errno.h>" R9 e/ Z! T& A. n- n! T
- #include <linux/types.h>
1 k4 C% d+ P; i+ o% \2 B8 w5 { - #include <linux/interrupt.h>
$ d0 Z9 Q# A% t- K8 t - #include <asm/io.h>( W$ t6 M6 E2 `2 h( i9 U
- #include <linux/moduleparam.h>
4 t1 L0 A; |4 g; P& T* y* m - #include <linux/sysctl.h>5 H2 A# @$ ]2 G: j
- #include <linux/mm.h>, n( n4 ] s; S, C9 y
- #include <linux/dma-mapping.h>/ r: w; |1 P `( Z
' I' M* ~; o/ j1 B# M4 U- #include <mach/memory.h>6 s) `# u2 V. U; N4 ]
- #include <mach/hardware.h>- S/ X5 ?+ M+ c! N
- #include <mach/irqs.h>5 P! ~$ B! O; x2 E! {0 c
- #include <asm/hardware/edma.h>( B3 Q2 @9 @$ e b5 p; K6 {: {
- ) d9 u) O9 K. @. {/ ]9 D2 [
- #undef EDMA3_DEBUG" t* u4 ]3 D5 A; }4 {
- /*#define EDMA3_DEBUG*/
. q7 R9 A" b# H/ ? - $ {: c& ?" s1 m- R! {% m# q" X; i
- #ifdef EDMA3_DEBUG
! C) f* Q9 t h! [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b8 X0 }2 N) m3 P& [+ I+ {5 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) }: X; W9 E1 h) [) `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& l9 g5 t9 y5 R) x; Z+ U- t - #else
2 W* W! P# x1 R' y2 P - #define DMA_PRINTK( x... ): K2 |# @: Q: Q+ M; W
- #define DMA_FN_IN
* P2 h. \6 \$ X; \+ j" d" Z - #define DMA_FN_OUT5 }: @' e0 \6 K) A6 _
- #endif
- B$ H& U# c- G' b
; i5 P% @! G* c, `& {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 g& X7 F) s( n; F4 c
- #define STATIC_SHIFT 3
/ ], A1 x! ~ ~; x0 g - #define TCINTEN_SHIFT 20& c+ R+ S6 ~5 @- k. |3 T K, q
- #define ITCINTEN_SHIFT 21# i2 s; P# O8 K3 @* ]& A
- #define TCCHEN_SHIFT 224 a7 C/ [1 Y) z* y H( g3 P
- #define ITCCHEN_SHIFT 23* J1 t/ B; Y' J
- 1 J5 Y; K+ ]! \$ T$ ^$ y
- static volatile int irqraised1 = 0;
$ | L+ S4 ]( k( g# l5 G - static volatile int irqraised2 = 0;7 Z: p1 X; S+ }
- % v. Q" B& I9 y* H, c2 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [2 t: Y9 e' J7 t& e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V9 y z" k5 D3 E, j. H& X' C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ O+ ?9 H4 p Z$ I0 G( _: \4 R - ! q$ W4 a9 i- W! i
- dma_addr_t dmaphyssrc1 = 0;# L: E1 P' i# F; E$ S
- dma_addr_t dmaphyssrc2 = 0;+ R( _& k f; h8 q1 f
- dma_addr_t dmaphysdest1 = 0; o" a% D/ X. E+ }
- dma_addr_t dmaphysdest2 = 0;, ^8 r5 O" L R) U( K& H5 I
- 2 e1 K5 h( \( v& m! ~
- char *dmabufsrc1 = NULL;( g( A; N, C6 D$ g( ]
- char *dmabufsrc2 = NULL;) S) \7 Y W& z) Y& L& ^0 F; v
- char *dmabufdest1 = NULL;& I. B; Z9 z& c! {2 Z
- char *dmabufdest2 = NULL;1 Y) o* S( K( Z% Y# a( |
' o' N7 X4 M0 [ b- static int acnt = 512;
) H' ? a9 `( R! h. w! W4 A. C - static int bcnt = 8;
1 v, u0 e' a* o+ a/ S0 B% _ u2 U - static int ccnt = 8;0 }( ?; r9 T) R8 a2 k8 \
- 0 N+ p4 B8 E% R
- module_param(acnt, int, S_IRUGO);4 S* k; o7 q- U
- module_param(bcnt, int, S_IRUGO);
2 F( A; a9 n' s: W) R' I& m - module_param(ccnt, int, S_IRUGO);
复制代码
! W) s0 y* G. I' R) d' ]$ A) N9 j6 {) b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f; t8 Z- h! O, {! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 G/ U M3 B) b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q, V2 ^; }/ j- \" ^! v7 \+ m' M
% J, b! j O# `
" ^/ Z/ Z6 ]2 C0 o+ _ |
|