|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, b) q' Q! U: v- [code]EDMA sample test application# m4 l" z4 y% g. W" K3 q% m% K/ r
- /*
, U. b U0 k4 i/ P% ` - * edma_test.c
' n" o, D% I3 ? - *
6 d" V. ?6 @! S/ N* \: ]3 l7 Q - * brief EDMA3 Test Application
* y# P' x2 A7 W# U( l2 S; z9 [ - *) d# n1 z+ I7 e
- * This file contains EDMA3 Test code.: d$ O1 C# b* A& | K D
- *" \) L6 O. N: b6 N, f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Q' i8 C2 K; Z$ c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D) X3 h% U) c! S( x& i
- * TO CHANGE.7 j5 n! X# e2 k1 r& m, G
- *
4 ?$ e" @9 i3 X* C) Y$ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( n+ `0 k5 {! k7 d6 I - *8 Y y$ q% Z6 `/ R6 O( k; T! ~! p
- * This program is free software; you can redistribute it and/or0 t. J) c3 X# l! L4 g% U
- * modify it under the terms of the GNU General Public License as
4 r1 n, d1 H/ [: U% t+ n5 y - * published by the Free Software Foundation version 2., v& B3 g5 x6 ?, t+ y9 }; p
- *; z# ]6 k. `1 i, w; }$ J, `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ U- k* s& o3 k7 D8 q q - * kind, whether express or implied; without even the implied warranty1 g1 J4 X6 t2 E6 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 O/ `+ x1 ^& d - * GNU General Public License for more details.
/ {7 P; O/ Z* F1 N+ A2 b - */+ I$ H m0 r; W2 \$ O% G
3 P) v$ M0 Y6 T w# y- b- #include <linux/module.h>
( x6 j$ `3 ^2 {- h - #include <linux/init.h>
1 p7 W7 t; I5 _" x j% Z$ _ - #include <linux/errno.h>6 ]* X1 l$ M# @3 E
- #include <linux/types.h>
- g& }4 \" z' M l# L - #include <linux/interrupt.h>
6 O- F7 l; G7 b# J5 m p - #include <asm/io.h>
% b; U" F8 @ j. M - #include <linux/moduleparam.h>
& M7 h- g5 e. W8 T - #include <linux/sysctl.h>. P6 _. V/ n d4 I8 O
- #include <linux/mm.h>
- @# U, C/ f5 ?: p& \3 S- V& S - #include <linux/dma-mapping.h>
J" S; ]+ c: t" H. b
+ q* ]& O; a& k) l. q- #include <mach/memory.h>$ U* ~8 G$ K: P/ C, {& ] a
- #include <mach/hardware.h>
; i; z% M, S; t* v - #include <mach/irqs.h>
0 {" V- ~( x( P) l6 ^. J- G - #include <asm/hardware/edma.h>5 Q# K& e2 x/ C& p' ?
- 7 n* S* b% } d. l% z
- #undef EDMA3_DEBUG
& {# l; R; S+ F - /*#define EDMA3_DEBUG*/6 J; N) {% S1 z6 T: z r
}! y' E* `# n) ]( L$ x( p* g- #ifdef EDMA3_DEBUG
3 f. E: S2 B' q& q8 L2 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( |* [9 N0 I! U: c# E9 p+ Z P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) \6 b/ U& c- U/ E7 K( r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 P. A, ]3 a9 q* p/ X - #else
. d/ b7 n3 L- g t6 } - #define DMA_PRINTK( x... ): x+ a+ L& v5 {) H' h" q9 y; ~1 l# C
- #define DMA_FN_IN
; }6 ]( i8 z% B& ?" U - #define DMA_FN_OUT$ \$ j) r" w- z$ I4 U! m
- #endif9 v$ F" ]1 K& g$ w% L
+ [. I6 h" P2 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% l5 b2 i8 ] H% E; C0 a p0 F
- #define STATIC_SHIFT 3
]# N: }8 m0 Y% m - #define TCINTEN_SHIFT 20% ^( \( q- d4 N: D- [/ a
- #define ITCINTEN_SHIFT 217 Q7 O0 r4 `, l% K
- #define TCCHEN_SHIFT 22
3 {/ s' H# {6 D2 q2 z8 x - #define ITCCHEN_SHIFT 23% A- z6 r# A/ f7 ]) O2 ]4 b+ N
- ( L$ u" x" Q6 U' Z; X: g$ @
- static volatile int irqraised1 = 0;0 z" D; X% _+ q V. |8 e
- static volatile int irqraised2 = 0;
, V+ s2 V! \( ] `+ {& D9 M; h
" Q0 J4 a& h* h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 H9 H' E, c- c- N6 Q1 k0 v" m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J- h9 ~. U, m7 w% Q, \& \9 V7 f* k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?3 \3 B7 b# ]/ o; z2 ~$ F
6 I- K4 U5 v, ?) L& @- dma_addr_t dmaphyssrc1 = 0;( y6 ~3 S: m U: W
- dma_addr_t dmaphyssrc2 = 0;9 Z& l& n/ }! A- U% X. \( ^
- dma_addr_t dmaphysdest1 = 0;: t, Q+ W# d% x; m( T& B* u9 O7 E* Q
- dma_addr_t dmaphysdest2 = 0;
( J/ a% {3 R) ? - ' H: W/ \* p$ g; d8 ~
- char *dmabufsrc1 = NULL;6 k+ ]8 t4 h. m( b! m1 l/ ^
- char *dmabufsrc2 = NULL;
9 u! r- ~1 a9 I7 a5 R5 c - char *dmabufdest1 = NULL;
/ r5 e! P9 q/ W/ ? - char *dmabufdest2 = NULL;
7 C) v; E6 N; g
2 Y$ y7 Y! z& m! `: ^- static int acnt = 512;) u5 K- | f6 i4 j/ d% c% |! ^
- static int bcnt = 8;
2 w0 d7 d+ L( i7 m S - static int ccnt = 8;
2 w3 d7 k! h: E* R, }8 \ - 7 o/ \! a: i+ v4 D; w/ m, x6 ?* ^- t
- module_param(acnt, int, S_IRUGO);- E) P1 i+ v5 G- L/ a
- module_param(bcnt, int, S_IRUGO);" k. i% ?2 v2 E0 G1 ~' R
- module_param(ccnt, int, S_IRUGO);
复制代码
4 @4 _9 n! P0 L! X3 M3 E% o$ a- ?6 P, @! m- |- L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: N2 M$ u! i( C6 H r( ?- z6 _' K+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; a1 o7 D0 e$ ?3 ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: Z3 ^$ M4 J, p8 i5 e2 G
p1 L* c1 _+ p8 C* w+ h- f0 h0 g
0 C; _1 Q) d2 i3 [+ ` |
|