|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H6 h3 _. H" v' A4 ]1 X5 J
- [code]EDMA sample test application5 M; j& ]3 q' k" ?, u, c6 [ }' X9 Z
- /*9 N6 R/ l4 _9 Y) }! r
- * edma_test.c: w7 @+ A6 t# J! ]1 ^
- *$ [, x4 X+ }2 Z: Z9 r5 m1 R
- * brief EDMA3 Test Application$ h2 ~- w% \0 s7 T4 t4 _
- *0 j& j" ~' [, A
- * This file contains EDMA3 Test code.
* A% u6 G: S+ [" m0 E - *$ s' `3 _6 p( v# A$ T5 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ a1 K* u! Z& _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 }6 r. b9 A. y+ x. k4 P& m* w - * TO CHANGE.
4 a! A6 Q% v* P; O- J - *: T ~9 K2 a# `9 p# }# m: r# x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 _5 y7 U! g3 z; e, C s4 y
- *
2 A( }9 u# }# F" D - * This program is free software; you can redistribute it and/or# z0 V! ~0 t7 L0 e+ E. ^1 Y
- * modify it under the terms of the GNU General Public License as( L. I) g* A* C; `: j# {1 T& f
- * published by the Free Software Foundation version 2.
$ `- f* z$ \" C& _4 [! c0 a - *
; ~& Z' R7 S2 W6 i. u# v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" `8 a& O* `5 P& U. V
- * kind, whether express or implied; without even the implied warranty
9 i5 Y5 k( ?+ d+ F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 j7 q! S! l9 [( A. N" i: a3 X$ y1 [
- * GNU General Public License for more details.- Z( c: {, d: k0 L; [6 _. S+ z
- */6 a, r3 l, d4 L5 S+ T
0 Y' K! a) Z ~' e- #include <linux/module.h>" L6 K) y5 q+ o/ Y7 c7 c, F
- #include <linux/init.h>
& f) }4 a/ X: t" q* ` i - #include <linux/errno.h>
4 U4 v* }# p6 n' C - #include <linux/types.h>1 n$ ]. i `8 a5 C% f! ~ r/ P
- #include <linux/interrupt.h>
+ M4 @3 ^$ }3 ]+ a+ Z( n - #include <asm/io.h>( T0 H8 Z& n" n3 K v
- #include <linux/moduleparam.h>+ O, q' I; u2 ?) e
- #include <linux/sysctl.h>
?' t# O1 T# f' x6 D2 i - #include <linux/mm.h>- A0 F9 G1 `, J7 s% z5 m1 o1 {, Z
- #include <linux/dma-mapping.h>2 K; ^( v S( b+ e( g H
! |% ]6 P e; t8 f5 K- #include <mach/memory.h>
* |; A' k# m* H7 `4 F9 u5 F - #include <mach/hardware.h>+ M7 ~ f' R% S9 Y$ [
- #include <mach/irqs.h>5 n5 k0 r' {# N, P$ ]( C
- #include <asm/hardware/edma.h>
: k8 r7 R' v& I3 f; q0 u% I - ( w9 L* X7 C% p
- #undef EDMA3_DEBUG6 c0 z# Q4 ]) I' f( \0 G$ {. g
- /*#define EDMA3_DEBUG*/( S4 r/ s t% S' r9 y) M ]* Z
- 1 Q6 d+ x/ V; u. ?/ `* O) e' o/ g e
- #ifdef EDMA3_DEBUG
6 y ]( K( R/ K& k- r' a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m7 U. B7 v. @0 h; V9 b) F4 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ J& P, p3 \0 x" |- g" b5 A' E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) ?$ l+ H1 |/ V0 d- F* N
- #else% u6 q1 q9 W/ M$ \
- #define DMA_PRINTK( x... )
$ h0 g; ^1 C# s) [, ?/ v$ ]: ? - #define DMA_FN_IN& O0 P! a, o8 e6 f. `
- #define DMA_FN_OUT
/ a& \" w0 ~7 h" {: l w - #endif7 u8 g! _: g. n- ?4 ^4 G# b
2 [# ^' p$ Q( r# b& A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 s9 C( {7 m( n! j. [$ e - #define STATIC_SHIFT 3! N/ x9 q2 R$ ^+ K' ^2 a
- #define TCINTEN_SHIFT 20, X4 e+ I: |$ r2 Q
- #define ITCINTEN_SHIFT 21
6 y' R1 Y. W, X1 I- ` - #define TCCHEN_SHIFT 22% g S6 o" ~, M' B) o, `2 g
- #define ITCCHEN_SHIFT 23
- K& k! q7 M T; Q2 U& l) G3 \
2 ~0 {. E1 T! M! l" @0 N. l- static volatile int irqraised1 = 0;
, ~& T9 d! P- m& e0 u+ ~: K - static volatile int irqraised2 = 0;& Y% M/ ~- y8 F. v, \0 n
6 M J3 k9 Y) ^8 s( N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _9 ]' w! D' [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?0 d1 X& ~8 k9 m; ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E* T$ s- x7 b4 J. z% P U
- * s0 B- Z2 ]% V' D4 A8 }3 p
- dma_addr_t dmaphyssrc1 = 0;' E+ B7 w: b; t/ K! q
- dma_addr_t dmaphyssrc2 = 0;# u" k6 a+ f2 v6 w+ P6 D5 F
- dma_addr_t dmaphysdest1 = 0;
0 i! D% C& U9 |" X - dma_addr_t dmaphysdest2 = 0;
. @- }- [8 U, S# o# [5 ~# V - : W9 n7 f$ o: d0 Z" Z
- char *dmabufsrc1 = NULL;% m9 m9 x+ b" ^. q+ Y
- char *dmabufsrc2 = NULL;+ N6 |# n& M0 w
- char *dmabufdest1 = NULL;
! \' V0 u4 i+ W( {% h( W s - char *dmabufdest2 = NULL;9 ~4 @! R1 a7 m' G7 A4 m
- - W0 e& m1 X# {/ {' u) o
- static int acnt = 512;% |4 i& V& |3 Z( {- M! d
- static int bcnt = 8;
1 q7 e# K/ C, c* i - static int ccnt = 8;, R$ f) {& w% u5 K. H2 h
" q+ b: B+ _' m- module_param(acnt, int, S_IRUGO);
& n( ?2 e1 H5 V+ V) B - module_param(bcnt, int, S_IRUGO);+ N7 X/ V; K5 d8 c$ i) D
- module_param(ccnt, int, S_IRUGO);
复制代码 c3 u# V+ w+ w: \* j
+ n& v* T4 e/ ?9 K, d% p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 n6 N% v4 C0 L, S; X" C- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 A# h: M% n" H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- R4 v) X# v$ B: s1 Q7 R
4 z7 n7 ?# j% H# K" e1 U
/ z* W! F2 N5 M: h5 { |
|