|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ^5 V0 ?" E: G: d- [code]EDMA sample test application; p! o; D: _6 Z8 F b5 t- i
- /*: \* i! D, i; y0 Y6 o
- * edma_test.c
: @6 E. [/ I0 } k - *
5 z8 D) s7 p& c- P$ Z - * brief EDMA3 Test Application
* a/ K: |; X4 t+ h/ |; x - *
5 y9 z2 P# z1 j, E& G$ y - * This file contains EDMA3 Test code.. z" e- T1 J! s7 u
- *' @$ j3 e5 ]) X$ h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, f! D/ S: O d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ j8 t2 _: I7 V/ e. D
- * TO CHANGE.
+ M4 f- x. M, ?6 ?# g2 p" R3 G - *
. Y9 [) c4 ?1 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! W8 S0 ? l2 x% M9 O. s - *
6 o9 f6 r! r/ d+ T# Y - * This program is free software; you can redistribute it and/or) q3 r: y" i- l
- * modify it under the terms of the GNU General Public License as- ]8 L6 |' l. o
- * published by the Free Software Foundation version 2.0 S; |4 _! p+ o3 e7 z
- *
6 c) F/ r" j0 O8 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 J9 M8 V+ T, _2 P, S! q; o - * kind, whether express or implied; without even the implied warranty2 O0 m z4 t! W' I# z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 _ Y2 R0 j$ Z* \; @: G2 h - * GNU General Public License for more details.
( y, C: p( [2 A" c) x$ M; u1 ?3 l( D6 C - */; g7 M+ S: }1 s. G2 a0 }- q
& x8 d. E* R; f$ b# A1 `. ^- #include <linux/module.h>
7 E( ^1 o: R- B: l) L* b* H' u - #include <linux/init.h>; P* ~; I" I8 o' N9 i& A
- #include <linux/errno.h>& K0 J T6 Z; J8 H$ e G
- #include <linux/types.h>6 l) }) V l% x6 Q
- #include <linux/interrupt.h>
! b! r! ?; L5 j' [- Y5 N - #include <asm/io.h># p6 c q0 j' @1 r; d! m
- #include <linux/moduleparam.h>3 Y( d7 _ h0 E5 }1 f
- #include <linux/sysctl.h>
: @# }" r2 F& [3 n - #include <linux/mm.h>1 W8 R" \9 M; p- m; T/ b
- #include <linux/dma-mapping.h>: @9 l2 H4 M9 r, @) t5 f2 o- D
6 @/ }) d' \/ B- #include <mach/memory.h>
8 h) ^6 m' C/ M0 U - #include <mach/hardware.h>, Z7 D7 Y8 e( [) @% c
- #include <mach/irqs.h>
- L, w S K1 z3 b t" t: O - #include <asm/hardware/edma.h>
/ m; k: w3 s2 F3 G* n. n# ? - ! @+ ]( D a4 n G9 L0 u: c
- #undef EDMA3_DEBUG5 _+ E& K, k4 g; g' Q7 f
- /*#define EDMA3_DEBUG*/0 S* Z% P% x' ~+ J6 ?; q+ F
- : Q5 ]7 B, ^' {- @2 B
- #ifdef EDMA3_DEBUG) e' J5 N) p4 t0 W3 k1 Z3 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( Z( f% r/ \1 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); G+ ^. @; \; P$ W# F7 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' K% d; _4 B6 U - #else
5 m% u6 j. h l- i! V - #define DMA_PRINTK( x... )# R' v' Y+ F. P8 K$ e
- #define DMA_FN_IN2 |7 }; ?1 G, T2 }# H$ |5 }* C9 x
- #define DMA_FN_OUT" C3 d Y7 y3 N- |6 X
- #endif7 n, @% Y" F! U" a, ~8 [) s/ p
4 p" n1 s. t- X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 J2 B. f, W3 E, K" h
- #define STATIC_SHIFT 3
: _$ W3 S5 _5 Y; |0 \9 X' v9 U) q - #define TCINTEN_SHIFT 20
2 Z2 q% l6 j3 Z9 l( c) n) H - #define ITCINTEN_SHIFT 21! A/ D* E. X: n& F, H! S. x8 v- T% _6 U
- #define TCCHEN_SHIFT 229 g1 V; O0 r& v( @2 B! X4 g
- #define ITCCHEN_SHIFT 23$ r! \& H8 D- Q8 D# C& c
: b( O2 [, j. @6 M2 p# X- static volatile int irqraised1 = 0;
* \; P/ i0 c+ M( @, n, ~ - static volatile int irqraised2 = 0;7 i6 s7 Z: E+ p0 a
' L4 i$ A% O' v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 W$ p+ O1 a! |, }. D1 D7 B) v c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `# s' h5 ]- J1 m' z1 G% e+ }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s( F" R1 A1 K7 D3 h d
- ' c2 d) O+ u8 O7 ]: e
- dma_addr_t dmaphyssrc1 = 0;# F; B0 [ Y7 c0 q! I' o* T
- dma_addr_t dmaphyssrc2 = 0;3 @3 K9 U/ d1 ~; K; ~
- dma_addr_t dmaphysdest1 = 0;
L+ S9 s9 t% e: ~* O - dma_addr_t dmaphysdest2 = 0;
/ E* z0 A! L: z3 ]
( w7 N& s- v N7 n5 H- char *dmabufsrc1 = NULL;
- v9 U- m! x! K5 N - char *dmabufsrc2 = NULL;, E/ i0 M0 |$ i6 q8 I
- char *dmabufdest1 = NULL;
$ X4 i$ s& P6 f0 ?- W- C9 G" ~2 ~ - char *dmabufdest2 = NULL;7 _2 \0 D7 E3 h0 z5 `! v+ B5 e
- ; r- m) Y/ u% h h- n2 d
- static int acnt = 512;# d5 `4 q# N- u" V7 P6 l% v5 i
- static int bcnt = 8;! L$ Q) V8 T; [- H' F9 y! T5 J- r
- static int ccnt = 8;
- P# ^: F$ m6 t {& D' i - 5 E7 @& j+ j* \5 Z" k7 P2 y
- module_param(acnt, int, S_IRUGO);
' |. j! U; d8 \4 t# A - module_param(bcnt, int, S_IRUGO);
8 [' p$ _( l. H - module_param(ccnt, int, S_IRUGO);
复制代码
+ d+ ?4 y/ U ~/ C9 v4 F# e& d2 E& W2 e) M) f; a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T7 ~6 I9 Z2 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! E4 Q$ x* n0 Q p! M) A& T6 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 \5 h2 Q0 H+ P4 F' ?
, b9 }5 m* K# C- b) n3 E4 @
: y' x8 G9 y1 B p/ | |
|