|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 p) \" w1 Q8 Y- L- [code]EDMA sample test application
. M$ b" g% u, v; h - /*
. g& |) y$ x( p! @* j5 g - * edma_test.c3 o8 V! G3 z1 z+ a2 W3 O
- *- a1 z9 q- i4 C0 N' c) R- K8 b
- * brief EDMA3 Test Application
. E: N% ^6 W9 }% j3 @7 U/ l+ p6 b - *# p3 l2 Y/ C5 _# G @9 a1 Q
- * This file contains EDMA3 Test code.
4 i# V/ l# Z! L' |7 @, B, o. ?0 V5 R - *
7 f3 L. m9 J+ t" A8 q2 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; y1 }2 f# L$ f) ]3 X# E: l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- E: D/ `: b# e( } - * TO CHANGE.* S9 {- P P# r# W* S* ]
- *9 g$ ^5 o8 a7 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ J; M$ P& I3 d2 C# Z( G" g
- *
! n( M; h, c/ `9 D7 I {- e - * This program is free software; you can redistribute it and/or) ?0 r& p+ b. F& B# d3 R
- * modify it under the terms of the GNU General Public License as
5 g }1 F. K* \ G1 J: Y - * published by the Free Software Foundation version 2.# T) R, F+ g0 k1 Z( p$ I
- *
2 M( S! G ^8 b, u6 n- T) S# C5 N# z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 M/ L2 `% z4 |: |, \ - * kind, whether express or implied; without even the implied warranty" O9 ] o$ Y& B" J5 h5 Z( b2 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, X+ V) i7 H" Q' D' [) P
- * GNU General Public License for more details.
" X: m% B, r# t: G# i5 S( B" V - */. |/ v: a* j6 V; }9 L/ V( M; \
, h9 B; M M9 m2 Y* D& R- #include <linux/module.h>! G. K0 P0 i( k& J; V. t$ h
- #include <linux/init.h>
" `9 o6 k* g3 ?2 B' `& k1 D - #include <linux/errno.h>; Z- G1 B( X' e4 G8 J
- #include <linux/types.h>
* V, G# }. @% m - #include <linux/interrupt.h>
/ H. c+ Y4 c- F. |4 d i& e: b - #include <asm/io.h>
; x6 V7 f( ~9 T5 V1 C9 [ - #include <linux/moduleparam.h>! R4 P( m" s8 [. d( L
- #include <linux/sysctl.h>
/ c% H+ b( Z* f4 e( `9 o - #include <linux/mm.h>3 g# |) R9 X2 J( {$ }7 y
- #include <linux/dma-mapping.h>
" k1 R' x- t: k3 U - & _) {+ Y) L$ u8 H9 f3 ]
- #include <mach/memory.h>
3 Q0 i! n; S0 C( O3 M - #include <mach/hardware.h>
$ I8 c9 z k0 q: H( a( ] - #include <mach/irqs.h># Y6 T$ {2 a9 o' x
- #include <asm/hardware/edma.h>/ Q" B( g/ q+ p5 K; C! o6 d
- * z. Q1 w1 i# ?
- #undef EDMA3_DEBUG) a9 J- Y$ a0 N
- /*#define EDMA3_DEBUG*/
9 b: \) a7 J% L
s; Q: |' O* d, t- #ifdef EDMA3_DEBUG
) ?! r t, j) i+ H' g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 [% X1 e/ _4 ` T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- n& U6 N% H7 G. ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ M+ x, t: N' K5 P R$ E. h
- #else8 v# i- `: n3 b, P& ?6 g7 b
- #define DMA_PRINTK( x... )/ s. A! [/ l5 o; I& l: P
- #define DMA_FN_IN9 I/ t/ A `! Q3 I4 I9 ~1 u
- #define DMA_FN_OUT
- E; v* Z. }) F0 P+ \8 E - #endif
: g4 E/ O+ `) i9 y0 P
8 j; l+ H4 a6 n$ g' E* `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& O" U9 ]9 p5 Y; H3 ?' @1 W6 | - #define STATIC_SHIFT 3( B3 l3 r' M) K$ c/ [4 [! I
- #define TCINTEN_SHIFT 20) W. @/ r3 [ |6 d
- #define ITCINTEN_SHIFT 21
- g1 O2 B k4 A: q# Y6 g; f) o6 h4 V6 b - #define TCCHEN_SHIFT 22
5 d3 z9 n1 _* G$ g* ]+ j: p - #define ITCCHEN_SHIFT 230 C! x4 _" j8 c
/ o$ f1 ~3 `4 O. ^- static volatile int irqraised1 = 0;0 g- Z) J) S# F0 y- J1 B
- static volatile int irqraised2 = 0;
' q2 O' X2 V; m2 M
. @* j! U6 H; @$ B/ n2 R" [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C6 \7 k9 Z. ^2 ]3 ]/ Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
^5 a' Q. x- I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _4 A- N# u& W* w/ u
- ! h1 L h* Z5 y/ t! b ~
- dma_addr_t dmaphyssrc1 = 0;
( `3 T6 a5 x. `4 K- N! q - dma_addr_t dmaphyssrc2 = 0;, I6 [" S2 l* n. `' A
- dma_addr_t dmaphysdest1 = 0;: [1 u, {5 A- w, r1 _' k
- dma_addr_t dmaphysdest2 = 0;
. c# S, v; q; _1 A+ P+ K
( U+ J9 [) r) A: L) i- char *dmabufsrc1 = NULL;! g) p; g) k# S r
- char *dmabufsrc2 = NULL;
( o: w2 u+ F& j% { - char *dmabufdest1 = NULL;* n9 F1 D8 T* S$ c5 S9 L, E7 `
- char *dmabufdest2 = NULL;
7 K2 W/ Y! |6 j2 ?5 I& ?
) u5 M1 u2 ~( x- static int acnt = 512;8 h3 C, {0 n; S/ }7 r
- static int bcnt = 8;( s5 s$ R5 k1 j: n& @, ?: [
- static int ccnt = 8;
, N- k9 F/ n$ z U& a# y* a - 4 t; k$ a/ J3 N& c) N; D* ^
- module_param(acnt, int, S_IRUGO);* D( `# J% Q" Q2 \3 I
- module_param(bcnt, int, S_IRUGO);5 y0 o+ g! [; {5 |8 M& o
- module_param(ccnt, int, S_IRUGO);
复制代码 3 N+ r% t$ m7 p2 X* t
7 Y/ U, j [7 o K* [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! X3 D2 X1 P3 p6 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' E1 O, I/ Q9 E2 h7 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: E) R) x4 n: |# i# C
- Z- M9 x: B' M9 j" c& [# e& c
9 I, M. z V/ C p3 a* x |
|