|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , l4 f% O' n g# e* n X+ m
- [code]EDMA sample test application* i$ K8 r- w1 f* f; T+ d3 \
- /*
/ N. H7 F7 `8 ^9 _* i, l8 w( ~ - * edma_test.c
3 f) Z% W8 s( }5 T9 W - *6 P$ j4 e& \8 |$ h
- * brief EDMA3 Test Application6 g- L- X& p9 `) ?# w; Y6 {# z
- *
4 @5 D" {& J8 ` C8 N! }7 M$ Q - * This file contains EDMA3 Test code.
. W5 n& ~3 q0 x( P - *
0 A$ ^% e R r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) X7 B( }. k3 z4 r' H' P; { ]) E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c- j1 J& b. e! U
- * TO CHANGE.. Q- n* J) v1 ]
- *1 _% g c! A4 x8 B. Y1 j/ q# ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 H( Z& R( e, |- K9 ~
- *( N7 T! z8 Q% O e n
- * This program is free software; you can redistribute it and/or- ^8 N, x7 H( M) Q6 C$ Y
- * modify it under the terms of the GNU General Public License as
% C% K1 E, v5 O, r - * published by the Free Software Foundation version 2.( Q* ^3 E& q! A; A
- *' D' I, M- w5 J9 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 u! B: F8 U9 U9 @2 P% u- G
- * kind, whether express or implied; without even the implied warranty; I- R& A# ]2 o) A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 C% }9 t$ s, V0 W% ]
- * GNU General Public License for more details.
8 v0 o7 b$ L% Q0 u! _: U5 O - */
; K0 [/ `7 G. C$ N
8 M0 P& G( Y: k) ? h4 k2 x7 o- #include <linux/module.h>
; ^. z; E7 t/ a, n* g, Y& B - #include <linux/init.h>
3 ]+ F- x" A- j) `. K2 O# M2 y - #include <linux/errno.h> a' u# v7 F; u$ G
- #include <linux/types.h>
" n' i% h( d Z# p$ P. q* ] - #include <linux/interrupt.h>
& H2 d+ s) \# E h \9 @ - #include <asm/io.h>" m7 B M# w) {1 y$ y2 R( I
- #include <linux/moduleparam.h>' k: z- [1 \5 X7 s4 u7 F/ ~
- #include <linux/sysctl.h>
) b4 R. c' A5 W+ L! g - #include <linux/mm.h>
M& {) ~) H1 k. I - #include <linux/dma-mapping.h>1 v4 r6 U6 a, `2 H2 T
- 1 z; w3 k# Z! [- y0 i1 U, k0 Y& l
- #include <mach/memory.h>
! G, i; v6 z* y# H - #include <mach/hardware.h>
9 M+ P5 a8 I9 z# i V3 b( ^- c, U - #include <mach/irqs.h>- |8 `: g, v1 T* C
- #include <asm/hardware/edma.h>/ B- [; |# E3 h
" R X* B8 u' z1 J- #undef EDMA3_DEBUG0 n7 J+ g7 D# n! ]& N8 M5 d
- /*#define EDMA3_DEBUG*/
7 a" i* e" z S- X1 K
% x2 x4 L8 E# S% P- #ifdef EDMA3_DEBUG- M- Q+ G$ f3 Y- S0 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 k# J1 t; \5 j" K" M( Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) ~3 y) B6 A9 V. Z1 a4 ^ I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c. i) U+ h0 N$ H
- #else
! q0 e3 }3 M0 e! y - #define DMA_PRINTK( x... )
' t* s4 @# [% a$ Q5 F - #define DMA_FN_IN9 n: |7 R( ?3 w
- #define DMA_FN_OUT5 t, h$ m" N9 ?
- #endif0 @% y ~( H/ H2 T( r7 f8 |: m
- % r5 z8 N9 F+ z7 w: @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% O2 D7 a- t8 ]- U0 h. r4 T - #define STATIC_SHIFT 3
! X( Q8 p& g) u5 T; i - #define TCINTEN_SHIFT 205 \- k4 [: N; {
- #define ITCINTEN_SHIFT 21" H& Z: E6 {# u) P+ H; n
- #define TCCHEN_SHIFT 22
+ Y! f$ j- t4 X5 s6 h1 V - #define ITCCHEN_SHIFT 235 {* x2 o2 j8 o+ k: z) y
) d7 t5 Z/ j. Q- i- static volatile int irqraised1 = 0;" F b+ L. x1 o7 D# w
- static volatile int irqraised2 = 0;" g5 |2 r$ ?4 b/ b8 F6 h
2 b Y+ G* }1 @4 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D! z( d4 v! x9 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; }; t- T4 y/ Q( {$ u4 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, y3 e- T3 z3 C( h- J
) n/ |" n7 y9 W0 S4 X1 z7 c- dma_addr_t dmaphyssrc1 = 0;
s; x0 f8 c' V- c& U& q+ P& T - dma_addr_t dmaphyssrc2 = 0;
6 K o6 f8 ~( l) O' K0 X! F: y* R - dma_addr_t dmaphysdest1 = 0;3 a7 M+ Q" P6 p+ Y" ~
- dma_addr_t dmaphysdest2 = 0;4 o! r) Q/ C) v& b5 [; D5 `
9 {9 X7 r8 }9 s- char *dmabufsrc1 = NULL;
: I3 l* s# W) S' y/ M, u - char *dmabufsrc2 = NULL;
7 X7 E/ w5 _4 w) G- E - char *dmabufdest1 = NULL;% u. x- y- f1 M3 n% k
- char *dmabufdest2 = NULL;+ G! a& i5 e/ N0 h3 b
V8 W: Q J1 B7 G2 p3 G- static int acnt = 512;4 Q- p1 v" A' y6 _- {; S( W8 w) _
- static int bcnt = 8;
\# e/ W& M7 }' A - static int ccnt = 8;* K, W$ L# S% y- v/ r% t& @$ z I8 q0 s
`. M% ?0 S- [+ t4 o- module_param(acnt, int, S_IRUGO);
$ s [4 L' Q4 Q* \ - module_param(bcnt, int, S_IRUGO);
4 R/ E: C$ |3 R& `3 n& ? - module_param(ccnt, int, S_IRUGO);
复制代码
! h. }% G/ I5 ?9 G3 j$ W2 ?3 W, d, f* f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) x( g$ u' B, z4 O3 c0 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ~( g1 [9 M( j$ C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q) f9 J9 g7 `- Y n% z9 u3 X
. S! O: q/ c7 c% F) m/ x! L8 Q) l N; K- g+ f3 R$ @
|
|