|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / i- x" r8 ?% w; \/ L! }
- [code]EDMA sample test application1 ~: p; F* o* f5 T+ Z! M
- /*
. o: y4 @! d0 J0 s4 Q - * edma_test.c2 \ `- H* ]( i3 g
- *0 `0 d( H" C( n+ @0 E8 {3 C0 M2 Z
- * brief EDMA3 Test Application, Z) b5 t1 `6 u* n1 J* R- E
- *
% x0 u/ t* a+ N& G% C5 U" `0 O - * This file contains EDMA3 Test code.
% |3 ?% j% e, R8 \" p4 _ R1 O - *4 G1 Z1 K* r! E- l$ M5 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ [" N. ~7 f9 |' ^% A5 l" `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& ^* x1 F4 d( Y5 m) ^ - * TO CHANGE.) u8 y! ?% T1 F# N' u- t$ K5 W! H
- *3 y0 _# R4 I: P1 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 T$ @6 N4 o4 n: x0 i, G
- *5 O" o) d- L+ R5 i
- * This program is free software; you can redistribute it and/or& M' R$ M/ Z7 A8 o6 ?: ]
- * modify it under the terms of the GNU General Public License as( [' G' S' S% \, F! p% M1 L
- * published by the Free Software Foundation version 2./ p% V' f* A* c# Y+ D x
- *
7 c! i9 T3 D( |' q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 q0 X" Q7 O+ u# I4 i - * kind, whether express or implied; without even the implied warranty) D; t( F3 z7 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ h; T1 W2 r5 c8 g! A4 p, z - * GNU General Public License for more details.4 \: g. M, {- }1 O; Q
- */
/ o* m' y3 L* _1 P5 @1 ^
/ O, ~& G ?* S* F; U- #include <linux/module.h>
( n4 g# \5 {% d6 t+ I - #include <linux/init.h>
( M1 Q. z( Y _4 v - #include <linux/errno.h>2 I' @* f2 L4 ^% \! W k5 u
- #include <linux/types.h>
8 p0 x+ l7 Z8 d9 X9 O* A - #include <linux/interrupt.h>5 a3 h/ x3 `5 N
- #include <asm/io.h>
( z$ y* l; u$ h% ^ - #include <linux/moduleparam.h>) H) y! X w) E. Y. F
- #include <linux/sysctl.h>. p2 b4 K* r- f/ ?- V- M' q
- #include <linux/mm.h>
4 K: x6 X; ~9 U6 P - #include <linux/dma-mapping.h>% |7 `; K3 I/ L# v7 Q! K( S; A( |
- $ _3 C* b+ W+ r4 p) h0 O
- #include <mach/memory.h>
: j; N2 M: m i: ^' {5 ?+ F0 ~" { - #include <mach/hardware.h>
L9 f: J, S/ N: O; e/ W/ U - #include <mach/irqs.h>
3 [( S$ B4 e! n3 [; N9 \& [ - #include <asm/hardware/edma.h>! t( @* [- C0 z
& y$ M: Q) }& B# q: E- #undef EDMA3_DEBUG
' ?, H1 k+ v. G- g5 g; e - /*#define EDMA3_DEBUG*/5 v8 Q, f; c6 p4 b1 x) o2 z& }
) h* | X9 J; d# x% n! l# v- #ifdef EDMA3_DEBUG
+ T2 |8 h+ b" l. Z F: p4 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# l* Z& P: b( F1 @- o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
~. D, a! I- r% Y0 w3 T, ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ?& q c$ ?) V6 \8 f& I
- #else7 ~6 `! x6 D4 ]8 Q
- #define DMA_PRINTK( x... )
; H! j2 c$ J# x/ p - #define DMA_FN_IN ]: }$ X- d6 @9 x
- #define DMA_FN_OUT# H; g' x! |* ]3 I
- #endif
& n2 j6 H# r* J) f1 L- G
9 T1 ?0 r" U3 J1 S) h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% g- V& }7 o2 K! e5 `) `& z# a - #define STATIC_SHIFT 3# D/ T1 |) j0 A' |9 o5 `4 L9 H5 `
- #define TCINTEN_SHIFT 20
w) \' b3 m5 H1 X( \& t0 J$ [8 A - #define ITCINTEN_SHIFT 21
0 Z. H; @! C& J! Q/ Z. T6 t# E$ L - #define TCCHEN_SHIFT 22# O. H4 J1 \4 E1 x N/ \
- #define ITCCHEN_SHIFT 23; f7 E& Q" w9 h1 }
- / n$ F* X$ ]# s! V
- static volatile int irqraised1 = 0;4 Y: v4 H0 Z4 w5 X! K
- static volatile int irqraised2 = 0;( d! U! K- N8 p4 L s; ^
- : V, _ K" Y! m# Y3 I) ]& Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 z% _' I! o, U& m) G1 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, x6 M% p! t3 h& p3 R6 z- X, a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~+ L3 F/ W/ F! J0 w5 ~% @; z
- % X$ o% ? F8 Y# ~: ~; ^- J
- dma_addr_t dmaphyssrc1 = 0;
2 }8 Y, Z! s3 h) [* F; w+ `+ O F4 ` - dma_addr_t dmaphyssrc2 = 0;( d, k) c! C0 z$ f
- dma_addr_t dmaphysdest1 = 0;
0 {' u$ o' X* J$ U - dma_addr_t dmaphysdest2 = 0;! M! t5 C2 c9 @ t6 `: I$ S2 h
- 2 O4 w0 l/ e+ | {; ~1 I# I' c- K
- char *dmabufsrc1 = NULL;6 C- i& Y( [% @2 }1 } y
- char *dmabufsrc2 = NULL;
! l: v8 O r9 i, H+ o6 e - char *dmabufdest1 = NULL;
/ P+ n( p# f& E3 m# q3 p8 m, K - char *dmabufdest2 = NULL;) _& `, ?; U% {$ i; z
- ! X0 M& x. F" o( v% w! L
- static int acnt = 512;. p5 Y* z6 }! G P6 ]: a7 P% _
- static int bcnt = 8;. L# e- Z9 m. t: j" l7 B3 l
- static int ccnt = 8;
, Z. h% V: S4 }4 E
2 F9 |* U+ j% l' C7 [. L( r- module_param(acnt, int, S_IRUGO); r- W+ _1 I$ ~: N8 B q
- module_param(bcnt, int, S_IRUGO);
d+ H: {5 k( j( p6 d- o& y - module_param(ccnt, int, S_IRUGO);
复制代码
' G2 b' a! T# Q1 i. S; C1 P3 u7 i9 }# L+ i% i/ v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 }* A5 E! E$ P7 H5 O& p& L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- u. t4 ~ \1 i( e; G: P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! m- n3 s/ z/ w) U5 {* t
: [% e' `) J3 u! S
; j6 \# U. j+ f2 B; {2 Q: g |
|