|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. }, S% \3 i8 n" |" L: U; C- [code]EDMA sample test application/ [7 D2 \- ~1 [9 G0 {- Y, o; q
- /*- H! v. H! G2 H4 |
- * edma_test.c# S; t' w& B z" J+ `2 ^: @! h+ T
- *
) h/ o4 n* i8 X/ m5 C5 H u) } - * brief EDMA3 Test Application& y8 u7 ]3 u7 D4 c
- *1 H8 ^ N: N) E: T$ G
- * This file contains EDMA3 Test code.
( C5 L- X: [- i) w& u2 M$ }2 v - *
4 H5 \2 o% P7 M: A. s) H: E4 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
b( J$ K% n7 E! O/ d0 E0 C' { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- T( w% E& z2 n/ y1 ?9 z - * TO CHANGE.; D5 Y5 O2 \6 F h3 {
- ** n8 s' l0 M9 X. ?% ?" J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 F3 Z6 z0 s8 V, L, R9 k% i$ q0 b
- *
$ C' Q2 c- T9 D7 M6 | - * This program is free software; you can redistribute it and/or, l) b) A q4 E; y* Y
- * modify it under the terms of the GNU General Public License as! U& Z! r1 y% S3 w$ v; v
- * published by the Free Software Foundation version 2./ F0 n, Z9 f* b3 O: t/ D1 O2 F N! M: N
- *
9 u. J$ X0 b1 V4 H$ C' N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 L) ^! K" S' [! w) j( r" o- L/ d' y
- * kind, whether express or implied; without even the implied warranty3 R! X: M% I) |: y( ^9 @' ?* X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 |, o) O) N( [% {" v4 D) ~. H - * GNU General Public License for more details.
: N- g. e' Y2 ?0 K7 ^ - */, M( E& |9 J/ I3 A# X! l8 z' D
- 2 G! s; W& }8 _0 B1 n6 n
- #include <linux/module.h>4 B9 O) m$ G V; ^4 D+ U
- #include <linux/init.h>4 s: p# q" |( r7 p) L! ?+ i
- #include <linux/errno.h>' o! V: ]5 Z* D
- #include <linux/types.h>
4 W' Q: `- a C$ x4 |0 Z$ P - #include <linux/interrupt.h>
# Q0 L( u9 g8 ~, O/ ` - #include <asm/io.h>
" q% E2 c& Y3 j8 }" d8 e* [ - #include <linux/moduleparam.h>
" r: J7 U) G! S" c! c: y - #include <linux/sysctl.h>5 {: }) |! [: c+ B( n
- #include <linux/mm.h>0 _1 g: r5 U! G9 @0 L" M
- #include <linux/dma-mapping.h>. P5 u8 U0 W" K6 q( N* ^
5 \4 k/ f* }6 c8 _* N- #include <mach/memory.h>
' @0 z( u" ]% e V3 f - #include <mach/hardware.h>& J% q7 \2 f/ }" `$ [
- #include <mach/irqs.h>
% Q. U. b* [ ?% N: t - #include <asm/hardware/edma.h>8 `$ w0 Z4 b/ n' p' u* U7 v
# q: ]& K3 L" }$ |, \- #undef EDMA3_DEBUG
7 n, M# P- X j( C - /*#define EDMA3_DEBUG*/
3 \& k" @ r! ~4 g8 @! [3 L7 V
R/ r' u; V2 b3 @- #ifdef EDMA3_DEBUG" U0 q: S2 J; f% i/ i0 \1 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 N( i3 w. a$ d# ?, h1 ]* R) b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: p) g1 O, A$ a4 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ?! n" B3 j- @
- #else
3 p1 g7 J4 f3 }% [* F - #define DMA_PRINTK( x... )
5 g/ U3 b/ j6 }- e% W1 S8 C/ t+ K8 S - #define DMA_FN_IN
: Q m7 l! K5 D* J# k - #define DMA_FN_OUT8 \4 t7 @ R. b( g& }
- #endif
5 I$ ^0 D, m) F" n - $ F4 j( u( R r( h$ @! @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
m4 c/ ~3 u n. C5 |" j6 M* K - #define STATIC_SHIFT 33 D! K3 p: e/ O, w( b1 U, m
- #define TCINTEN_SHIFT 205 e$ a! i% k/ v/ @0 w1 `
- #define ITCINTEN_SHIFT 21* \; A. K; D3 U1 @0 ]
- #define TCCHEN_SHIFT 22
! t3 T( T/ z \ - #define ITCCHEN_SHIFT 23: K- `* q( u9 X
) ~, k" @8 y! C& O. M- static volatile int irqraised1 = 0;. N! f1 \" D" P2 p5 g) m, w
- static volatile int irqraised2 = 0;) W- K# k2 e8 v
- 6 b# N$ J; e4 `' m( t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( N1 L: _; a9 b; u8 D# v' h1 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f6 \2 u) m' \! W8 {+ Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 M8 q M j0 n: B
- g( u+ c) o3 e" H
- dma_addr_t dmaphyssrc1 = 0;
/ F- u1 ~5 v4 G; B0 S) K. n - dma_addr_t dmaphyssrc2 = 0;/ c. T7 [7 G7 L2 ], @
- dma_addr_t dmaphysdest1 = 0;
% g5 x; n+ ^" w5 }: q: F0 Y3 x. B - dma_addr_t dmaphysdest2 = 0;( k- n0 V, {/ a
- % e# ~! }$ f# K/ t `) \( D: T
- char *dmabufsrc1 = NULL;
. [1 o1 h: P1 [/ W8 w - char *dmabufsrc2 = NULL;/ B$ E0 z: w! Y. L# s( E" o1 s
- char *dmabufdest1 = NULL;2 Y Z: t& P: |
- char *dmabufdest2 = NULL;. i& u" t B' d1 t3 h i
" |' L* Q7 B( P" N$ G- I/ X- static int acnt = 512;
# I' b1 N: q" m6 x7 L - static int bcnt = 8;
1 B) I( ~0 E# ~" h2 T9 v - static int ccnt = 8;
" d: f2 ?4 b9 {
7 Q' l: Q% Y k) w* w8 q, J- module_param(acnt, int, S_IRUGO);
+ J( z* |* O1 j' b - module_param(bcnt, int, S_IRUGO);
6 U4 f( F9 d( S6 L - module_param(ccnt, int, S_IRUGO);
复制代码 0 c! e$ [2 i! ^: q; W K
: @% j# R l* m! V) P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. J. r7 N8 V1 J6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 U/ \! ?1 a* r7 o0 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( s& j m. o8 m6 u5 _) r2 ]7 V# X! m) Z% Q& p( y9 O$ F+ U
/ `3 K* a8 H* c# G% |
|
|