|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ^; z3 M6 B7 Q0 @1 G- [code]EDMA sample test application& a0 f% I; Z: l: V& u
- /*
$ f. i0 Y0 g& O! x) k" D4 I1 x - * edma_test.c
0 H. H) v3 \" F5 Q& g - *
7 [4 i0 `, l2 w& P5 D+ a. Y - * brief EDMA3 Test Application
6 q* c2 x- [' I2 J% f - *9 {) I4 x: O: |, Q$ W' k
- * This file contains EDMA3 Test code.$ l5 c( l, c' F3 \5 c P& U0 t
- *! g$ K' d+ E7 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& V9 q- d* p1 Z$ k) h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& {6 O) I5 _6 H4 w7 I/ ^+ L, b+ ?
- * TO CHANGE.
/ A# z' R% p0 h# A+ v - *
+ _. n8 \1 a- r4 F; ^# K! i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. v/ X1 Q9 b, K
- *. E0 h4 n, V" C6 a
- * This program is free software; you can redistribute it and/or+ t& k- i7 o& A( b" C0 \
- * modify it under the terms of the GNU General Public License as7 T" C8 Y7 H9 S
- * published by the Free Software Foundation version 2.2 j: g* D, b3 h1 V
- *
1 [. a9 S5 W# k/ p; O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. p; T1 B# r2 Y' X0 n
- * kind, whether express or implied; without even the implied warranty
" k1 T5 e3 Y3 @% [, w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 d, ^: q7 K% S- x; x! C6 y
- * GNU General Public License for more details.
; b9 O4 @5 j5 u% k0 m5 J: W - */7 ?* Z ]1 w q! o4 E5 f1 b( q
7 q- A* \. U7 h' ^ ]% i4 I- #include <linux/module.h>
4 E0 [& c0 e f7 Y5 C' d9 M! d0 Y - #include <linux/init.h>5 M) ?' n1 b$ Y1 F
- #include <linux/errno.h>
6 m: Q8 H! T: s6 `- W - #include <linux/types.h>
$ ^7 T9 P$ s" N. L; N& m. n - #include <linux/interrupt.h>) D. c0 {/ [" Q
- #include <asm/io.h>9 P1 o( P1 C# w* [7 q
- #include <linux/moduleparam.h>
4 M! ^ g1 U" v - #include <linux/sysctl.h>9 Y" G1 Y; V' z* J {2 a3 @. X# y
- #include <linux/mm.h>. U Y3 x s: Z! ]
- #include <linux/dma-mapping.h>" x$ ?7 O S F$ [" E! o0 b
# q4 z; p. Q% W: T5 q4 b4 }8 c# c% V: G- #include <mach/memory.h>( e! S' i: D* m4 j- Y( Q3 ^
- #include <mach/hardware.h># q' T) w4 Q# U# W( O( d5 ^
- #include <mach/irqs.h>; U9 d, _, x( z# S( J
- #include <asm/hardware/edma.h>
/ {. Y# e4 B7 J" Z) Z# R8 J% { - ) y8 T; m- Y( b! v( \6 y- s
- #undef EDMA3_DEBUG
1 _9 _7 P7 _$ I' B% G2 }6 S - /*#define EDMA3_DEBUG*/
! a' o4 i6 r) p - ' b9 Y+ o+ H9 u5 `/ N' `
- #ifdef EDMA3_DEBUG
. O0 c# O8 `! h3 t$ l* j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ` A" Q. P( H) l; `# `8 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# Z7 Q# i! ?; }% t) L1 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* _- X# ^1 I: X8 n - #else
" V5 }7 Z8 F- `2 }- M - #define DMA_PRINTK( x... )
; i) V4 x5 A# G5 k* Z - #define DMA_FN_IN; }: ~* g1 ~7 P9 F) z/ b; s
- #define DMA_FN_OUT
1 C. o+ N$ A8 Y' |' I, \ - #endif
# u+ F. c; E3 n& H! q+ H
- x% w) H1 M0 c, @* K$ q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% v. ]9 p: u" S* ^4 z$ y ? - #define STATIC_SHIFT 37 C* e8 \; E ^) S% R
- #define TCINTEN_SHIFT 20. C. |2 Q3 b) Z: w! S5 i1 F" k' w
- #define ITCINTEN_SHIFT 21 `% ~. V# Z, x
- #define TCCHEN_SHIFT 22
+ @1 U3 @( x7 j8 \4 @% { - #define ITCCHEN_SHIFT 23
2 [& B: b9 n, q) ~; ~8 i2 `5 D
, p1 U8 y6 } G2 Z7 W8 F+ B- static volatile int irqraised1 = 0;9 V8 ~7 `$ c2 U) \
- static volatile int irqraised2 = 0;, K- U/ q3 @0 m+ G) C* q; ?# R
- ) X- o/ P V. W, ]% O- Z$ n5 X, _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N) t3 W) s8 i( m/ L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I* p) q u! h: S! h, ]) K0 o" w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' w8 ?, J9 r- D# M# H' H5 I& ] - 1 N% H- Y$ n3 {0 ]" C0 J, K+ f
- dma_addr_t dmaphyssrc1 = 0;
% a9 y" R$ c. H# W8 q - dma_addr_t dmaphyssrc2 = 0; h7 T' ]. Q# p+ w. [
- dma_addr_t dmaphysdest1 = 0;
& J: J: C/ L8 T9 N - dma_addr_t dmaphysdest2 = 0;
$ N$ l) y; ?, o$ x$ p- P1 N- Y+ J - ' r* M$ X* G9 U& V3 Z' ^$ n
- char *dmabufsrc1 = NULL;
2 G" m5 V8 ~( p# r - char *dmabufsrc2 = NULL;
9 `; e/ }' C, {# Q4 w) _9 u0 r - char *dmabufdest1 = NULL;# C/ O9 \+ ~- W
- char *dmabufdest2 = NULL;8 O2 P+ i& X/ R# r
% L8 E% o+ T$ V0 P. ~2 D0 u- static int acnt = 512;" @8 F6 b5 `9 W9 b
- static int bcnt = 8;$ g* T# z2 u: o; T& M
- static int ccnt = 8;
r2 d1 v6 P* G' F0 D) H( H - : A. \# t- B: A, a0 I3 h
- module_param(acnt, int, S_IRUGO);4 n+ ]: e, }! k5 G6 J8 S
- module_param(bcnt, int, S_IRUGO);
+ p$ X/ z' {. I/ r9 R - module_param(ccnt, int, S_IRUGO);
复制代码 4 v$ V; d6 w* j/ {* \6 U9 `- @0 o
5 a& p) d4 X4 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 a. a! ]" M- j- r$ Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ K# T5 B) C, M5 P0 \5 \9 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* F! P" |4 ^! t, s
g) ?3 I2 | l( Y5 ?% }4 R, M! L3 Z
; n9 n% C- u( k0 O0 l9 L$ h+ l |
|