|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ]) r5 c, o4 P7 o3 ]- [code]EDMA sample test application1 K# Q; T" ?" k9 ]5 I0 m
- /*+ b E# M. Z) R' `
- * edma_test.c
~7 s$ g! O. O& u8 w$ d0 R, { - *- T ]+ e1 h6 Y! U- F+ s
- * brief EDMA3 Test Application# O3 @- E( O! |. x n
- *
/ O# g: u# k2 W* M* S$ b - * This file contains EDMA3 Test code.& s$ m( f- `% |/ ]( f' v# `
- *
1 [9 y: H. e# G& @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 t* g$ m5 \" _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 m1 a' f) R2 e, ]4 Y - * TO CHANGE.
5 Z0 k" J2 d* V- g - *
- V8 N: U+ w+ G) E0 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& X6 @* h% w, ~' D2 `1 i4 A9 \ - *
: A- {1 \( w# J - * This program is free software; you can redistribute it and/or
# V" I1 V6 R9 c6 p+ L9 X - * modify it under the terms of the GNU General Public License as- l5 e0 ^5 W# n: G6 v0 |
- * published by the Free Software Foundation version 2.' m$ y- d: E$ g, N8 y
- *
7 y [+ {5 m) Y$ M3 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. b: n' \6 A" q) f) _1 u1 ^$ Y - * kind, whether express or implied; without even the implied warranty. l. L% B3 {* D* J) ~$ L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ j3 X7 n1 U: [/ c% o
- * GNU General Public License for more details.
0 ?' w1 r- i7 X - */6 n3 ~9 c: [' C
( ^) L' H* [! _$ e3 R% p$ W- #include <linux/module.h>
9 u7 H( r3 `& b; j; ` - #include <linux/init.h>& T) b2 u9 `+ j4 k$ q0 N! J+ T
- #include <linux/errno.h>7 X7 T f7 |1 o9 ?; ]
- #include <linux/types.h>" a" F, m% O9 [/ U/ {7 l5 r7 \+ U
- #include <linux/interrupt.h>5 X# Z) M( T/ o& k, d
- #include <asm/io.h>
; }7 x- U6 V* x - #include <linux/moduleparam.h>
' o6 _, F6 n3 d0 W) a; ]1 C4 Y - #include <linux/sysctl.h>- I0 x) \. q7 X( S1 ]6 ]
- #include <linux/mm.h>% j: `1 {2 U5 q8 X
- #include <linux/dma-mapping.h>
# h1 G& B) Z" a& T2 {' x7 _ - $ b% K7 D E( f, M: ~- z4 F
- #include <mach/memory.h>
6 D1 o+ ]! x: B" |" w - #include <mach/hardware.h>" p# F* s' m& e" h
- #include <mach/irqs.h>
" I% c* T: k0 W7 j3 a' D - #include <asm/hardware/edma.h>% Y8 Q7 f4 z. ]! N6 o6 L2 u9 _
- [3 E! `2 \* G: K1 g- #undef EDMA3_DEBUG
% k. w* s: T. r& {/ W - /*#define EDMA3_DEBUG*/
I5 V- A' W& @! S! C# J
8 i4 B, W) O7 B- @- #ifdef EDMA3_DEBUG4 Q* c% ^9 c. V$ ?" t2 N+ P/ Y' C* h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 o5 r* C: t. k" u: z4 n- M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% n) B% A2 x$ A' B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l1 `$ U7 Z+ m+ G# {$ W3 e. c
- #else
O) i M* X' U2 a3 ~. @ - #define DMA_PRINTK( x... )1 A2 ?$ K4 J! @. R8 N9 u8 _
- #define DMA_FN_IN+ x7 L4 F" X4 [4 b
- #define DMA_FN_OUT/ P9 @4 P+ K4 C3 U- m
- #endif# P' Z* @( J# G- ]4 y! f; w! @
- : l7 v+ y* z0 b& N8 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); U) M+ Y# z* p6 s& v! O# @
- #define STATIC_SHIFT 3
8 K7 ~9 U& M2 m - #define TCINTEN_SHIFT 20
, d) r$ I% I4 N. X3 u/ i6 o - #define ITCINTEN_SHIFT 21
$ E! Z0 F, c" F8 M7 d# f! q - #define TCCHEN_SHIFT 22
' d! G2 Q% k/ [9 N7 A5 p - #define ITCCHEN_SHIFT 23: e2 J5 l# }/ V+ c$ V
- / y5 E- W! r9 ]$ d0 K* N5 E% ~
- static volatile int irqraised1 = 0;
6 u: ^/ @+ t, a! w- Y6 {% h - static volatile int irqraised2 = 0;/ k8 M4 x" `9 ^" ?+ J0 D( W, _
- 9 C: }8 `6 S5 y* I- @7 o* @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h" R+ n" _" j0 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Z4 Q8 |/ Z# n" p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _5 ~3 ^6 q5 f
- , Z; l; x0 D# T, |7 M; O8 D) F
- dma_addr_t dmaphyssrc1 = 0;0 P8 t# h1 f9 P" a
- dma_addr_t dmaphyssrc2 = 0;$ V% t. ?2 a) M; M/ `) `/ y* f
- dma_addr_t dmaphysdest1 = 0;& z# ]- E# J: U' z* W% g
- dma_addr_t dmaphysdest2 = 0;' J6 M# V! E+ T [# `3 z# g
- ! U/ P$ V7 @+ f3 S$ a. Y o0 y
- char *dmabufsrc1 = NULL;
' t' T# [6 q! I0 z L r - char *dmabufsrc2 = NULL;
' P+ s9 I0 _6 G+ F - char *dmabufdest1 = NULL;
! B3 y# M+ V7 x7 e - char *dmabufdest2 = NULL;
" H8 ~" y" n% {, I/ N
) Q: `" Z' l% \; u2 @1 Z; @- static int acnt = 512;% v! {: o5 F: b% v$ j7 ]
- static int bcnt = 8;- T! h s7 k; g4 k
- static int ccnt = 8;; g& R3 F- K F- B! \/ F
- O6 H0 K5 s5 P3 x! a( G; f
- module_param(acnt, int, S_IRUGO);0 k& Q, t9 ~) z
- module_param(bcnt, int, S_IRUGO);
: i- |; M- R/ J* O9 m( @ - module_param(ccnt, int, S_IRUGO);
复制代码 7 v; Q! J) | X4 j) u
) \4 Q# T9 B! b9 v O* T3 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% _2 n. ^2 A+ F4 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& {4 }6 \; {7 z c6 o- Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J% `( s7 } O
/ B f( r; t3 E9 M @: ~5 |8 l4 a9 M
& a" C3 O \4 o( c$ M5 U! L' g
|
|