|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ P' c8 [, T" h' ]& I* D# I3 c
- [code]EDMA sample test application$ t( \% f* F& r
- /*
7 {9 S& _' V+ g" D3 d+ v& ` - * edma_test.c
& D( t7 g1 V: B$ P$ e7 u - *" V. S$ z0 ~+ I
- * brief EDMA3 Test Application
1 j0 h/ y5 E: @* W3 m+ C4 _* f - *
5 T& x. Y+ d0 {6 J; {! Q/ x* d - * This file contains EDMA3 Test code.( L, C* g- \7 |, y" B6 O! p5 ] D% d
- *& @# q' g7 f. j$ T- i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
g" ~* c7 f: y- O. X5 i+ e) _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: u) a w2 g" q; q1 k& Z7 h' q7 g
- * TO CHANGE.
1 Y9 f$ O( B3 I8 L( G2 j2 }( y - *
( t3 L5 V$ _( [1 P; g% d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, c* V! f- b# ~! b! z; H% x
- *) W) b( y* F0 Y2 Q* X* F
- * This program is free software; you can redistribute it and/or
% G" b- G' Y: P% ^( v" `( A - * modify it under the terms of the GNU General Public License as
* b. `% E. |) E. ] - * published by the Free Software Foundation version 2.3 d+ D+ s. }0 q7 @+ B2 c
- *, R) f+ j" ^1 g$ _) x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 e, c) c% A8 g. N" C
- * kind, whether express or implied; without even the implied warranty
* f- E: l2 h7 y6 u. Q7 S! }7 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 b9 I4 S$ Q% ]/ i0 n' E9 I7 E/ H
- * GNU General Public License for more details.5 d- G) [2 r& E/ ~& [
- */
$ d+ O! C8 B9 m, Z- y( e( A
' A- _# W: S: S7 I6 s" G9 v- #include <linux/module.h># Z" u" y. X( W2 j
- #include <linux/init.h>0 C1 {, V6 s" N& V
- #include <linux/errno.h>
2 c8 Z' D0 q( x$ @ a - #include <linux/types.h>
; Q; Z$ ]4 T2 t: @! t - #include <linux/interrupt.h>. p6 Z2 ~1 f% S% h: A
- #include <asm/io.h>; V% A2 i- f; n
- #include <linux/moduleparam.h># c) {/ g/ `( c6 j6 O
- #include <linux/sysctl.h>
( z* n' a& X6 C' F" O) D/ X! S - #include <linux/mm.h>
4 J1 f4 }* {. J/ Z - #include <linux/dma-mapping.h>: W% i2 T% @' O
: H( [4 N, L3 c' f- #include <mach/memory.h>
]! T7 Z3 K9 z% l* V L5 Z - #include <mach/hardware.h>
5 ?; o$ h. T( T1 z' D - #include <mach/irqs.h>
: _2 H3 e! j5 ^/ ~; Y - #include <asm/hardware/edma.h>
1 p. k" c3 u5 A2 f/ r - , r4 z; b0 }' H$ I
- #undef EDMA3_DEBUG* U5 {+ S) K w7 l0 |
- /*#define EDMA3_DEBUG*/
6 Q" Y7 j- P Z' f# A
. A" R- t5 g7 K! t- #ifdef EDMA3_DEBUG
2 S0 D& i2 _: d: Q! Q/ q+ G2 V$ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 P$ @( m9 R( y% x! s. H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& }0 o5 U; d3 {9 ^1 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 N! a! m: Q# }/ n' H
- #else1 |* }; D" y/ a0 ^, J
- #define DMA_PRINTK( x... )- j0 @% v( N" V& b, H8 T3 x
- #define DMA_FN_IN3 J' Y: Y |) ~4 V8 E$ X: s! y
- #define DMA_FN_OUT
- g) W O6 t3 U - #endif6 \4 d- z% m; R2 k& u1 J
3 `# F; S$ z b; g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! P7 C+ f. }( v - #define STATIC_SHIFT 35 W/ w3 {) [7 m( w! B; t
- #define TCINTEN_SHIFT 207 q8 \5 l2 e; L8 E. D
- #define ITCINTEN_SHIFT 21
. E; C; p/ U* @* s v* h - #define TCCHEN_SHIFT 22
7 P$ i2 B$ S! Z8 I9 Q' @! ]( H6 Q q1 E - #define ITCCHEN_SHIFT 23
7 ]. m/ k& s2 @ [ - 0 R2 |$ T8 R6 J) D
- static volatile int irqraised1 = 0;
- ^* f( j4 R( j - static volatile int irqraised2 = 0;, y F. v# ]! o& M4 K& X' a
- ~8 h) L M- f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t _2 H& d' _, o3 b$ `0 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* P4 s3 d; `9 T& \/ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E+ G6 P0 ?& X& ^0 X
! ~! O2 {- l3 s1 S9 }$ l: Q# I- dma_addr_t dmaphyssrc1 = 0;% } j5 ^+ B4 @6 N5 g- J
- dma_addr_t dmaphyssrc2 = 0;! X; S: O# T% E# S# b
- dma_addr_t dmaphysdest1 = 0;
/ @8 m/ x2 k: k! {0 T+ z6 h; y - dma_addr_t dmaphysdest2 = 0;- s4 H) y( B$ z7 l Z4 {( ]
- 4 N4 Y3 ^4 D7 r
- char *dmabufsrc1 = NULL;) e+ x1 ]% u0 c {; l; q
- char *dmabufsrc2 = NULL; h; \) G7 \" o6 k3 k( C
- char *dmabufdest1 = NULL;
& |, m$ P! c# s/ i8 s( w- U( x - char *dmabufdest2 = NULL;; h" w0 K& V* |7 v
- 8 X' x6 q5 [. ]3 y" `
- static int acnt = 512;
6 W7 E+ F' X+ T( o: S8 h - static int bcnt = 8;
. t$ j2 [2 W9 z& V% a+ M - static int ccnt = 8;
4 R: P2 q' p9 ^
" B3 d8 ^7 H6 J$ T' o( `0 [+ d5 x* g5 B- module_param(acnt, int, S_IRUGO);3 s* \# O% A* T
- module_param(bcnt, int, S_IRUGO);
7 ~. J& X5 P! H! W& x0 i, T" R/ ` - module_param(ccnt, int, S_IRUGO);
复制代码
% w, o0 B0 R7 `; A& q( F0 j' R, C6 y5 S5 D% [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: ]' c2 Y1 q% G" Z; Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `8 Y. e% ^3 e- I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ]9 Q* z; z: ]# P
8 \- }6 \7 Q) R/ L" A
0 d: i2 }$ j, t; W( }" t4 z
|
|