|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' g& g- v% k& |1 J) J* n O- [code]EDMA sample test application$ t* d$ V4 x; ]
- /*: M7 {, P1 v3 \" O
- * edma_test.c8 V- t0 a* C r' P) P; H
- *
* J u1 V* Q5 Z1 h3 _ - * brief EDMA3 Test Application, { q+ U; ~. m9 W
- */ C0 V, B {$ e; J9 l3 n$ l
- * This file contains EDMA3 Test code.
, m' J' U# x9 p5 F2 k - *2 J. A' `" F5 ?( A$ M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; r3 ^! H$ T+ F0 M1 m) x: q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! C' G/ ]$ j4 b4 c* j% c. s
- * TO CHANGE.4 X- ^. S. j Q9 F" M
- *
) U5 O0 @, u% B6 x8 k( E8 D& } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( s* w. p. c+ ~# W3 O# c
- *7 l4 k9 D) L" ]. R$ k
- * This program is free software; you can redistribute it and/or
6 t: |8 _' W9 h - * modify it under the terms of the GNU General Public License as* A U ^- Y u4 ~/ ]& z. s6 G# S
- * published by the Free Software Foundation version 2.& x4 f% }& T k. S( s L
- *
4 r7 @" y3 \. G: i4 q3 ~8 y, m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( \! g* ^2 b5 F! i- t8 ^9 k# c - * kind, whether express or implied; without even the implied warranty. M/ l; C/ X* \8 B' [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* r$ O( c7 A: u. c - * GNU General Public License for more details.
/ B6 }3 ^6 \) W2 ~. | i - */ r7 v. ~5 S" w" p" R7 W7 N
3 m& P+ Y! ~9 W" ~) ?- #include <linux/module.h>+ D' j3 B. k3 u4 p/ r l6 m( f
- #include <linux/init.h>+ b* o8 s; L3 P8 P
- #include <linux/errno.h>1 I0 t9 ?6 `9 i. C* x
- #include <linux/types.h>! p5 ~. S/ k" b" t* r b. |" I1 G% P
- #include <linux/interrupt.h>/ \0 M4 l, t$ M9 N: }4 J
- #include <asm/io.h>
" K2 X' }( d# B" A( ]5 b4 m0 y3 | - #include <linux/moduleparam.h>
+ v9 Q3 B0 Z0 l - #include <linux/sysctl.h>* s. U) ]- k0 z2 C
- #include <linux/mm.h>
B. o- o' Y, _ - #include <linux/dma-mapping.h>1 C9 }1 y, m* J u0 c( }
% g- b0 k2 F- r- #include <mach/memory.h>
4 f! r& x* O0 f5 _8 ^* W8 l - #include <mach/hardware.h>
. s$ R8 ^6 i, f& _ [6 K' t( ]) m- C. B" u - #include <mach/irqs.h>- G! g8 `; R& |2 \ R* ^
- #include <asm/hardware/edma.h>
. j/ h, g* \7 O# R4 {2 P( T) w F
; p1 V& {+ t9 T- #undef EDMA3_DEBUG5 K9 c- G" F- K# Y3 A* Z
- /*#define EDMA3_DEBUG*/
" t5 ^! j8 A5 F4 @ U6 A6 `1 A
2 y3 ~2 @8 G# X" Y( `. K- #ifdef EDMA3_DEBUG
2 ?. Q) u) m' L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( D0 I0 A2 x$ \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 A; g [# T& T1 w- l$ c0 g# W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 q9 r( o: E# Y( ^, h) { - #else
* H2 X1 f. g) F1 }* `1 m - #define DMA_PRINTK( x... )3 m4 p0 X$ G+ A
- #define DMA_FN_IN' _8 i* B$ b* O! e7 S3 b2 G# D5 ^1 o; U
- #define DMA_FN_OUT
0 v- Q3 q/ e- U, p$ `. E - #endif
0 D. u, z- u0 {! R$ I. ^( h3 s" }
2 k: Z6 ]' E5 p, h$ L2 ]) |- t# d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ?* E- A/ J9 P% I
- #define STATIC_SHIFT 3
& s4 X6 V M. u5 i8 K _4 D - #define TCINTEN_SHIFT 200 f) ]1 w4 ?- V, k, Z+ X
- #define ITCINTEN_SHIFT 21
* L; d) R, L; W( s$ L - #define TCCHEN_SHIFT 22* O L1 @: A9 y) d- f" g4 d) L
- #define ITCCHEN_SHIFT 23# s! s0 r+ R! z/ |0 y4 r% H2 ]
+ @ q) D. X+ _& k. N) y- J- static volatile int irqraised1 = 0;, m1 g2 f9 P* G2 A) ]
- static volatile int irqraised2 = 0;* [5 ^0 X4 ?) A* O8 {$ ~, M
- 3 {7 K2 k$ T" y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n* V7 l6 A8 {7 i+ I# m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X' \ G) o9 O7 e1 Y4 Z: [3 f6 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 e8 j- d9 q: R s4 F. H) u T; i
0 j: V+ l+ u$ `9 `" Z8 P; e+ s- v- dma_addr_t dmaphyssrc1 = 0;
' ~$ z4 S$ P1 m3 Q2 o8 ], } - dma_addr_t dmaphyssrc2 = 0;% p' S4 O+ j) y* r
- dma_addr_t dmaphysdest1 = 0;) j1 d' f: s% G, X- _$ g# s1 r
- dma_addr_t dmaphysdest2 = 0;+ ]" F! O/ S# w% o
8 Z7 U Z- A3 g$ }$ M- char *dmabufsrc1 = NULL;
" o+ Q; ?9 Q& C( [" ^, e; G - char *dmabufsrc2 = NULL;' x5 B+ d8 ?. b
- char *dmabufdest1 = NULL;
+ M8 a# P- d4 D- ~6 [9 i" D8 W+ R - char *dmabufdest2 = NULL;
7 c- Q: E \7 s, p% M7 ]
! L; D: d! {7 K7 H- static int acnt = 512;' L/ [& p, S& B4 I
- static int bcnt = 8;6 q7 g+ `6 \, d# F
- static int ccnt = 8;3 |) {2 s! i: F$ k+ B6 q
- 7 o5 d; t5 C$ _6 x
- module_param(acnt, int, S_IRUGO);7 B9 H1 s' x. `' D
- module_param(bcnt, int, S_IRUGO);7 L" s# H+ W. v% }
- module_param(ccnt, int, S_IRUGO);
复制代码
0 W. `$ f, v/ @+ \+ G) h
& X ?( e9 R5 n/ A. i, K( h/ k& N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b5 x& [- b _0 y7 h uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ y* y) s- x3 d t; H! f- g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
a, n* o, v4 V' D' D7 Y9 `/ @2 z
- s( b4 a& L! t8 E T- A# O; \+ P6 P8 `% v$ n( A
|
|