|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , O* j/ ^* Z& O' Y5 p
- [code]EDMA sample test application/ W o7 O' H5 t" e
- /*% Z- j; G+ s: J: P* r7 l
- * edma_test.c
6 x+ [- y% s" U - *1 \* V% n- O5 F' y' g
- * brief EDMA3 Test Application% {( V8 ?) y4 U5 R! Q% |& C4 Z1 u
- *) M9 O1 P( l h8 u9 W4 o
- * This file contains EDMA3 Test code.
' P2 ^# q7 L: f4 i- w/ i S- v/ L - *9 _: W' g& r& k$ l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 t- P, v- E, R5 g+ W. ?: D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" f Y6 M Q2 G
- * TO CHANGE.
0 x% c b2 e9 b& ]" h* p - *# g/ r5 r- O. z7 ^$ v. B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 _5 ?2 V" G/ C" \ O+ b7 A
- *" B9 l& F9 z8 i3 ~0 d' s: |( F- Y
- * This program is free software; you can redistribute it and/or% q# a7 l" H& G" B0 m$ @, n! S0 U
- * modify it under the terms of the GNU General Public License as/ l% N8 |+ Z; @; t% M. ]. g: a
- * published by the Free Software Foundation version 2.
% }: C/ Q% `0 G5 ~ - *
% U8 m( z6 m& B7 J1 u5 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, A3 I9 t% @5 M3 \& s3 J - * kind, whether express or implied; without even the implied warranty* J8 P4 B$ x' X* k/ _+ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 d7 |$ Z: O% T( g: B" Q8 d - * GNU General Public License for more details.* e. w& d* M6 k' {9 B: b
- */& w9 y3 y; \, b1 P
- I9 m6 s5 N9 u: v4 f- #include <linux/module.h>
/ D7 I+ p" O( E; N' k( G, y/ L9 O e - #include <linux/init.h>' `( F. S1 R* H- l
- #include <linux/errno.h>( I8 l) |+ W- T! r {
- #include <linux/types.h>5 I/ B# @6 {6 l7 |
- #include <linux/interrupt.h># G s k4 p: \$ E5 m) o
- #include <asm/io.h>
$ g: Q8 ^/ g1 c) i3 Y - #include <linux/moduleparam.h>, H( a. z% [+ T5 [. y% p
- #include <linux/sysctl.h>$ h) y3 Y8 W5 k7 m1 L; x8 ^6 T
- #include <linux/mm.h>0 r2 u' G9 @; G3 \. D9 t
- #include <linux/dma-mapping.h>3 H+ U: W/ b, |- j9 v" |. C
3 d2 \) |- E3 H7 [. [- #include <mach/memory.h>
0 S1 ?; D; L7 J - #include <mach/hardware.h>4 x4 @8 u" c2 n+ e6 w
- #include <mach/irqs.h>
0 M3 o! W- D0 l% I - #include <asm/hardware/edma.h>' M& A! J; }# ~5 \: I
+ S% j/ u6 ^ u& p. M- #undef EDMA3_DEBUG
: {/ v2 o1 x# K8 t - /*#define EDMA3_DEBUG*/; @& Y, `& o0 h/ z2 F/ F' L, I+ d
- ' Y/ M6 ]1 k1 w7 Z& `
- #ifdef EDMA3_DEBUG A5 V, B4 Q, X0 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 b; }+ x+ T/ k* s$ g2 t# y! K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 `# ~( j- y, u5 \5 B( E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Y- j8 L5 F; x0 f Y' c0 T - #else
/ n* [6 Z) z, n% c - #define DMA_PRINTK( x... )
% i) [& Z3 q! ~, Z0 Q+ o - #define DMA_FN_IN
7 {4 U* m6 b7 X% q. P - #define DMA_FN_OUT
2 D+ g0 ~. K y0 k9 @6 F - #endif4 c3 W6 L9 [ r: p8 s
/ S" i9 Q+ v# d {9 P$ V* ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 r# J* A5 M$ {/ ]/ j! ^6 f2 R - #define STATIC_SHIFT 37 x1 A l8 M# I% `9 |, J
- #define TCINTEN_SHIFT 206 ^& J8 J& R, f- V* g f8 c
- #define ITCINTEN_SHIFT 212 }9 S! ~& n* Z6 x/ p0 |
- #define TCCHEN_SHIFT 22, }8 V6 ?9 N6 i, I
- #define ITCCHEN_SHIFT 23
- W5 T3 e5 ~3 K( Q7 _; V9 ?) \" w - : m K U" q0 q
- static volatile int irqraised1 = 0;" p( ~* E) ~5 i: E) }
- static volatile int irqraised2 = 0;/ D. M$ A) z5 W$ r5 V
( W1 M8 W/ D2 j, z) S Z& K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _1 g/ ?/ |) n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# b& @% g. j2 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S$ K- x. c1 u$ T$ s9 |. ^
- . `% I% K7 V, j) P
- dma_addr_t dmaphyssrc1 = 0;
) k" J- p) P H- r/ f' o; j3 v - dma_addr_t dmaphyssrc2 = 0;7 y7 E# W7 n1 ]6 w2 _8 x3 u7 b( e/ G
- dma_addr_t dmaphysdest1 = 0;4 i- y2 m# h1 J, v6 d |
- dma_addr_t dmaphysdest2 = 0;
8 P/ I$ J' J5 {# o - ! m8 H% Y7 w& {& t5 B* Z* G% y
- char *dmabufsrc1 = NULL;. x# `& \; c* w' l8 r
- char *dmabufsrc2 = NULL;
* c$ Z8 q8 m- G0 |( B - char *dmabufdest1 = NULL;
+ i( N w% j1 O! G/ k. v& @1 {2 ] - char *dmabufdest2 = NULL;
8 L0 w1 j. d* @" s) q# a
" |. B+ \0 R a B) B6 l- static int acnt = 512;$ Y6 B8 C; ~" d. i
- static int bcnt = 8;1 o [+ ]& {2 Z! J; H) I1 k
- static int ccnt = 8;
+ f6 U( v- {2 Q- V - 2 D( C/ j2 P f9 ]" w) q6 W3 I
- module_param(acnt, int, S_IRUGO);( X- v3 D$ r2 o7 n
- module_param(bcnt, int, S_IRUGO);
( k5 @1 U2 \0 J5 J+ X' L- W - module_param(ccnt, int, S_IRUGO);
复制代码 6 z+ _% Y) T8 U3 |& s# ^- L `
9 Y6 L; ]% x& `; J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y4 t) {, f% b7 P' i+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 X2 q$ y2 y7 @- E; b" w2 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- |; y r" F$ r8 t) P0 o
! Q7 X0 H; p+ K
9 N7 ^- \0 [$ s+ ` t+ q3 q" k |
|