|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X) z& Y" I* M+ [
- [code]EDMA sample test application2 H: ^# t' e& ?* ^
- /*
+ F# b- [% [/ b6 ~6 x5 j9 U6 g - * edma_test.c L3 Y/ s* K- M, F# T: S% V1 |3 O
- *' s: B. M! s5 d+ [4 F e
- * brief EDMA3 Test Application
" [$ g# ?1 O8 |6 _- e; D - *
" D) I! Q% z) [ - * This file contains EDMA3 Test code.7 O. U- | C9 O& e6 n
- *
- K# g, h# |3 O; d# E9 l) y& H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 {) i% t, a0 d3 R; u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 E# W4 k* t. \8 r - * TO CHANGE.
( D. Z' X5 H9 c, m* Q% D+ u - *. ^( g! L% G8 I; @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' i" S, ?3 e) Y4 ^) y7 z - *1 X1 M" W! b S8 u0 y5 B
- * This program is free software; you can redistribute it and/or
+ T( t, ~2 |. D& d - * modify it under the terms of the GNU General Public License as
" N9 g; E1 x. [# X - * published by the Free Software Foundation version 2.
5 M. P$ @4 u5 ^8 e7 } - *
0 f8 D1 l" l) c, A! e) w& L2 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ]6 [) [ a$ \
- * kind, whether express or implied; without even the implied warranty
, [- |) ?! y& d E1 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* x' B$ X% i+ `+ x
- * GNU General Public License for more details.
+ N" Y: x% U( e' @( [3 |; @: G0 S - */, u7 F4 B3 ~0 x3 [5 J( \3 N
- K, @3 M) Z& c. \3 s7 p+ X
- #include <linux/module.h>: ?+ a* i, y- ?( z$ W3 D8 k
- #include <linux/init.h>
$ g$ C! G* ?. c1 M - #include <linux/errno.h>
( {5 r. x2 }3 N7 s6 R' E' J) q - #include <linux/types.h>3 g" u1 y6 ^7 i+ ]- Z8 v6 N
- #include <linux/interrupt.h>
5 Y0 P! ~1 X/ `- { O - #include <asm/io.h>5 c4 l* X) E; ~
- #include <linux/moduleparam.h>3 w5 |% x5 a7 H" C. E* H
- #include <linux/sysctl.h>2 q1 i* K# H! a4 @- ^
- #include <linux/mm.h>
" q8 y8 g6 _- A. N2 W& F/ m - #include <linux/dma-mapping.h>; d& b5 [; o1 r# b, J
& p2 `0 C6 Z( `1 |' n4 a- #include <mach/memory.h>
3 R% z/ Z: ~6 ?+ I, n - #include <mach/hardware.h>
7 V5 l; F( Y4 V - #include <mach/irqs.h>
0 E1 C4 W: r& C7 W' ` - #include <asm/hardware/edma.h>
. p' Q; a0 Y W - " V, R3 V1 l: r# \ c% U* Z$ t, h& r
- #undef EDMA3_DEBUG
5 x0 ^5 _! h7 ~8 l - /*#define EDMA3_DEBUG*/: ~+ H/ S# Q2 x# s) s$ F: M1 K8 k
: d' T9 p8 | j$ |- #ifdef EDMA3_DEBUG
% }1 X8 s& a0 H# w7 n% z% _! a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) w* k. u8 n, ?* [4 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* X8 x! E! i; B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 D/ x3 `; u2 n6 R" c) {" l
- #else; q' S9 e8 U2 O
- #define DMA_PRINTK( x... )
/ N& p; Y8 E; [: ~2 X - #define DMA_FN_IN
+ @/ r" q; Q! ^7 ? - #define DMA_FN_OUT
. }, E( g% q2 a! h3 D - #endif
" U7 `- n; q7 a$ [ v9 m$ |" m - 1 ^( I7 g0 S0 h: {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 D( h7 K* s! P+ \9 j" d - #define STATIC_SHIFT 3) f8 ?3 A% H# E6 F! U
- #define TCINTEN_SHIFT 20# Z7 w& d* W" t9 i% A. T( i0 t: W
- #define ITCINTEN_SHIFT 214 g2 ?. ?1 s6 d, {. V* l b/ f( ?8 D; w
- #define TCCHEN_SHIFT 22: k; V) W, [9 C, F" m% n
- #define ITCCHEN_SHIFT 23& \# h+ ^, w' F4 r
- 3 ]. v8 C5 q4 n# x% [/ t
- static volatile int irqraised1 = 0;
; G& n* H: ^1 t% R i2 X3 z - static volatile int irqraised2 = 0;8 c8 `1 D# q. G; V. Z. s
- * n) T( [; C# U' d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& l0 J, `% q* [1 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% F7 Z& a+ K7 n2 p- r# { w4 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f) a+ s n4 d2 x
- 4 w7 o h3 q- j; u7 i, A
- dma_addr_t dmaphyssrc1 = 0;
3 t4 g3 l3 ?2 c& ? - dma_addr_t dmaphyssrc2 = 0;+ Y& k: k0 s$ o* R$ t
- dma_addr_t dmaphysdest1 = 0;+ y. B, r, @& H! e, G/ b
- dma_addr_t dmaphysdest2 = 0;
. L0 y7 M3 U. c, b k) k) `0 q - 1 M7 X: Z+ W& t5 `: I
- char *dmabufsrc1 = NULL;
2 v$ u; u. A% }' T - char *dmabufsrc2 = NULL;
) n6 G$ \) ?0 ?1 h: b& n+ } - char *dmabufdest1 = NULL; J- X- m- D3 j) W# m; c
- char *dmabufdest2 = NULL;$ E2 ]# @" x9 [
- 8 L r8 s6 j! U& J5 z; z0 A: O5 v# ^
- static int acnt = 512;& w3 s! l) x& m/ U W
- static int bcnt = 8;
4 Z* s' ?7 t& S - static int ccnt = 8;
( `# f H9 L5 y' g - + t" [ J& N3 A1 Q2 T- u6 U
- module_param(acnt, int, S_IRUGO);
( ]6 f5 {1 {5 H# U - module_param(bcnt, int, S_IRUGO);
3 E1 ]% l8 K& X3 a' R - module_param(ccnt, int, S_IRUGO);
复制代码
N# W l: i/ _! O1 p: [: g* A0 F# G' _+ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ~6 Y8 _# _: L1 \" z' U5 r* X8 q; p. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) c8 T Q P7 e8 F) n4 t7 d7 c. f% U& G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ m) \7 g' B+ j' m; u7 P+ r! a
& h1 x5 ~4 a% U' N, S" a2 }5 v: k7 M
# b' h, I; T* h |
|