|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * a& W4 T7 r1 }2 t* @
- [code]EDMA sample test application9 i% p3 [) H/ f0 f0 r
- /*4 h- C0 S) m4 z% a7 e
- * edma_test.c! M4 e* u( f. R" m8 j- p3 {+ M
- ** J/ d8 U' W' M% s
- * brief EDMA3 Test Application. o; s8 |- U1 {- ?6 ^1 B
- *6 N8 r6 o$ Y- B* W
- * This file contains EDMA3 Test code." ]. p3 t0 V; z% r; F3 x q) Z
- *( D6 T4 ~/ m4 B' `; o$ _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 W' a( b, ]: E8 ~- A: u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ]8 r: @' w2 s. y6 o
- * TO CHANGE.
+ T0 R& a. t" R/ ^6 ? - *
5 m: N) S1 f* @; V9 D5 t- B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ C _/ x: @" P' J
- *2 L n7 Y, W; s( I7 W1 g
- * This program is free software; you can redistribute it and/or% j" X5 ^ b5 @
- * modify it under the terms of the GNU General Public License as
: J. {# H$ s2 x7 K8 v+ ~1 T - * published by the Free Software Foundation version 2.: C. Y3 k2 Z; |" M2 c9 P
- *9 P5 L! f3 I5 s! q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& u/ [* o+ a4 ^! K+ c5 r
- * kind, whether express or implied; without even the implied warranty
" |- m, ?5 A- b! d# ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 i" {- n2 {( t/ U1 |- `) P - * GNU General Public License for more details.) W5 S$ M D% J+ {1 O5 b
- */: A6 G4 t& c7 T! m
2 `, B1 Q" l" k+ b0 i* E1 {$ `- #include <linux/module.h>/ O) o. F6 s, Y: J/ P
- #include <linux/init.h>
( F4 V+ T0 i5 H8 [ - #include <linux/errno.h>- `+ X7 ]# Y. L) K# D# u0 y; K
- #include <linux/types.h>8 o7 d/ n" _( T# I p6 _/ D
- #include <linux/interrupt.h>( i3 \. |( L* p9 o
- #include <asm/io.h>
0 s9 }" O( L8 K: C7 u4 T - #include <linux/moduleparam.h>7 L- \3 {. }$ O X
- #include <linux/sysctl.h>
; ^# d) U' ~1 y j8 Y - #include <linux/mm.h>8 \$ @$ C% n2 X
- #include <linux/dma-mapping.h>8 W3 X* |- E0 [
Z e5 G$ b' J6 u9 l b8 e- #include <mach/memory.h>
8 T6 j5 h; H4 Z6 P1 n# z6 h - #include <mach/hardware.h>" P: L1 e! c. d' Y
- #include <mach/irqs.h>
/ D1 n6 ?' V7 m - #include <asm/hardware/edma.h>
+ f! h8 P6 d( |7 L5 k - 9 P( n5 u& j8 T+ \
- #undef EDMA3_DEBUG* v2 `1 R6 p7 Q+ D- y
- /*#define EDMA3_DEBUG*/; L/ x% U; f* b! z* ^- l) z
- 2 x6 g) e, e9 Q# q }/ @5 A
- #ifdef EDMA3_DEBUG6 X7 a n7 h$ \4 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* y+ x* t. @& e) `" U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% V" T/ H! l5 k# g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- P3 |3 d/ [5 Y: a1 N- _' `: d - #else
7 ~/ L4 z/ B- r6 K6 |. P( L - #define DMA_PRINTK( x... )
% ~) b5 s& v7 w" j8 N7 d | - #define DMA_FN_IN
; |( i+ T& B, i; E - #define DMA_FN_OUT/ f7 D* x, b7 K5 _; U- ?
- #endif) ~* P. N6 E' j2 @; C/ a
- ( Y9 P9 C, }, Q3 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) }8 p/ U/ L! M+ V
- #define STATIC_SHIFT 3/ L- u9 p' Z6 B6 W3 I- }
- #define TCINTEN_SHIFT 202 l! t8 } L! A
- #define ITCINTEN_SHIFT 212 x, M& r1 z) H7 _
- #define TCCHEN_SHIFT 226 s+ @$ `: ^ G- n
- #define ITCCHEN_SHIFT 23
0 w0 y, t' C$ R. }! x
, b. X) E& I, l0 V) I- static volatile int irqraised1 = 0;
4 }" F# L7 l6 F' t - static volatile int irqraised2 = 0;
8 }( [! z& x8 O( `0 Y, ^5 M
& \0 ?2 p7 [/ _7 H& ]( `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A( G$ A4 i+ ]; F) K, F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. m/ Z. C: o" J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! R- q; v, ]2 R6 J9 r0 e
- / @! ?+ |3 b7 q% H/ Y& o
- dma_addr_t dmaphyssrc1 = 0;
+ ~1 N9 o! p6 Y - dma_addr_t dmaphyssrc2 = 0;2 G! l1 \" w8 X- A, S2 ~
- dma_addr_t dmaphysdest1 = 0;* D( y% X* q( S% V/ }; d* P( h
- dma_addr_t dmaphysdest2 = 0;& Y# q) V$ P& y% s8 ?. s
/ @' q; h: N. N% J' l) \& p- char *dmabufsrc1 = NULL;* z, X3 ~" v% W- v1 M
- char *dmabufsrc2 = NULL;( c1 V$ B/ }2 e2 C; u. D
- char *dmabufdest1 = NULL;( D# S" v3 F- w& t5 |) I7 d1 d
- char *dmabufdest2 = NULL;2 B( e3 T3 x3 m/ H |' t
" ~7 k, L+ }8 f- static int acnt = 512;3 X( w3 d' n* E4 Z# u/ i/ ~
- static int bcnt = 8;3 ^% V5 a0 F, |- o8 B( Z# L
- static int ccnt = 8;0 o0 w- T& x8 N; ]- y
3 A% k5 v0 P7 G" m- module_param(acnt, int, S_IRUGO);. }& m$ }4 _. U' ?- ~
- module_param(bcnt, int, S_IRUGO);. [' z. Z2 L9 T, V3 U8 ?+ A. k
- module_param(ccnt, int, S_IRUGO);
复制代码 . N: b2 `9 r; ^) r* y' h: b6 V* d8 y
+ K4 z( S; Q1 I0 y) B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 J! A" `1 Z! F0 p, ^0 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) R. `& z6 P- b% h3 V" ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 W6 }2 k) X" Y; H
, o' p! \ g1 I9 x' ^! t7 X- N! C3 t/ R1 ^
|
|