|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 r, o9 O+ p7 y7 ?7 W- [code]EDMA sample test application9 u4 X, a8 T5 G" `6 J' f) J; R
- /*% B5 Q! q7 @ P7 e; q b2 I9 i
- * edma_test.c6 N( ?7 F+ ?( T. K
- *
) Y8 ^+ i) W3 ^/ Y# a! n9 h1 `: H* \ - * brief EDMA3 Test Application
- A# m9 J: w5 v( x* A - *; j/ i& a/ g% x4 Z- i. t( l
- * This file contains EDMA3 Test code.4 A0 J2 n) b- A, c& Q# [
- *1 p& q1 W: M* t0 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 O: K" |- }* V+ A$ @. C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 d/ l: U+ O" V/ ?0 N - * TO CHANGE.$ E7 O5 m4 C; J+ x/ n
- *; r$ g' R# X% j+ g0 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ?. a* D) m: H0 x
- *( u1 u: M6 V$ g% ~
- * This program is free software; you can redistribute it and/or1 l+ J9 ^9 b' s4 e* V+ `
- * modify it under the terms of the GNU General Public License as
% K# u! ~: `* @( a4 `, Q - * published by the Free Software Foundation version 2.
! E7 Q2 |* W, R - *) N, B6 q+ S: Z* i5 {# x4 R2 w( ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f) N) H+ P! J. P
- * kind, whether express or implied; without even the implied warranty* L* h* {* q7 s( Z/ M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ U3 c& x. V- U R1 V1 w( c" j( V3 y
- * GNU General Public License for more details.' o- v, A" G5 j) u/ N
- */
1 t9 H \5 B2 L- v% W1 [4 U5 |# U- h
f; I4 z7 y/ g9 S- #include <linux/module.h>
8 P/ h* a9 ^' f8 l: I1 g8 e - #include <linux/init.h>9 T1 c4 `/ T; L6 a; ]$ P( j2 d3 d
- #include <linux/errno.h>
% o% A; H6 F+ p - #include <linux/types.h>
; Y, A ]' H* W: B - #include <linux/interrupt.h>
' V- o- R) H9 E1 D; N! C4 K. c - #include <asm/io.h>
$ }8 J& I" b- _4 ?$ f - #include <linux/moduleparam.h>
I% z4 U. s7 P! d - #include <linux/sysctl.h>
' y B" F) P" V. l5 P - #include <linux/mm.h>
. ?% b3 n4 I7 z, q+ d4 r4 Q2 H - #include <linux/dma-mapping.h>
- o2 v+ x# D5 ~) g! F - + m# v" y' }1 i' B( J+ P
- #include <mach/memory.h>
0 z: D/ c) X0 |$ D1 g - #include <mach/hardware.h>: F5 j8 N) ^- M
- #include <mach/irqs.h>
9 Y& H7 M" w/ n& w - #include <asm/hardware/edma.h>
, |' {* k3 l8 V
6 X; c: r* B ^3 Z% l) v- #undef EDMA3_DEBUG
$ u* R* m% `# u - /*#define EDMA3_DEBUG*/( j7 P- ]' F! N! ~( @8 ~0 D
. I$ O( g1 w0 u7 v S9 @/ S- #ifdef EDMA3_DEBUG4 n, \) |3 T- H- w* |0 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) ]$ R R# f Z" M8 D* m9 M! j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. |8 w+ b: W7 V0 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 s# W8 g( `7 \9 P8 H: q - #else
) d7 c ]8 l) ^- e. v) l: k2 p - #define DMA_PRINTK( x... ); J2 F9 ^! ]! d7 n
- #define DMA_FN_IN
* c% V% ^5 R9 i @( d+ J - #define DMA_FN_OUT* j; @# z& `+ J
- #endif
3 Z( F+ Y \& A. Y( P- o
$ |! d" J3 ]9 {0 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 M* }1 f& I8 N - #define STATIC_SHIFT 3/ t: k8 q) X* S! b6 {+ N$ O
- #define TCINTEN_SHIFT 205 U5 J8 x8 d ~- O! a7 p* K
- #define ITCINTEN_SHIFT 21% F' u1 ^( w0 Y8 u9 a! K
- #define TCCHEN_SHIFT 22. w/ j6 |: w9 `% v
- #define ITCCHEN_SHIFT 232 \5 K( P5 \4 P& l5 S
- ' w" o0 f8 j' A2 ?$ C! j4 b
- static volatile int irqraised1 = 0;% S6 J9 D0 V% y$ D/ N: g
- static volatile int irqraised2 = 0; E; y3 T8 a" m. T
- : V. K8 d$ _6 D3 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @# c/ u# b7 T9 `" L) [4 G; o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o% _1 v3 `0 P, {5 _" z! C4 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ]! a3 q, Q4 V( i4 K
. B& n" @. J7 g* c2 h4 o) \9 H6 M- dma_addr_t dmaphyssrc1 = 0;& {% Y* ?7 q' n( I$ b w5 U0 m2 `1 V
- dma_addr_t dmaphyssrc2 = 0;, Y5 o! V9 x9 e0 t5 p) t
- dma_addr_t dmaphysdest1 = 0;
8 r& o8 X6 S9 g* b8 A: [* v - dma_addr_t dmaphysdest2 = 0;; f" Y7 }! P5 L9 N2 b! k
- 1 q5 ~) ]9 F8 ^
- char *dmabufsrc1 = NULL;
& Y5 n1 F+ ~! }, I - char *dmabufsrc2 = NULL;/ O. k& O. H, N- b9 e7 E6 f
- char *dmabufdest1 = NULL;) E: Y) H5 [( @2 i1 P& `8 f2 h* I+ b
- char *dmabufdest2 = NULL;
+ c+ v; N. }" z - 8 b. T/ v2 v \2 j; ^
- static int acnt = 512;0 l' C; @& L2 [0 J4 z& A8 p1 J# h' ?
- static int bcnt = 8;
( A' P2 b$ g- e, ]/ I6 n" @ - static int ccnt = 8;' H' X4 T5 I5 c
- # q$ y9 {6 K' ]% n7 D+ F
- module_param(acnt, int, S_IRUGO);
5 T4 ~; z5 x! ?" R' u3 D; N - module_param(bcnt, int, S_IRUGO);
: Q, g! g: \4 d' | - module_param(ccnt, int, S_IRUGO);
复制代码 / u% D* M M$ V; R. p1 B$ z* g
8 o1 a. s% w7 F4 G& V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( P1 V5 }5 g7 L' D; q* e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s8 K4 ~. P- E* J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 B- @- ^2 y0 u) x, f, q1 W8 B9 y' w5 e
9 T" o% m! x% y% L: x; K5 Z( ]
0 T9 Z6 P, k+ y% }+ Z) ?! p, D |
|