|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % v2 V' v# B8 n: |3 o6 ?' W
- [code]EDMA sample test application* [, T5 Z: l% X. j: M! J
- /*
% u' L5 h- W4 c, C% I# X% Y; b, K - * edma_test.c
3 U5 y; L3 J# Q7 n - *
: J- A) ]7 t4 L2 E8 H - * brief EDMA3 Test Application
5 E) I* d D$ J+ ?& O - *) \' }, j, v8 T7 j
- * This file contains EDMA3 Test code.
4 I: z( s; F0 u2 x* m7 M - *
) j1 W: w. A. ]9 x3 I6 K* u1 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 z3 ]7 p1 Q( R9 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 N$ y1 I, x' j
- * TO CHANGE.
' _9 O0 v6 V j/ f - *7 J$ ^1 O; H! l% o) L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! N* E/ ^) T: u. \' a- u9 a - *% V9 A+ z* @! w
- * This program is free software; you can redistribute it and/or
& z2 W9 H0 W6 j& k0 H$ M - * modify it under the terms of the GNU General Public License as
! E3 B5 }% K! u* T! ?% [ - * published by the Free Software Foundation version 2.
, N; b) }) @- b- h, B! j# N - *% o* N- x8 }+ _4 z' k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. h2 k$ Y% q5 `# i
- * kind, whether express or implied; without even the implied warranty
9 M& q a- X$ e0 H+ r9 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ l* i3 o6 B6 m4 G, [( ` - * GNU General Public License for more details.% i- L8 S4 o+ b& b9 J0 w2 r
- */
1 n5 Q3 J1 f3 F* e
" S2 O7 |5 m9 @. `& D) H- #include <linux/module.h>! O3 l' d- e3 }6 V
- #include <linux/init.h>5 E' ?- m3 k$ n6 u
- #include <linux/errno.h>
C1 q( T( X: j+ I3 t - #include <linux/types.h>
+ V0 @! z9 }+ S - #include <linux/interrupt.h>
, s8 L1 z" L0 A8 @- j) ` - #include <asm/io.h>* o4 y8 m; Y+ v
- #include <linux/moduleparam.h>- X5 ^0 ^( F( r
- #include <linux/sysctl.h>9 r- y5 {! ^3 N
- #include <linux/mm.h>) Z1 c" E1 e$ l, Y' z0 j: ^6 S3 g
- #include <linux/dma-mapping.h>% o" ~& m/ H( x
- ! u. y2 N/ d4 G$ q1 M6 b4 i% m) u
- #include <mach/memory.h>3 Y/ ]: ]2 j8 o7 U7 e! u
- #include <mach/hardware.h>6 ~* d; s. @ _) a+ o3 F6 S7 n
- #include <mach/irqs.h>
+ H7 q# O- j: l0 M3 T - #include <asm/hardware/edma.h>; _ c, {9 v9 u+ j
# x. f3 k: [5 s0 h3 B, v- #undef EDMA3_DEBUG
& T5 A1 o9 V! v Y6 `' ?' b - /*#define EDMA3_DEBUG*/. G' P. E# f; n$ X" n4 ^) A* g
- , P2 L4 k/ z* @! H, d. f' Z
- #ifdef EDMA3_DEBUG
0 V" O+ g1 K0 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P/ s5 ~" @; _$ L6 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! u: x( O9 a; W7 A4 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ V1 w* s; w, ~% | - #else
+ P+ f3 r4 O: ]& I' S - #define DMA_PRINTK( x... )
5 \. ?' l d9 X" y: a2 @5 }; ]* I4 p - #define DMA_FN_IN! S& C. |' s1 S+ ^1 b
- #define DMA_FN_OUT" `( A& w3 c/ P: S, t
- #endif
& g- m' ?3 t2 B2 n; s) r - # g) R' L8 O/ n" ]; ]7 K" f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* K T. ^( H8 _/ e' g - #define STATIC_SHIFT 3
4 T" L4 b) _ s4 p% M" e - #define TCINTEN_SHIFT 20
8 v# g+ L3 [- z+ N: B; m) \+ Z6 a: G7 } - #define ITCINTEN_SHIFT 21; [4 A0 s6 `+ u7 K& M' `* Q/ g
- #define TCCHEN_SHIFT 22
) C6 { S, H# J8 R+ ^( F( ? - #define ITCCHEN_SHIFT 23
. |, c5 |! o0 a0 S6 O9 I
* J) s2 d8 `# F) P; z- static volatile int irqraised1 = 0;
' C# W1 _+ V* m2 z; D - static volatile int irqraised2 = 0;
' c4 S6 e. W, x: d - : F2 y5 M# y, i, I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ h7 W7 f% Y( a2 y' q' C3 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?7 V, W1 |" H% ^: N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H$ d& q" o' D$ C. G B8 ^; C. o/ x
- & d& }) W! N( o% d/ Y
- dma_addr_t dmaphyssrc1 = 0;. A5 V+ _% B1 r
- dma_addr_t dmaphyssrc2 = 0;
5 f- b, t! O T( Q0 j C. ?7 e - dma_addr_t dmaphysdest1 = 0;
" L- u, Y/ W7 o, `1 l - dma_addr_t dmaphysdest2 = 0;
. X/ ]" O) A5 I' O) ? - 3 r9 M7 \ G0 [% ~3 X
- char *dmabufsrc1 = NULL;, j6 t0 P% u& g/ L0 G4 A6 ~3 ^
- char *dmabufsrc2 = NULL;
7 D# T) Q9 w2 b9 o" g - char *dmabufdest1 = NULL;
2 }- U" O0 s& m; l2 w$ w - char *dmabufdest2 = NULL;
. u' a6 M1 _7 f x% N3 S3 r: } - 7 }: C& G+ O9 @; ~* Y
- static int acnt = 512;- V" |; T, P" Z' [
- static int bcnt = 8;
, o" k8 j9 ^$ ]+ i8 M& c - static int ccnt = 8;
6 J3 _& f: N$ K/ `6 J - " q4 X" s- a9 W$ l
- module_param(acnt, int, S_IRUGO);& [% u8 Z: T) ^
- module_param(bcnt, int, S_IRUGO);" W5 I) _: X9 }8 q" V. P7 A
- module_param(ccnt, int, S_IRUGO);
复制代码
9 ?$ I1 n1 Q/ z" w! M( L* d2 [% h0 g* B' H2 T2 d! J) @, ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 P$ Q- |1 o. h6 G4 U( H! tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 |# h: s' D. p* v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* X s1 j9 S) n6 V# G+ I
) v3 u+ d6 S4 E, S2 O5 j7 G/ Q, w9 f4 M7 J
|
|