|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
A9 z& \' x Q- f' I- W, [- [code]EDMA sample test application; Z6 I3 m' N' k; `+ l5 E! Z a
- /*
$ T' k& ]) b& e6 y4 z4 D7 l - * edma_test.c
f3 a1 Z/ H6 J4 k* \5 R: N' K7 N - *
! _$ u/ D% O, w, t) s7 { - * brief EDMA3 Test Application
3 j4 K. L; Y+ X0 L) r - *( Z# P$ d8 l b1 v4 t) f
- * This file contains EDMA3 Test code.
8 u1 G, C& F6 h - *
; y+ d- q, T$ `6 f1 N4 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 O3 I9 p+ B; v7 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 G1 x, Q% J8 U$ J R
- * TO CHANGE.
$ z0 {- _0 W: \( h* O0 C - *
1 W7 O! C$ \% m& S: z: S' B; t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( C8 L. u# K$ A$ [/ m2 r' x
- *
4 t( n* `/ ^1 x3 ]4 ~ - * This program is free software; you can redistribute it and/or- p) k+ ]/ l, {. V) m& R
- * modify it under the terms of the GNU General Public License as7 i+ [% l' ?* o( i% Q6 t, n& u
- * published by the Free Software Foundation version 2.# s. C9 P8 b( M/ h0 S$ N2 H! y
- *6 ~6 [5 i& M2 O% f. ]* U# P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 \% c' I( o8 K' M+ N: U0 {
- * kind, whether express or implied; without even the implied warranty4 X* Z1 ^. ^+ X9 a. w* |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, m+ X& ^* Z4 _% v - * GNU General Public License for more details.4 P# Z" c$ _5 D8 V
- */
- w; g* s* U! j/ \+ u
. [9 f% H$ S4 d( i- #include <linux/module.h>
P+ a1 J V# R& ~ - #include <linux/init.h>
: F/ Q5 M/ ?( E+ v$ P/ F& P - #include <linux/errno.h>
8 Y( R+ ^- K% h' U2 j7 b - #include <linux/types.h>2 Z* N! E) _* F
- #include <linux/interrupt.h>
3 c: r5 w' e0 |8 o - #include <asm/io.h>
2 j7 b" y8 Z- r/ h* D Q. y - #include <linux/moduleparam.h>+ r0 l5 T9 ]' M+ A; N' P
- #include <linux/sysctl.h>3 M! [$ _2 M0 Z. g& [
- #include <linux/mm.h>
+ L4 j0 K% h2 n# S% t; B8 _ - #include <linux/dma-mapping.h>) ^. X; u$ O3 q! ^
- ~! P; ^% \0 L) l! @
- #include <mach/memory.h>/ x& ]4 P( Y# \7 C* }$ a8 J
- #include <mach/hardware.h>6 g' E0 m/ l, N4 h8 u
- #include <mach/irqs.h>- a# U5 v/ Y9 V
- #include <asm/hardware/edma.h>2 ?+ ^, l! ?9 Y4 ?! ?. O
- q: X/ \6 F3 B6 q. X! P- #undef EDMA3_DEBUG6 J/ {5 ]0 h7 m
- /*#define EDMA3_DEBUG*/
) N0 {# L8 _' ~ n - + Z9 y* O; ]% J
- #ifdef EDMA3_DEBUG; q: W* E1 p$ W. t @9 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. e, ]# J3 y3 A, D; s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- H) Q' |7 ]# r6 j! F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. m& h" W9 c' [4 B - #else
2 ?; T# l- [- g" Y* `' ~# |' ? - #define DMA_PRINTK( x... )- p2 s3 U, ~ r; G
- #define DMA_FN_IN
7 W# e2 j6 v1 w/ O+ b! v3 q# W - #define DMA_FN_OUT
* ?0 q7 h* l2 q - #endif& Q; y- `+ U$ w @5 A
- 2 L7 }, a4 A" m I* j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ]' ?5 p- ]5 h: s - #define STATIC_SHIFT 3" H D% R" u' u2 y. y
- #define TCINTEN_SHIFT 20
9 ^# b. T8 t8 v - #define ITCINTEN_SHIFT 212 Q# |- i" { l. H$ \' i7 n1 C7 f( E
- #define TCCHEN_SHIFT 22: R* i O( ~' F
- #define ITCCHEN_SHIFT 23
. A/ M; O/ H# y3 E+ _$ m5 ~
( U5 J( x- F) @8 g; r7 r0 t- static volatile int irqraised1 = 0;
5 O/ i3 o, z6 v% @1 [. t1 `0 _( f( C - static volatile int irqraised2 = 0;
! N$ m! N- u3 _/ N/ p9 D
. G' ?" {9 H i3 E$ u5 R0 Z* x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 l6 M& }% Q. i$ p8 G% { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p9 G& t( G }3 R) A3 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; J: c; h X: c+ k* g! l. _
8 b; e) L' z5 A" y% y8 ^5 u7 d- dma_addr_t dmaphyssrc1 = 0;
2 |0 G1 R* L0 t* ?5 z7 n - dma_addr_t dmaphyssrc2 = 0;/ j0 }3 N1 C. x4 A" C' S& I
- dma_addr_t dmaphysdest1 = 0;$ R8 G% R) K) ~! M2 e1 q
- dma_addr_t dmaphysdest2 = 0;
5 [4 A$ O. Q- {2 Y3 P
. }" t2 e- L2 O, V9 U& C- char *dmabufsrc1 = NULL;
( v% L# D) Q9 z- w1 e& v - char *dmabufsrc2 = NULL;, @. S3 j! L+ q7 S3 T
- char *dmabufdest1 = NULL;
" N7 {$ I( A' ? - char *dmabufdest2 = NULL;# l' t, s# W/ [8 W! z' k
0 I% x/ R( t8 I G! ]- static int acnt = 512;- N5 M! w$ n" ~( i0 \& |. ~; {
- static int bcnt = 8;$ q1 s( r$ j- s5 {3 D
- static int ccnt = 8;
' ?: ^2 v! Y4 U3 T1 J, W - # m; R( j" _0 O( F4 S) ^
- module_param(acnt, int, S_IRUGO);
. J" r1 a. H: C* w - module_param(bcnt, int, S_IRUGO);: V' S% ]1 R1 R( {: W& `
- module_param(ccnt, int, S_IRUGO);
复制代码
- A* { o' Q7 M, m
3 W0 N1 l) ^( Y2 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- N0 D! z2 b# a, l. Z" ]3 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 h7 V' \0 ]$ @8 z3 ?$ X! }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) {. e# H4 @7 X- K0 G# s2 O
3 R' ~ j7 Z/ ]7 [: V: S
5 `) e, l. ]" h6 z. |# h, ? |
|