|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 l3 l- D& O; r& [- [code]EDMA sample test application+ o h$ a( `, t" i9 O9 ~
- /*
) h$ \ r, N+ ]+ ]+ L - * edma_test.c
4 A3 ~0 n9 ] \; c7 l3 Y7 U* e - *
/ P" J' B# p2 y - * brief EDMA3 Test Application& B; Q7 X- l# O' T6 A/ _( q1 Y
- *1 ` ?0 F4 Q6 `) C4 e n8 V/ i: m
- * This file contains EDMA3 Test code.
! _; P* |: ^ ]! X7 A& \3 r - *
& E+ f0 L' h% E. p5 L ]/ @0 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ v+ [. \9 S7 K7 F) F$ q* ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 [* Y. J. ~4 @3 A* } - * TO CHANGE.
; Y4 O3 c Y+ r1 C$ U# N - *
5 u/ c3 v. x" n/ C7 |1 _$ ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 m, o2 A8 W, r* i - *
0 h+ F& t3 E) ~# F0 U$ v - * This program is free software; you can redistribute it and/or
6 P+ i# R# U5 k# e* Z& ~: M$ k - * modify it under the terms of the GNU General Public License as! B5 Z% M% y, {1 g+ V% |
- * published by the Free Software Foundation version 2.
- A) X; [* x6 I7 U: O9 Q# {7 Q( P/ O - *
% g6 B. U8 T" B% u. P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 d( K' o. J+ L4 V4 p$ e
- * kind, whether express or implied; without even the implied warranty% U3 M* Y, L4 |* D, @9 D5 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 |; r# y2 t" K8 S9 e
- * GNU General Public License for more details.) [+ T5 G" b0 T! S& Z4 F
- */1 u7 ]/ t2 `- o1 a+ x2 \
- 5 Z% J( N2 t; R% Q) i; r
- #include <linux/module.h>
, x6 k. U0 Z0 G - #include <linux/init.h>0 U( q( b& F& N5 {) B1 c
- #include <linux/errno.h>
$ ?, ^" \) t2 I9 |- T& `8 g$ ]! E - #include <linux/types.h>
4 ^! v2 ?; u- z% V* D: a5 C - #include <linux/interrupt.h>
/ f+ a( o; R3 M5 M/ d! }, @ - #include <asm/io.h>
, D& } w2 Z5 k - #include <linux/moduleparam.h>7 s; G. G9 A Z: k9 V: ~
- #include <linux/sysctl.h>5 X& D( I# E; ~4 _$ O' |3 y2 I
- #include <linux/mm.h>
1 Q% h6 H1 I- c6 p) Y n+ K - #include <linux/dma-mapping.h>
1 }+ A5 f3 X) { - 4 z4 B( {7 n! w
- #include <mach/memory.h># }- M5 m* A% L) R, f1 j
- #include <mach/hardware.h>9 Y/ Y4 G6 ~& A3 a ?
- #include <mach/irqs.h>
5 v% S, |9 `; k# V7 j' k - #include <asm/hardware/edma.h>8 V* K t+ f" P& W' _
1 ~- l- Q) V, `4 m: }! f- #undef EDMA3_DEBUG
8 U2 \) F7 _ Z- Q/ d - /*#define EDMA3_DEBUG*/
g2 w3 ] Y& p3 L
; X) p/ y0 A% i: r- #ifdef EDMA3_DEBUG( t6 \# u$ k- O# X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 J# T* }; b1 I4 \4 ]( G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( F% c1 ]8 Y& j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X: K, B" C* g: b
- #else
3 ]# n K. A6 o! S - #define DMA_PRINTK( x... )# w9 `$ p% c" a, l! v
- #define DMA_FN_IN! x) U7 z6 Q* M: e
- #define DMA_FN_OUT
% R3 ] z& k8 |% W9 V# b9 q7 F9 d - #endif
8 d1 X* C1 J, K
- f* x" K" K+ d' t, h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- I2 S B, E5 v! ] u
- #define STATIC_SHIFT 3" `) H* g% ^2 Z
- #define TCINTEN_SHIFT 20
+ n& a& q# n3 F - #define ITCINTEN_SHIFT 21% n0 L% t( q! J1 X5 T8 Y' Q* {9 x
- #define TCCHEN_SHIFT 225 q# T6 @" V- U
- #define ITCCHEN_SHIFT 23# U/ o2 Y6 Y/ N x: _
- + K3 ^: A8 G+ x% v0 L
- static volatile int irqraised1 = 0;
/ G. X+ o0 V) S! f" |' e - static volatile int irqraised2 = 0;) C5 N4 l9 O, g- ^6 W
- * S! E0 e4 |( l9 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x# c7 A" J# S6 i/ T. d" W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d# Z" C! ]- O2 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f8 ~: V" Z. I- N2 n, g
- ) z9 U4 b I7 }/ Y6 j. ?, ^+ L
- dma_addr_t dmaphyssrc1 = 0;
# o c: K6 N" `/ @+ w - dma_addr_t dmaphyssrc2 = 0;+ N# X. C% R8 S$ m o& Y
- dma_addr_t dmaphysdest1 = 0;
# i; `8 @! l0 ?. U0 r - dma_addr_t dmaphysdest2 = 0;
+ g$ D* ?5 n; |" G! @/ p: y
# t+ `" | {; a0 t" R- char *dmabufsrc1 = NULL;
5 o* ^9 {! Q- Q& |) ^( q - char *dmabufsrc2 = NULL;
5 A6 v0 e4 P1 K$ R; t, v3 \ - char *dmabufdest1 = NULL;
7 x4 l- S% F5 x& `6 M/ G - char *dmabufdest2 = NULL;1 S m9 P5 ^; X$ v* z
- 5 D. ]' ?- Q7 |- e* g$ c* V! ]
- static int acnt = 512;
5 M. a3 x( M; i! E - static int bcnt = 8;
7 P$ u d* t4 ]6 h - static int ccnt = 8;0 l& C d- \# N/ N. ~
0 C: D- ^( o% Z: G- module_param(acnt, int, S_IRUGO);4 E) {0 q4 d( P
- module_param(bcnt, int, S_IRUGO);, S) ~ L% A8 G$ {
- module_param(ccnt, int, S_IRUGO);
复制代码 2 ~1 f5 _2 B" a8 D0 }+ _
+ |2 c" S5 T: f( F5 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# X+ J! a1 o3 s6 c% v; Q
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 A! @3 Y3 f. Z" I5 l" Z" P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 [- x0 _4 n1 m0 U8 ?$ }# |& x
* N0 k& K. d0 i
& L9 M& B: ?1 ^$ o' B5 i |
|