|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , q+ a @ {% P9 P8 i9 ]
- [code]EDMA sample test application6 S! A4 Q7 ]0 b0 s
- /*
6 V n* W6 ^ N1 r0 V - * edma_test.c
- W" \1 y$ n* V( P/ ] - *
" c* O: u5 e) K9 f L: ] - * brief EDMA3 Test Application) Z2 R2 }! ^9 @8 ]
- *
$ |; i+ q/ `$ @( ^; D9 j - * This file contains EDMA3 Test code.6 B) I5 e: T A. k1 x/ o+ M
- *" q4 d$ g$ G! X' e) j; ?! h' D G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ y* J5 w. `- Q! v' Z Q' ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- I: y0 t& Y! T' S/ S7 X6 W# U$ R2 S7 L - * TO CHANGE.# k( S" n+ {3 d2 @
- *
4 r4 O- e4 @) u8 C' d9 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 M3 t/ B) c' j/ J - *
+ [1 f: B {! T( t1 k2 W' B9 N - * This program is free software; you can redistribute it and/or
7 p/ D+ M+ j* z6 p4 F5 y4 b - * modify it under the terms of the GNU General Public License as
6 t F# R( a; a. B' ~1 ]5 z9 X - * published by the Free Software Foundation version 2. Y6 t, H/ z/ n
- *3 _; C1 u+ Q6 F- m0 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 H( Z' \4 w, r! u' V - * kind, whether express or implied; without even the implied warranty+ h* n! Y) @. l0 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' n3 a" r* h& \6 C
- * GNU General Public License for more details.; {& W* ]' v' ?$ o( k- Q6 f
- */0 q6 U3 z* L1 z) Z$ [# T9 u& }
, P8 q$ _8 G: q; @# n& I9 A- #include <linux/module.h>8 ^8 h% o. E( j6 F8 u' s
- #include <linux/init.h>
; g5 N3 t( h. r! c) i - #include <linux/errno.h>* ?* D0 D' y6 x* M2 A2 \
- #include <linux/types.h>
4 j- k/ n/ H/ Q! R3 t1 X H - #include <linux/interrupt.h>
% d# e7 V) M$ A6 b( Z, G - #include <asm/io.h>
0 K+ v4 M5 e6 V+ y3 y9 X; n& Z' e - #include <linux/moduleparam.h>
/ I5 F. s6 t6 q - #include <linux/sysctl.h>
1 W, O0 s$ V$ l$ n; Z - #include <linux/mm.h>
: R) A7 e- S6 L. z& \ - #include <linux/dma-mapping.h>8 J& y: u- Y9 c& S1 Y
^- `4 t g7 x- #include <mach/memory.h>& O$ `% ?0 B, u0 p5 k( \ B- z
- #include <mach/hardware.h>
: k$ \0 W' o, X4 v$ y# e - #include <mach/irqs.h>
0 W. w5 J w, ?, d& u) I* | - #include <asm/hardware/edma.h>
6 G4 I( ^4 v1 ~4 ^* k7 c
+ Q! {* u2 p8 F" t3 ]3 ^- #undef EDMA3_DEBUG
' |1 w6 d7 S" a9 l: O - /*#define EDMA3_DEBUG*/9 g# ^) g/ B" d) H" K* b8 _
- * G: [- _1 Z1 R, m; u
- #ifdef EDMA3_DEBUG; i* f, K8 r- x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( X/ Z3 y& r# Y) d: o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' [: }, v9 m% i* ]" R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 f. [0 w2 ?0 U' r; ^5 H) X \
- #else
$ @" e* N+ r3 ^! h) p - #define DMA_PRINTK( x... )- ~6 |0 ]1 m$ _1 Q+ R8 e
- #define DMA_FN_IN
6 B" {2 H% l# F } G! H" p( V1 W2 Z - #define DMA_FN_OUT: o& |: t1 s% l6 F& `# j
- #endif# ~- H! b4 Q& m1 d( U$ b) h) {- X
- , ]5 G# X: t! b- Z3 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 ]6 x* q7 o. D U n
- #define STATIC_SHIFT 3
8 M- [4 t/ x% h& v# w - #define TCINTEN_SHIFT 20# J& ~. E7 W0 U. Z- ^6 I4 c
- #define ITCINTEN_SHIFT 21" y# e3 Z, J) L
- #define TCCHEN_SHIFT 22% x3 _& D& z2 l. s: p: B
- #define ITCCHEN_SHIFT 23
) w+ k" k. s+ X: v, {0 | - / N, U$ v- y' h4 V* D7 @$ V
- static volatile int irqraised1 = 0;' ^! q9 r1 [! o
- static volatile int irqraised2 = 0;
& Q) Q2 h8 b9 s; G |! y - ; J+ z8 l$ h& j1 D% ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ |( |2 n4 O2 ?. R% s8 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H( ?, W5 m4 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& G J; \+ \$ a/ N Q
* D* w: `: R( |6 @; k8 D* ^, [. d- dma_addr_t dmaphyssrc1 = 0;
* u t; _( a/ Y% U) g - dma_addr_t dmaphyssrc2 = 0;* z2 \3 m6 }+ D7 J! S% \
- dma_addr_t dmaphysdest1 = 0;* v3 k! Q" ]5 M( u0 N6 O- G
- dma_addr_t dmaphysdest2 = 0;5 ?9 _6 u' [% P* c" b4 {- H
) o7 z' g' D& D5 B( Y8 r- char *dmabufsrc1 = NULL;0 \! [0 i0 p' x( `
- char *dmabufsrc2 = NULL;
) O: O6 e4 q% O. J5 v - char *dmabufdest1 = NULL;
6 u. E4 n+ z, p: @ - char *dmabufdest2 = NULL;
# R4 t, E2 f! E4 S% r5 N
' e4 x, e2 V* b3 y$ I4 F& v( H# [- static int acnt = 512;: ~) S1 l' s! E2 c
- static int bcnt = 8;
- }. c. F2 \3 V - static int ccnt = 8;" b$ n, j9 K$ o7 k9 ~0 v2 y
1 v( v8 }# F) B+ N- module_param(acnt, int, S_IRUGO);# y6 r2 z9 [4 ^' O) u% u e4 ?
- module_param(bcnt, int, S_IRUGO);
% ]$ `% t% G' q, S( n - module_param(ccnt, int, S_IRUGO);
复制代码 1 \6 [$ v, }7 `9 V! F
. [4 j6 Z) }+ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |3 ]1 i0 l/ e. C0 u v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 a8 x, D K# k) T* Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _! s* T& x) P7 A% k9 f" V. R8 e
; n4 \. h5 L/ [. p
* S/ i5 n3 J! Y w. C: G' R- c$ m
|
|