|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % V" p/ F) W& u& B) B: m7 E/ B
- [code]EDMA sample test application
' m& y# C$ e, C2 i. h' m0 v/ ] - /*7 F+ s! k, f9 X5 h$ ~
- * edma_test.c8 Y1 U2 F- x" M1 S& y9 Z# Y3 T
- *
% h" }$ v: o N' \9 {' F& d - * brief EDMA3 Test Application
' h. K: h! z0 f9 T! L. q - *
$ i0 b+ X( Q- b9 { - * This file contains EDMA3 Test code.; d7 c: i. J0 p0 `0 w' |0 n
- *+ U& s( A( J8 I1 m p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 P% q% D& i' U s$ r0 E0 o* l: D2 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ H; ~3 e; a4 t& s/ Y
- * TO CHANGE.
5 q2 ^5 O' }5 b+ J - *" `4 _ ~0 O) e% f8 o3 e. F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* J3 g( m! E: @ r8 Z$ W - *
7 @# J$ ?7 Y7 s$ D- H5 |9 y - * This program is free software; you can redistribute it and/or
7 T% G3 s2 @8 L7 Q9 L5 d/ V - * modify it under the terms of the GNU General Public License as' [; M e) P: L& g! O J& ]
- * published by the Free Software Foundation version 2.
) h& r8 I' ?- E. S8 e$ j2 U3 ] - * f: W9 `4 z9 p; z* w/ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* x1 `* K" c9 e a+ f
- * kind, whether express or implied; without even the implied warranty
! z5 X; j; m$ Y2 Q: b0 m% Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ~/ g& h* W) P" Z* U* @
- * GNU General Public License for more details.
* T5 q1 c4 ^1 m3 O - */+ J! r* R# F; I1 S/ @0 {" y6 m3 m
" h" [" S' i; ~9 P( o5 E% V: `- #include <linux/module.h>& b0 N+ t( S% X& Q- O/ ~9 s; B
- #include <linux/init.h>6 G+ ?+ b5 f6 E/ P/ N
- #include <linux/errno.h>( [* h. n+ P2 ^0 l) N9 J
- #include <linux/types.h>; N: L3 ~$ m. e# T- f6 `
- #include <linux/interrupt.h>
* h u) H: r0 J" W/ h2 c - #include <asm/io.h>
0 k. } A0 c7 P) n i - #include <linux/moduleparam.h>" s, J p% `/ ^0 }; P9 |4 K- H$ Y
- #include <linux/sysctl.h>* O% q- z3 D$ _% L$ W& I9 p- Z7 K
- #include <linux/mm.h>
3 x8 t! z( s% }( | - #include <linux/dma-mapping.h>4 G$ D- D1 H, b# b$ W& l
; H0 Z, G& _! t5 q& O- |, c$ n- #include <mach/memory.h>9 F$ l: l3 ^/ ~# {/ J& @2 X2 V( H" f
- #include <mach/hardware.h>" v5 D) u) Q% i
- #include <mach/irqs.h>7 h1 L- c k: k E$ h
- #include <asm/hardware/edma.h>
- q# \8 b$ T- x3 t0 O! G - ' g2 w- Q6 m; y, T. s6 O E- @
- #undef EDMA3_DEBUG
. z4 M5 e0 u U" [4 b! f - /*#define EDMA3_DEBUG*/
, M0 {( j0 ?$ S1 e7 W
8 s1 X( z( g# L% f" Q/ W0 i- #ifdef EDMA3_DEBUG- M& c/ M3 J! Y% S" F: W9 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, _! ^6 x( c3 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 l$ ^& L% L3 P! i0 G' o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) g1 o* U3 e) K7 M: e3 W) Q7 w - #else9 m8 G% b$ P1 y
- #define DMA_PRINTK( x... )+ B1 z2 T8 c' W
- #define DMA_FN_IN
& ~: v" k) Y6 j( S* a' d; X - #define DMA_FN_OUT+ }' ]0 N0 X1 l) e& r8 P" s
- #endif0 K, x+ y7 O# @+ b A
- % ]! z) J8 @5 \8 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 j0 P3 }4 E' W+ O; D; r
- #define STATIC_SHIFT 3
Y1 Z& s4 ]# E ~$ D: ]7 D5 Y - #define TCINTEN_SHIFT 20# f) R. s' n. Z5 j
- #define ITCINTEN_SHIFT 21
- h4 h7 ]1 n+ k& d) z7 r' a - #define TCCHEN_SHIFT 22/ ^" Q' w" z+ y1 }
- #define ITCCHEN_SHIFT 23; T0 w: F- b& d
) y* X. \9 R% W- static volatile int irqraised1 = 0;
! m5 C! c# a# j; T8 ?! [& M - static volatile int irqraised2 = 0;. v+ C4 ]/ \7 z8 F* m( i7 J$ w
- $ r* D+ m7 e* \* K; x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ^0 A5 H& x- J/ h4 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z! X$ X# D: y8 e( n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z& S8 h, p9 H5 P
+ m4 J: F- a- J! U% s- dma_addr_t dmaphyssrc1 = 0;
/ z5 h* T$ }7 v - dma_addr_t dmaphyssrc2 = 0;
3 a$ C6 _! ?7 p( F) d - dma_addr_t dmaphysdest1 = 0;% f0 x. @" P f
- dma_addr_t dmaphysdest2 = 0;7 y( U. ~. }( B" H
- ! W0 j8 X. {: Y$ F f( R \7 i5 v" n l" d
- char *dmabufsrc1 = NULL;
9 w% P8 O. @* G! a$ e# k" B - char *dmabufsrc2 = NULL;' Z2 W2 k/ V6 z- v
- char *dmabufdest1 = NULL;2 [% N v% U! X3 W* x' }% v" x
- char *dmabufdest2 = NULL;3 d' f+ N$ y" K5 M
- % n8 {+ t5 v" Y5 P' o
- static int acnt = 512;) Z7 B) N/ b/ G6 i
- static int bcnt = 8;! R6 E' g/ \ T; z9 y0 N; R r+ s
- static int ccnt = 8;: O8 Z' {% u; V- N
- ; d' i$ M3 f. d- J1 c) V
- module_param(acnt, int, S_IRUGO);
/ Q8 v5 _6 N- B8 f9 U - module_param(bcnt, int, S_IRUGO);- c( e; S; } L5 \
- module_param(ccnt, int, S_IRUGO);
复制代码
3 ~) J; l$ P+ |0 @+ B. g$ n; L2 o& ^; P: d, H" }, ^: R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ^2 i# U4 s* ~; r- V4 w% Q' k3 {! k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y4 p; C9 x1 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a1 c( C8 r- \! r4 S0 t
. ^. S& [# o. p: l
- C ~) V! X% x! h, C! P3 R |
|