|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' M/ T9 L4 @ O |- [code]EDMA sample test application
5 s8 V( r( r b/ Y - /* M" p8 @/ D O( |. ~& a7 Y
- * edma_test.c
( ?6 B% R8 E- V0 u! P - *
% P/ f% [# }( D' S0 v6 ?* V* f& Q - * brief EDMA3 Test Application
. A k- S0 X& P - *
6 y3 o. R$ e# I; ^' k8 w - * This file contains EDMA3 Test code.
7 q6 A) m$ I7 X$ z# y - *
t& V5 j/ {! s$ ]3 B- d5 R/ D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: T6 }( B9 q) V& O' Y2 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" C# b: z0 y5 j# s5 ]
- * TO CHANGE.
+ k& O5 P8 `% v0 b - *
: z3 l! b. N# Z* {( U+ { D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 D8 `/ T# ]. @* a1 w - *& _3 h. e$ R+ M: \0 R7 v
- * This program is free software; you can redistribute it and/or
* }4 @ @7 Q. ^9 `& h' s - * modify it under the terms of the GNU General Public License as
! Q; p* p" F" m4 V - * published by the Free Software Foundation version 2.
8 ^5 _7 q: i; y; w" o E - * P- I- B" _; L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- e: N7 I9 O% R" U+ z3 S. G
- * kind, whether express or implied; without even the implied warranty
% u2 H- a, k& ^& D* {( q" H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 t& K4 g/ r7 K
- * GNU General Public License for more details.
" L" e& I! b; X+ v% P - */
( k. F1 ~, M! ?; A: H3 K- ?
+ t7 L- \7 C, v( v7 t# j- #include <linux/module.h> i& V) d1 T3 E1 I# O$ v1 s" q+ M
- #include <linux/init.h>
2 \: g/ e1 A, t i1 y# T' e- m - #include <linux/errno.h>. o4 C6 x1 |1 o' h
- #include <linux/types.h>
2 `- i( U9 t/ Y. I3 z0 X* ~ - #include <linux/interrupt.h>
* x4 |6 B- @6 ]. e - #include <asm/io.h>% P/ [5 Q, ], S3 j
- #include <linux/moduleparam.h>) P( F' h" m( z/ g3 p+ _2 }5 u5 F
- #include <linux/sysctl.h>0 x$ e- G) } |8 d1 b" V
- #include <linux/mm.h>
+ L, e$ F5 x9 A! i; r - #include <linux/dma-mapping.h>
) l/ g* |; ?0 \2 K - / p6 r% w& `6 c& y
- #include <mach/memory.h>$ v- p" c" l4 E X
- #include <mach/hardware.h>( B& x. B( R/ ?6 n
- #include <mach/irqs.h>
/ t! D* g7 [' q5 X - #include <asm/hardware/edma.h>3 b- W8 ]7 D" u8 q' S8 J
- : a/ b8 D1 U% c+ Z" L4 f0 q
- #undef EDMA3_DEBUG
6 {4 n' y' x7 G: K5 `- r - /*#define EDMA3_DEBUG*/
! |& {/ u) X: P& U" G0 @
8 D, ?) b: i. S: t& S4 d4 I- #ifdef EDMA3_DEBUG% N3 I& }5 d+ r7 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( E) Z2 d8 C( E9 B3 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 Y% O7 t, d* c% q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 N0 f" y D1 `6 B: H. P/ z
- #else8 k! O6 H/ P& V0 I9 K
- #define DMA_PRINTK( x... )
' h' s; Q$ h3 U' P: N - #define DMA_FN_IN* e# j: y0 a% [% @6 `
- #define DMA_FN_OUT9 Z$ y% E4 ]5 L2 A5 L p! g
- #endif( A$ C5 `' k' u, Q5 n+ b3 t- n
- 9 T: ]9 \# j" W5 @2 B7 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" r6 d7 {" {, R4 _
- #define STATIC_SHIFT 3+ s: ]: ?$ Y! |& h
- #define TCINTEN_SHIFT 201 {# a- L$ U& ?8 f
- #define ITCINTEN_SHIFT 211 T- T7 }0 g/ [& @3 _1 \* j0 e/ @
- #define TCCHEN_SHIFT 22
3 N( ]) F) n4 i8 R2 G - #define ITCCHEN_SHIFT 23, O0 h0 J0 r: i% J
- * J' o; A A6 Q0 o2 g: c& s) I
- static volatile int irqraised1 = 0;9 ^/ j& B6 N1 b D
- static volatile int irqraised2 = 0;) [9 ^# j7 p0 v4 G8 U
- ) b6 M) m8 T" |7 h& J/ s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ |- F! F& `6 |: E0 A' Q6 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: s! v3 O7 v+ r( Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n2 E. Y1 A1 ^+ @' Z' p2 U# T
- 0 y" O* Q5 d! ?
- dma_addr_t dmaphyssrc1 = 0;
+ H2 q2 L/ A) {, a - dma_addr_t dmaphyssrc2 = 0;
x, X8 N- D8 e1 {- a - dma_addr_t dmaphysdest1 = 0;
! o: {; ^! J! x. W3 N3 L% I* r9 h8 o2 b - dma_addr_t dmaphysdest2 = 0;6 o4 X- g5 N4 f' ]' Q
- & d5 R; q4 R" O+ M' {: f. |
- char *dmabufsrc1 = NULL;
S6 k3 @7 W9 d, [1 c6 e - char *dmabufsrc2 = NULL;
8 M) r2 A: h, @( \5 q# T4 } - char *dmabufdest1 = NULL;# Q# r3 t9 [' i! I
- char *dmabufdest2 = NULL;& a1 }* F* x$ y! z' S' s1 i A1 S4 ^
- - o; k/ y$ V3 U5 L, c1 r
- static int acnt = 512;
8 K4 `! W: q" [- ?; i z, J - static int bcnt = 8;
3 I' k/ H# w6 m! ?9 r - static int ccnt = 8;: m# c/ H* w' z! z- Y- H. {
$ w5 J/ N( n ]- T, p- module_param(acnt, int, S_IRUGO);
% W5 c! m+ @* w5 x% v - module_param(bcnt, int, S_IRUGO);
& e+ [0 q" C, ~ H+ O - module_param(ccnt, int, S_IRUGO);
复制代码 $ d3 d5 h: i+ \/ A
3 v d/ z F( m4 ~7 U# v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ B7 C* a3 o7 T: I7 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ {8 N+ e' p1 L% P! l v& O! L, h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ?! [1 {+ K5 [% F& u8 l8 C2 a4 i$ p% M6 M; m
* a& J5 ~; H# ]- Y1 O" Q+ P* W2 x
|
|