|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# j1 Z- {; w! W9 u2 G |7 L& b- [code]EDMA sample test application
- x$ S5 q: n3 x - /*
9 w/ v" W2 g% p8 u1 s6 @: h - * edma_test.c h. I) D* Y/ i/ u. `
- *3 F, ]) D' [; W& G2 S
- * brief EDMA3 Test Application! x# _% Q: i% I b$ C
- *# K) ]+ L& ~: v# ~' o+ b
- * This file contains EDMA3 Test code.1 U9 k! D* O' Z3 W3 ?, x
- *( Y' H$ Z2 ~! E; {; |# O6 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; C- k f* K% B, j5 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& [% n- `. Q9 b) P - * TO CHANGE.9 ~2 p; a1 [2 W/ a: V: _3 f; {
- *
& L1 ?7 b6 L* s# Z7 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! B5 W: o) |: U- U - *6 ~1 ~/ f, ~ ~) X
- * This program is free software; you can redistribute it and/or, N h7 ?) a E% a7 q5 M, V; Z2 f
- * modify it under the terms of the GNU General Public License as
) A4 E- Z1 F; J9 \. Q/ | - * published by the Free Software Foundation version 2.
. D: ^9 \* U( n0 A" R - *
) M' a' ?- f9 F, t! m z* s N1 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L6 e3 A4 Y3 H, C) {' g7 C
- * kind, whether express or implied; without even the implied warranty
0 Q1 M7 I% k1 i% g6 a6 }+ g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ B; @- M5 _9 m ^
- * GNU General Public License for more details.4 \% |# Y4 W% X/ g
- */6 C) M9 r9 z' Y' H! a3 K
- . A3 J [9 ]9 m% f
- #include <linux/module.h>
" T2 m0 [- y% {- g: k - #include <linux/init.h>" ?/ }/ P( p9 Z- v& L9 i
- #include <linux/errno.h>* R. v6 u& w3 g2 o! O
- #include <linux/types.h>6 }; o3 ]3 ]' V6 R7 k9 m3 o
- #include <linux/interrupt.h>
0 R- Q% s6 |% u4 J( z - #include <asm/io.h>- @- N) Y3 t+ G' e0 r
- #include <linux/moduleparam.h>
$ h3 D; @! B1 ~7 v" ^. n* W2 Y - #include <linux/sysctl.h>
/ O' |+ S2 L' R; B W7 T - #include <linux/mm.h>2 A; `8 i1 J `# V4 R9 Y
- #include <linux/dma-mapping.h>
, w6 k3 E; j3 S% h6 V( V - 6 e' v8 J- ^% ?9 g! S/ u/ A
- #include <mach/memory.h>
7 {# {. }6 z. p5 n, W - #include <mach/hardware.h>3 Z9 r4 y. u1 H9 W
- #include <mach/irqs.h>$ E1 j! B% V& E ^% H" s( J
- #include <asm/hardware/edma.h>
( Y# P& W9 q$ n - + @9 @7 P* t; d2 ^, P% g0 Y
- #undef EDMA3_DEBUG& m9 `( k2 o3 ~! ]* v+ i
- /*#define EDMA3_DEBUG*/6 B0 ]$ s, r, K, k
- # j% T `" N6 ~% T9 ]& J
- #ifdef EDMA3_DEBUG' s2 v; s9 t2 e) N: Y8 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Z2 N. k3 |) B4 @+ C1 G3 u; t7 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ ?4 i% O% A) H& h5 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) |# |- T8 ~8 Z+ g r6 B1 f' M
- #else5 u9 h z. e. U( r
- #define DMA_PRINTK( x... )
& V3 K' t# M& W" B4 D. |- z - #define DMA_FN_IN
- ]/ N- z4 y, h! U - #define DMA_FN_OUT, j( W* ^, N7 B `5 _4 a
- #endif/ [ K+ G/ f: E4 D' B" J
( I: @' j& b" U: ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" ~: C1 S+ q2 A' W/ s# t+ o. z
- #define STATIC_SHIFT 3
8 y5 ^3 v. ~' r- v7 `0 Y* K - #define TCINTEN_SHIFT 20
& X" K0 A# ?. ^) o - #define ITCINTEN_SHIFT 211 e4 R" |8 u! M. ^
- #define TCCHEN_SHIFT 22& f$ z7 f* I" i1 }' b, A ^' S
- #define ITCCHEN_SHIFT 23+ v; p5 }4 Q: J3 }7 u) \
, U) a: \8 ^7 ]- static volatile int irqraised1 = 0;. l% w- Z5 z+ [/ ~7 Z0 v
- static volatile int irqraised2 = 0;+ t# N2 f- y# M2 p1 K3 M" m7 T
- # C+ C) H! ?& m+ R$ R8 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r0 C# ~ {6 x9 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, w! B2 S. X/ D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) s+ K& N' Q7 [ - 4 Y- H: a! G$ g8 e& F: J& O
- dma_addr_t dmaphyssrc1 = 0;
* M% w% g( U% T+ p- @( Q5 D - dma_addr_t dmaphyssrc2 = 0;* c7 k6 K8 e9 z: c4 x$ H" {7 Y
- dma_addr_t dmaphysdest1 = 0;
8 Y* H. h0 N. l! x; q- t1 _ - dma_addr_t dmaphysdest2 = 0;
* m* H6 Y4 X8 Q+ y - , V I1 s2 m& J s! r
- char *dmabufsrc1 = NULL;
7 C$ k) }3 S& Q& T' c7 A - char *dmabufsrc2 = NULL;
. m2 J5 h$ V# y- ~ Z' E6 N4 ] - char *dmabufdest1 = NULL;
7 G3 w6 J5 u9 |; O. H* c/ w( d - char *dmabufdest2 = NULL;/ l; A6 x0 l5 h% K) S& d: l' D
/ |" O5 P7 V: Z5 K5 T4 v- static int acnt = 512;2 K! P5 U4 F$ W0 f6 O' p7 \
- static int bcnt = 8;. O: E* h7 Y8 R8 z
- static int ccnt = 8;! M# ]4 Y9 j; b. z8 W! H
) Y, v1 F, F$ S0 C- module_param(acnt, int, S_IRUGO);" v4 J) u6 @( i
- module_param(bcnt, int, S_IRUGO);7 h" P1 v3 n0 E4 S
- module_param(ccnt, int, S_IRUGO);
复制代码
) t, R1 c- F0 U5 ^6 U7 _4 ^- h1 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% v4 h* I9 M. o5 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% o) S7 y1 z7 C* ]" ]' l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 x4 J G3 [8 \" K* R- i0 v9 S/ [- w/ d% }, z. C& k: e! }
8 S) {9 l( N# k8 Y
|
|