|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) C7 `6 C) }" N# X- Z- Y- [code]EDMA sample test application0 D, S- q, b' A3 ~
- /*0 [3 @8 \. v2 u+ _
- * edma_test.c
" c: j' u. f+ a$ B0 O9 d" u - *
1 Y ]( c1 z1 R1 r, I - * brief EDMA3 Test Application
. O9 }6 s( I2 y( _ - *5 ^# k* R/ d8 F4 f2 W8 s4 d. @9 h
- * This file contains EDMA3 Test code.
1 \( w6 m' `: d$ x# @: n - *
" D) y8 q! n% R8 ?, L; b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 b& `& g' p3 i' [" h2 s" C. Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" a: i! q4 i& B1 ]2 e - * TO CHANGE.
1 F# z. `2 Z3 N& @0 ?; [# [ - *
5 F2 A8 W% m8 D7 k4 W8 F6 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: k: b* Z( r/ ]1 F, {. p; Y - *
1 q" ~% g2 _( Q1 J1 W U& E - * This program is free software; you can redistribute it and/or
1 S& C: i8 z" M! C+ X' \- V% O - * modify it under the terms of the GNU General Public License as2 }3 n. L7 s) }
- * published by the Free Software Foundation version 2./ Z2 Z# F4 q/ @/ j+ c. a
- *
# [' k$ d. r: d6 q" ^$ b; a1 m- X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ]( j! B! z, W) n
- * kind, whether express or implied; without even the implied warranty
! @. U! T% i8 `3 ^& b5 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. \+ F; v. q1 b2 j/ T
- * GNU General Public License for more details.: J; U/ ?$ o4 \6 }# v& [/ G+ Q6 s
- */# [/ p) K( ?5 C0 s
- ' U, h) b8 b: \, w) j6 c
- #include <linux/module.h>$ G9 \: W) J6 U1 @5 n, d' M7 B; L& `
- #include <linux/init.h>
3 I+ n5 t! Q, c p% a) \0 N/ L5 W - #include <linux/errno.h>, a, I' Z2 i8 O& Q
- #include <linux/types.h>3 w7 {# ?9 ?5 Q3 [
- #include <linux/interrupt.h>
# @, R* Z/ w3 {; X3 I, Y1 X5 C - #include <asm/io.h>
% \1 f7 P$ x+ v" c- u3 Q; ~ - #include <linux/moduleparam.h>7 M; }9 {1 U# h
- #include <linux/sysctl.h>- g7 N. y ^. |, _
- #include <linux/mm.h>* q w7 \2 F9 [. V. F( U& \! F
- #include <linux/dma-mapping.h>
' e: g9 d' X& ?& R. K- r% N# { - ! n+ y2 s, X+ Y# c$ O
- #include <mach/memory.h>
$ I h- L/ j! S5 E, V - #include <mach/hardware.h>
7 F! U9 b. t5 A - #include <mach/irqs.h>; p. b5 k E& c+ \ Z1 ]
- #include <asm/hardware/edma.h>
) P. P* ^ _ m+ U
! W' F: J# o6 M. b m% [1 a- #undef EDMA3_DEBUG" |) T- ?! o( W. V
- /*#define EDMA3_DEBUG*/) v: a' }0 b: ~; ?9 |3 q6 N0 H
- 3 V$ g$ l9 M' M6 a( {' p
- #ifdef EDMA3_DEBUG1 x! ]6 ]6 B- p; y. X2 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 v; _) o4 I( ^2 a- F- C3 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. K) m( M* A' A1 g N3 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( [$ _" Z$ i5 }" R
- #else
$ M0 m2 J" I+ y - #define DMA_PRINTK( x... )- d. ]4 K, L b% S3 F; S
- #define DMA_FN_IN
9 y& S) ^: \ z+ y - #define DMA_FN_OUT
$ s5 _+ l) W5 F/ S - #endif
9 d3 z5 \: r( q; x5 D! v
) ]: c: E! _$ ^0 u! Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 @8 a7 o# J3 r! n3 e/ [2 S - #define STATIC_SHIFT 3, [- |0 s6 { p1 i# [7 t3 V) z
- #define TCINTEN_SHIFT 20
1 e t3 U- n$ p2 ~; i+ J" Q4 _, B - #define ITCINTEN_SHIFT 21
( J" t ^# n' a; j% z# ^ - #define TCCHEN_SHIFT 22
! z: `0 k% _2 Z - #define ITCCHEN_SHIFT 23
- l, N3 L+ ?; B' y6 C- O2 A - # P: j; y3 G: |1 w6 R
- static volatile int irqraised1 = 0;5 g$ {, q$ L% R; w. Z1 ^8 `/ I
- static volatile int irqraised2 = 0;+ e9 V( X) O3 ^+ V$ [% l7 t
+ X5 q+ X, v, d% N# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D5 Q/ O, @0 G" `: F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~, ?) Q; Z+ \; l% Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d7 x- k# n( P6 w0 _9 e
6 u1 C8 E, ]/ W0 W( P& t- dma_addr_t dmaphyssrc1 = 0;8 m$ S# M6 Z* d
- dma_addr_t dmaphyssrc2 = 0;0 Z$ u5 G& x* G; s9 D2 i
- dma_addr_t dmaphysdest1 = 0;( t6 _# j0 d* H5 n
- dma_addr_t dmaphysdest2 = 0;
, |' k( v: k. L/ a' l - + `8 f+ c9 M2 a* Y0 z
- char *dmabufsrc1 = NULL;2 o0 {( D+ W T' H M1 i! ?
- char *dmabufsrc2 = NULL;, L9 h0 ]7 k8 @: _: b2 ^
- char *dmabufdest1 = NULL;
' a7 C/ a" X/ N8 \7 L5 D* Y6 c - char *dmabufdest2 = NULL;% ~; [9 H/ h# e
( J4 ~# B: Z, w4 K/ J, V' @- static int acnt = 512;+ @# t: @7 Z* f) @1 K$ |, G; u
- static int bcnt = 8;; Z' i& s2 ~5 @ n
- static int ccnt = 8;
* P# H) ~' H; _7 b! P3 y, _( ]/ P
+ m' K& ]- v+ M7 [- module_param(acnt, int, S_IRUGO);
6 a1 P( e: o ~5 z, J+ Q4 w4 I - module_param(bcnt, int, S_IRUGO);
6 b+ Y" T9 s: O1 ] - module_param(ccnt, int, S_IRUGO);
复制代码
|9 f h k6 W# @% p
5 D( H' U* d$ c# E3 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 {- E: Q6 H: S0 f& ]5 K& l( B! K. Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 R# i: J/ I& J J' t1 ~1 O9 S- ?. F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m9 r- v7 ?5 w$ c0 `6 b" F. Q, e
4 D0 p8 S1 R. Y3 J
2 b7 I9 m$ q- D# J4 f- } |
|