|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 g3 N# ~! F* L. W; W1 E" r- [code]EDMA sample test application
! H c' M( B( o0 L$ ~3 y! x - /*
) o# p9 {$ s$ s8 f6 S1 }, Y0 T2 ` - * edma_test.c
% P( u& V2 b0 Z) J - *
" b4 } q$ K. C/ l - * brief EDMA3 Test Application
! `$ P9 }% P; s }/ Q" [ - *0 s. Q( F" N: H) _
- * This file contains EDMA3 Test code.: @% s8 S9 p6 I0 F4 D
- *
1 j* Q. m- f! r( g; F0 u+ A3 E! A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' S) Y+ b8 S/ h5 k2 C* u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' y+ J. H+ I1 n/ ]9 `1 @: b - * TO CHANGE.- x0 G0 R; n H' J& u
- *
; Z2 g9 F# ^* O, y0 C6 }. t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 I, t/ \9 g( i# w( ] - *& v3 ~3 A3 S' Q0 c6 f L6 _
- * This program is free software; you can redistribute it and/or7 z% w) G+ H! T$ b8 W
- * modify it under the terms of the GNU General Public License as2 J! D* q7 S4 U% ^# l
- * published by the Free Software Foundation version 2.* a$ z/ S5 H" n* `
- *; Y6 p( E/ t$ P: p ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ N- R) g( ]# v, D, a9 L - * kind, whether express or implied; without even the implied warranty$ {# V. c$ ]9 X/ U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* C& I5 Y" } o+ W A( j4 |0 Y
- * GNU General Public License for more details.: Z z' V- _" v5 }2 [; g
- */
l3 H8 U3 J8 i9 ~* i - ! `7 E: H0 D$ m; k7 s% D
- #include <linux/module.h>0 Z U1 a/ V4 I- I5 p
- #include <linux/init.h>
2 {: r2 M1 G& r) g$ K% a - #include <linux/errno.h>/ }. o2 U9 V! C d
- #include <linux/types.h>
& e6 `$ m: I* J! o% |1 u* Q - #include <linux/interrupt.h>
5 U0 _2 P0 R5 H - #include <asm/io.h>/ N! J+ i7 N; ^8 G) {
- #include <linux/moduleparam.h>
( R5 }! E' e) n" ?/ p' U+ P - #include <linux/sysctl.h>
. h, n4 q$ k7 x8 Q$ _: S$ o - #include <linux/mm.h>+ [8 S+ E& X9 V5 h. d- @- j9 P
- #include <linux/dma-mapping.h>
t% {# r6 ]) K$ F5 Z - 2 ?( T- o8 { ]! J% g# m3 i
- #include <mach/memory.h>+ ?- e& M0 m7 o2 _- j& T% u) C
- #include <mach/hardware.h>
. q8 H1 g3 e' k9 Y$ y; p - #include <mach/irqs.h>
) i4 ?) K) U a5 Y: q - #include <asm/hardware/edma.h>/ h/ d2 t0 G& e3 a- e# |6 u
8 j, [3 U3 N/ ?% K- #undef EDMA3_DEBUG% l# s) V; O; m, N. ^9 h
- /*#define EDMA3_DEBUG*/
. U/ l7 B0 e8 b. G* V3 i9 `
' P* j2 k0 @- q6 n- #ifdef EDMA3_DEBUG6 W1 w2 J3 A. {* U# q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 u! ]2 U: C( k: W' L% i3 ?# ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d& X) d9 D% O+ `6 A; `8 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ^' b& R+ r3 ]
- #else
0 Y$ J$ J7 _! o - #define DMA_PRINTK( x... )
8 N4 @; l; [& d7 R' J - #define DMA_FN_IN
, p1 c! _% W& |. x( i2 A" _" {* B7 d - #define DMA_FN_OUT$ x4 p* f( _" t) ~1 t& d# T: X
- #endif
# F* W, u8 d+ C9 }" V - ; {( e9 i" b7 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( q3 b3 K+ C) t% C J* D
- #define STATIC_SHIFT 3
# F& w$ ^5 u# k - #define TCINTEN_SHIFT 208 K& ^3 C+ E7 u9 z, \+ [# y
- #define ITCINTEN_SHIFT 21
% N, }6 U' `- g - #define TCCHEN_SHIFT 22
- c- F0 H0 {4 n) j3 G8 n+ _ - #define ITCCHEN_SHIFT 23
! Z6 a7 N% k- Q) p
9 n- x* U; \2 {: R' Q8 P( W& `/ m% b e- static volatile int irqraised1 = 0;; y& h1 b, {+ p
- static volatile int irqraised2 = 0;
2 T1 |0 s1 Q Q- S - 7 I/ a2 L& F' j$ Y. ?# r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: W" ~7 t8 x% g+ p4 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |7 p( S" M' I: c( Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% E5 M) H9 ?+ t+ w - + a0 f! U- z* g1 \5 Z* u: s- J
- dma_addr_t dmaphyssrc1 = 0;' N2 ?7 p: A7 A
- dma_addr_t dmaphyssrc2 = 0;
7 r% J8 W( Q& W' w) t; w - dma_addr_t dmaphysdest1 = 0;
, X3 s3 Z7 K: X7 m& g1 H3 _ - dma_addr_t dmaphysdest2 = 0;, z! o% i; N) M" f3 p* M
- # h: Z$ Z7 O3 l; g/ ? l3 G1 H
- char *dmabufsrc1 = NULL;. \9 D1 e# b% A+ T
- char *dmabufsrc2 = NULL;; S- f9 Q# j% x8 {* K
- char *dmabufdest1 = NULL;9 R/ }# t4 F. W! d
- char *dmabufdest2 = NULL;
! u: X9 P* T: d4 n% S) [ - 6 @7 }5 Y- u6 v6 k& q3 C5 A2 X
- static int acnt = 512;
/ q' l* u2 t4 P Y - static int bcnt = 8;' Y2 \! o& w; k( C! J6 Q a
- static int ccnt = 8;' z3 x& g( ^& o# o0 p, }
% y5 B+ Z# n* p1 r# O. `- module_param(acnt, int, S_IRUGO);1 [* C+ O' x" ]8 w
- module_param(bcnt, int, S_IRUGO);
9 Z3 {1 L i: T+ ^. P4 \, S3 l - module_param(ccnt, int, S_IRUGO);
复制代码 ! C6 _6 y* y p; k$ B" I# Z4 z( T8 G
* P* r; G8 c+ ~. @( l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 q* u+ c% \6 b8 B0 a* }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C) M) W" R' T* F+ k% K" f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ T: M/ z; L9 @$ _6 e5 K# f
4 x& J$ ^. N6 x$ ?. a) ? P
) R j: A/ O' R5 T7 {! \) h- _( g |
|