|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( G3 T A* o1 t- [code]EDMA sample test application
- A& L& D8 z8 a. ^( G- W - /*$ Z! H/ l: e3 ^1 t7 }0 @
- * edma_test.c
, x, J5 ^% A+ G' X+ M/ d - *4 a& P }9 l7 ?4 a! K) O; {
- * brief EDMA3 Test Application
7 w8 S! e; U% }& R - *3 C# h, I# k7 Q6 b' i" i% C
- * This file contains EDMA3 Test code.
, W ^7 c+ s! _/ R" A; N - *
9 C' {9 X+ N# M6 a6 }* N* H; K- ]5 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" D4 W5 a* E9 H. `* t3 s( N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* d6 w( Q0 D' W }& L7 i - * TO CHANGE.
' |4 W0 m, s) B - *
4 N# ^, U% E: \4 C" `6 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 @% x% q4 e0 O e7 d+ u - *
( h4 m1 d' k. _1 i" @% Y - * This program is free software; you can redistribute it and/or0 w2 i3 r5 g7 N9 |
- * modify it under the terms of the GNU General Public License as
9 \; F! F( V& [& B! d - * published by the Free Software Foundation version 2.
) y% k- @# }& W7 h0 g7 R. m+ ` - *: k# D. {- k- \8 B( e& ^( D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: c0 i; h7 C& \1 l4 ~! j! C - * kind, whether express or implied; without even the implied warranty
6 k1 a% G" a" h8 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- [9 ?6 S% o# ? {
- * GNU General Public License for more details.
& C5 r2 b; v8 b% d - */8 j9 ^# g: B' r" |4 u) y
- 3 G$ v& S j8 f
- #include <linux/module.h>
( `- D. ^& C, F9 ?% _ - #include <linux/init.h>, n j9 l* @8 B/ e) a- ^
- #include <linux/errno.h>
, ]4 Y$ }; A1 U9 D - #include <linux/types.h>
8 i v0 t( W9 l; Z1 N - #include <linux/interrupt.h> p6 K5 C* r, e7 f q2 J& @
- #include <asm/io.h>* }8 U9 L; ?; ]' o7 I% Q
- #include <linux/moduleparam.h>
# z, q& {' ~; c5 q* r - #include <linux/sysctl.h># \2 s3 L+ J/ i9 @+ v
- #include <linux/mm.h>+ e5 D* L# {* I/ s9 c1 g
- #include <linux/dma-mapping.h>
! B4 _3 E$ b! J0 _
6 C5 @" ] l/ h, n/ j7 }* Z- #include <mach/memory.h>/ z& U3 L3 g0 l$ r. J2 U- f* a
- #include <mach/hardware.h>
" ^# V4 H& [5 h! e - #include <mach/irqs.h>/ I$ w# q. o% x' C/ B! x
- #include <asm/hardware/edma.h>
3 a3 ~1 J- i5 [$ G - , I3 P2 K8 U/ s- J/ D
- #undef EDMA3_DEBUG
' o2 u# \, I: E3 \. m# Z - /*#define EDMA3_DEBUG*/
- p% n( V* M) R* r+ x/ p
; _% G# v) |: v+ f& V- #ifdef EDMA3_DEBUG; `9 ?5 L# ]( a- L2 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ]$ Q3 R* H% s6 e: D# d% ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* B I% S- p6 L* d' ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Q3 x2 U" A9 J7 g$ Y' f$ q
- #else
7 G0 x" R3 |6 D+ k9 I2 r1 z2 F5 r - #define DMA_PRINTK( x... )0 v n0 W" Z% d. c' M3 ^2 t
- #define DMA_FN_IN# y- ?3 M, `3 R1 `" L ~
- #define DMA_FN_OUT( S, ]. k$ R' ~- d0 D
- #endif
2 N/ P* H+ Z; m- j9 A
9 B; \( \/ e6 N, d# l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* D. N$ Y( x/ c+ ~* L
- #define STATIC_SHIFT 3
D1 N8 U. h8 E9 F% \$ s4 f - #define TCINTEN_SHIFT 20
: r. ^# u( R) S- s3 i - #define ITCINTEN_SHIFT 21
6 m( G( d, U1 B4 R% { - #define TCCHEN_SHIFT 223 b( U, t0 q2 x- s/ W! F
- #define ITCCHEN_SHIFT 23
8 Z4 T* c$ A( y: \0 Q
3 T. p, a) ]( A! Y- static volatile int irqraised1 = 0;3 [. l( H. K8 A! f& O
- static volatile int irqraised2 = 0;7 U+ E9 D4 z( l, b' A$ n
- ) p3 i+ \/ |, c8 c3 _9 l$ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- s* m- H" |4 c% k' K: Q9 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y/ C3 j) Z% ~& u, B; e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 a1 J$ i" y6 W- R: N" J# o3 F
8 U3 ^3 y; R9 k: L: k% Y3 `- dma_addr_t dmaphyssrc1 = 0;
) [! e/ E# j4 l* h9 ~" n( w - dma_addr_t dmaphyssrc2 = 0;) E) U) v7 ?" z# o
- dma_addr_t dmaphysdest1 = 0; Q0 z. y; D, C3 V( u7 R0 ?/ x0 d
- dma_addr_t dmaphysdest2 = 0;
. z% d$ H+ i r) V9 ^4 c - % ^6 Q; o6 s! ]$ y$ R
- char *dmabufsrc1 = NULL;5 z! p E( p: I: h V( y
- char *dmabufsrc2 = NULL;& e2 b+ f$ A7 \6 R* e
- char *dmabufdest1 = NULL;7 Y, T ?2 ^2 y5 m
- char *dmabufdest2 = NULL;
0 ]6 i6 j) V6 f; O) i, @! D - * ^6 c# M. Z' n, u, \5 w
- static int acnt = 512;0 r! d' p) }/ @. z& u
- static int bcnt = 8;( ]+ z l6 Z9 g6 |7 g: @4 s5 K! v
- static int ccnt = 8;% N* q. g K; M# o
- 5 ^' i: h$ h8 z2 a3 m* k1 G- q
- module_param(acnt, int, S_IRUGO);# n- j+ X M; r
- module_param(bcnt, int, S_IRUGO);
- x& b- `& s, E6 `1 u, C, f - module_param(ccnt, int, S_IRUGO);
复制代码
& i8 c7 G: W, r# C0 g2 F: o
2 c' C( V( c) m7 N% h6 t$ c3 l3 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ?3 [5 C+ i& z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Y+ W; S* n! R; a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% H$ N" ~) R# d( s+ E8 P/ R
& j0 l% ]! K: K# \; D0 A% U2 Q) K$ f0 n+ b* s* Y+ D/ b
|
|