|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + {! {2 T- U$ j# D5 h
- [code]EDMA sample test application; J8 x$ Y# o: t2 X# m9 T! o5 p
- /*& n: ?& ]! [# v8 t& v- T
- * edma_test.c
5 @+ B* O# k! C( ^6 ` ` - *6 p7 ?2 ? l7 \3 V1 r8 w
- * brief EDMA3 Test Application* i7 X# e$ D- o4 Q }- Q) W
- *% o; s5 m" W! [
- * This file contains EDMA3 Test code.! T& n s7 ^% l% }% |3 v+ {6 x
- *
5 {# M5 L; G7 {3 R" H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X. n4 X/ C! x' V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c- t1 c7 G- E9 i; ]
- * TO CHANGE.+ g3 V6 w+ g4 ]6 |: J
- *
; S9 \ d0 p( }. ]2 M& b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 r* k: [* x' S# h2 P - *
$ K3 F+ o; f+ z/ i - * This program is free software; you can redistribute it and/or T) ]; [+ @; _! \4 N, `! p
- * modify it under the terms of the GNU General Public License as
: {9 h/ j5 t1 B6 A8 J. b& N - * published by the Free Software Foundation version 2.
9 q6 i0 z% Q' X6 c - ** m5 b5 ^0 J( z, S; R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- n6 \$ ~0 _8 H- T8 ?) ?2 ?) F - * kind, whether express or implied; without even the implied warranty" z3 i6 z8 W3 x5 ?/ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ s, s9 r: y/ ?" }' h: @ - * GNU General Public License for more details.1 j$ P% u- V, m# Y5 q
- */
$ |7 e5 `- t. Z3 R* X5 z8 a
2 F* u' ~4 q' S- #include <linux/module.h>4 r- V; ^3 q: C( a3 a( w
- #include <linux/init.h># r9 P# {' N6 j v' `( w5 x7 `
- #include <linux/errno.h>
" m- [( H* ^6 {' ]$ {" O - #include <linux/types.h>
& A/ H$ {/ C9 }" z# x( z u3 Z - #include <linux/interrupt.h>
% [0 Z' j" e4 M- J. q - #include <asm/io.h>; _+ P6 ~, x% x+ f/ l* a2 w( G
- #include <linux/moduleparam.h>0 d" W6 ?" a8 |, ]
- #include <linux/sysctl.h>
9 m$ {/ h& m) X* Z3 d - #include <linux/mm.h># T: c8 R# t9 q. V/ {5 C7 q- E, O
- #include <linux/dma-mapping.h>
, v! x, B% H4 W1 {6 t6 [5 W/ f - ) F% e; R: X. w
- #include <mach/memory.h>
8 D. H7 {: d" I7 E) H, M) O. b - #include <mach/hardware.h>; {, V: s! o% h4 E s( a% s
- #include <mach/irqs.h>
8 E/ |# w$ ^; o - #include <asm/hardware/edma.h>. o" n( d% n/ ^* a# j
- 2 d$ O e1 Y0 Y8 f8 T8 C
- #undef EDMA3_DEBUG( b, X( q8 E2 y; j x: a1 b
- /*#define EDMA3_DEBUG*/$ e, w4 u$ Z) d* \4 c$ r
; J/ O. ~* ?# D& y- #ifdef EDMA3_DEBUG
8 l" c% r3 d3 c! M$ b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Y L/ [7 h1 v4 Y/ W) D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! d# N5 T- ~) @ ]! a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ }8 m- I$ C( ?6 G- _% o - #else
& M7 o6 [' N+ K ~. r" z: N - #define DMA_PRINTK( x... )
" D( T L5 z4 B. O) ?4 ? - #define DMA_FN_IN
2 b1 B; i4 _' M, K - #define DMA_FN_OUT
: e- b9 W) ~" d) a* F6 a - #endif
, Y& u2 ]/ W2 X( S) V
. ^2 d2 Z/ u! [1 s/ O6 |; [: W; u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% E3 y# `. r- a# R8 O' e - #define STATIC_SHIFT 3* M0 p7 m5 E* F* j
- #define TCINTEN_SHIFT 20
[8 _8 \+ ~) E% J" Y: P - #define ITCINTEN_SHIFT 214 R" v5 k! s% Q
- #define TCCHEN_SHIFT 22
0 U. `* V( c" i; Q( f% z - #define ITCCHEN_SHIFT 23
2 t0 D3 _0 T* f; X1 D2 X/ J+ o - % }2 |5 H5 P. E: n* w
- static volatile int irqraised1 = 0;3 ?% V. W( t( M" N1 y
- static volatile int irqraised2 = 0;9 R8 y: \5 j8 e
0 K3 b' O/ k# t" x3 _. h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; f; D! G. S: @' o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o9 c ~' i, G* v, u8 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 P) h/ _" X0 N2 A) X( l
# m! |6 Q7 F6 V `; Z- dma_addr_t dmaphyssrc1 = 0;% l* r' Y0 y4 z/ @
- dma_addr_t dmaphyssrc2 = 0;
3 x$ @* m% m4 ^0 z( [ - dma_addr_t dmaphysdest1 = 0;
$ p t# v" P0 D% ?' V. [ - dma_addr_t dmaphysdest2 = 0;: M, b' X2 Q. g5 `3 F
- 9 |& t* Y( _* ^; C
- char *dmabufsrc1 = NULL;
+ f6 R" n8 k' e5 X& ?0 N; M0 i - char *dmabufsrc2 = NULL;8 |" V; c+ j+ u# w6 X* h
- char *dmabufdest1 = NULL;
3 `) {$ R$ U$ f+ b! ` K$ w. Q, R9 q - char *dmabufdest2 = NULL;
( g* Q. M; E* g ] - 6 E4 @' @3 X9 r% y6 X3 c1 I6 |8 D
- static int acnt = 512;
0 ^% k8 s# P i - static int bcnt = 8;0 e" x$ y- ?3 d6 R4 }* d5 }
- static int ccnt = 8;
( h! R) Z5 Q! U2 K$ S5 P4 ~
+ u: b: ? ?! P$ V0 s- module_param(acnt, int, S_IRUGO);: \1 {/ G8 A) F9 U& I) s
- module_param(bcnt, int, S_IRUGO);
7 U; z+ n' F! B8 p* K - module_param(ccnt, int, S_IRUGO);
复制代码
; R+ {3 M) `# @0 M3 F* E. e/ ^* ? {; |! B" ?9 g8 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, S3 O1 x7 Z5 y3 w4 n! S6 u( B4 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Z. Y- c7 ?, Y7 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) [+ n4 ~9 J9 c( R' u7 ^
4 }* P3 W" J8 v0 _5 d6 C' x! t) |. I% L( l4 t6 W7 h
|
|