|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \3 J: z" g9 X, o Y3 i- [code]EDMA sample test application0 O3 i, m4 X/ Q% G3 L% O5 L `8 Y
- /*
E% d$ {% E* Y0 s9 ?" q" ] - * edma_test.c8 k/ x- a! y. i3 F
- */ S( T4 S* I/ {9 K V; M" }
- * brief EDMA3 Test Application+ K& c) z3 \' I* [( S! n
- *3 h: e- _7 d* n3 {% g1 x' z7 O
- * This file contains EDMA3 Test code.
" x) ^5 R/ g3 ^ r - *& A; W# x9 k v; [0 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& l: E+ z. p" B2 q- ]" q* b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; m; w! k! m5 M* g7 ^/ o
- * TO CHANGE.
b9 }8 ~" p! I C4 G& _! g& j - *
+ Z( z0 U$ N, w" U8 K% d& P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 L. E3 T J" G - *5 m" l/ Y" Z. Z4 E* l, c+ G
- * This program is free software; you can redistribute it and/or
5 w3 Q% X6 F5 m% v' o" c2 E% x4 G - * modify it under the terms of the GNU General Public License as
; C4 [: s. H8 Z* ^ - * published by the Free Software Foundation version 2.1 V3 N& h" M& K2 B5 g; ^3 ^% P2 u& r
- *
; }0 R% b6 D3 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 M2 b. s" [# P( Z0 W - * kind, whether express or implied; without even the implied warranty
) K5 Q/ v# c, y, e3 _+ d z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~$ C; g3 r$ ?4 b+ R; q
- * GNU General Public License for more details.+ d& i9 l# w8 w1 m) H4 S F
- */8 O7 C& R; r% E. S+ w
0 b% n. d, t7 }7 ?: L- #include <linux/module.h>
7 _( T' z. }% Q% t( B6 i - #include <linux/init.h>* m+ y. U. P* o# g+ a! E
- #include <linux/errno.h>* c) a4 r* Q+ u! X8 X- a
- #include <linux/types.h>
, a/ {" x& w, Q: K3 ~ - #include <linux/interrupt.h>
$ y/ \4 y% L7 T" U7 E0 a: s - #include <asm/io.h>
9 m: N. ^2 y! N! u0 i - #include <linux/moduleparam.h>
5 b4 o- o) X1 P5 o - #include <linux/sysctl.h>
" z5 W) i- D! i: U* ^ - #include <linux/mm.h>3 D' e* b1 `4 X, H
- #include <linux/dma-mapping.h>% @6 f! t0 n5 s% \/ v) h5 `0 K
- * Z5 N6 Z0 J% S; F# M: h2 Y
- #include <mach/memory.h>
0 E+ R6 G2 e) `4 G/ N - #include <mach/hardware.h>' l7 T( ?4 }$ {8 i' Z
- #include <mach/irqs.h># O2 k; ~+ L* h" f1 Z
- #include <asm/hardware/edma.h>
' T9 ?; P. |1 g6 B8 h
0 y& m$ ?9 k$ p. N2 e# W/ x- #undef EDMA3_DEBUG
& k( t5 f2 T0 c, b# ~! J - /*#define EDMA3_DEBUG*/! {, `; q; a% n! D) [& \2 t
/ Z; n- a; f& t% w2 k) D: U( s. e- #ifdef EDMA3_DEBUG
4 R+ D9 G7 u. ]4 F f- S+ u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 t1 z U( N) `$ Y3 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a0 E* t6 F. Q4 n) d) x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 H/ m5 S7 R* O, g( Y - #else9 g9 `+ {3 P& y' S
- #define DMA_PRINTK( x... )9 W. i/ W/ E- r5 N5 V$ u
- #define DMA_FN_IN4 l: l3 e0 W( {
- #define DMA_FN_OUT
, F8 y$ k% S7 p) ` - #endif
, r* [. [$ @3 N4 a2 ^5 L - + g2 I% [2 J5 A6 h7 n p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% e$ T8 W( R# @/ s
- #define STATIC_SHIFT 31 C/ T Q/ F$ B
- #define TCINTEN_SHIFT 20
1 n" t8 u) w# K: }6 H7 T# Q; j - #define ITCINTEN_SHIFT 21
- U8 s6 G0 k, | - #define TCCHEN_SHIFT 22
! a: k. g+ r0 s$ y - #define ITCCHEN_SHIFT 23, N- s1 r( b0 l, E" t4 H
- # P4 H; g8 k4 S2 h
- static volatile int irqraised1 = 0;
; |: \9 g& w/ g - static volatile int irqraised2 = 0;
6 ~9 M" r& d2 ~# I, Q, J8 J
9 Y& ^ G5 E5 ` {9 T% d, a) c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C' T" V [) c$ H+ i* ]; {+ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ~3 m9 S: t0 ?- v# I( V+ X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; f# G Y8 B/ z8 j) P; A6 l; _/ j
% {* o& L) ^& v. U) h- dma_addr_t dmaphyssrc1 = 0;7 c, e4 C# m' g5 }/ ~8 a# z
- dma_addr_t dmaphyssrc2 = 0;
4 q2 a9 j5 J& l( N - dma_addr_t dmaphysdest1 = 0;3 D8 J) S: P# t0 x& U, ~
- dma_addr_t dmaphysdest2 = 0;
9 q% F: {* c3 t- g/ T - 4 Z6 B- o8 z) Y7 X: e8 G" V r$ k
- char *dmabufsrc1 = NULL;; y3 W/ E! S( z. T
- char *dmabufsrc2 = NULL;6 ^9 K* R' ^$ `) k4 j! l+ w+ k" W
- char *dmabufdest1 = NULL;2 E9 T5 w5 X/ O( O- b4 T) S
- char *dmabufdest2 = NULL;
( o A, T2 G& @3 F* x% x1 Y - _' K! \: z9 A( A+ R
- static int acnt = 512;
% A/ D3 f3 R1 ~8 k1 e - static int bcnt = 8;; H1 K# U; Z2 t* T
- static int ccnt = 8;' W9 m6 s. V5 Z! s
- ; a' |5 L/ A+ Y* o' X
- module_param(acnt, int, S_IRUGO);
7 L1 ]( f1 R% |$ @- Z" z7 v - module_param(bcnt, int, S_IRUGO);5 E8 n- N( Q6 M! x# _) q% I
- module_param(ccnt, int, S_IRUGO);
复制代码 - z; x8 O; A5 H; r9 _3 T+ q
' _4 K* n! F9 Q! W! R% A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 I! M7 Y8 K1 S& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) y0 B! s2 h2 d1 Q: G& l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 M( n: N! ?2 x5 C
# m1 l1 J- a4 q) m" m- z+ A1 ~& h% t
% u( y# l7 `' O' t |
|