|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z6 Q8 \8 ^6 F5 W9 Y$ J
- [code]EDMA sample test application' C7 _+ B i3 [
- /*2 M9 @$ w% \9 \- q' O- m1 `7 k" D
- * edma_test.c
7 X+ k: [, J- c# o. N: z" ~8 _ - *6 D! s) I" L! m2 y& y' S2 A
- * brief EDMA3 Test Application& ~! b. G3 [: b8 n* s
- *! C) ], E' |7 y7 Q1 N0 S, G
- * This file contains EDMA3 Test code.$ k$ S5 w4 R9 s* X N4 _& M
- *
! J; R g# e& e2 |$ j- V, D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& g- q8 E' O6 k1 ?, ^: \; l" R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; T5 X& l2 [+ H! B% s
- * TO CHANGE.
. g/ y- j- P& o1 p - *
0 r9 M$ h* f: z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" A3 _7 r/ v* S: P* z - *
# E& \/ {' d u# \' U - * This program is free software; you can redistribute it and/or; p7 n: j( a3 t, D
- * modify it under the terms of the GNU General Public License as1 ?* T$ Q( F e" N+ n+ P5 {9 F
- * published by the Free Software Foundation version 2.
% l4 B9 R9 m$ C" Y2 n3 Q' Y: z) t/ R - *
( _, |6 R4 P) H3 ]* u/ p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ f5 c" D/ K& P* k - * kind, whether express or implied; without even the implied warranty
. o! W0 ^9 _' X- k% k) L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ E) P% N5 v2 j% M( G
- * GNU General Public License for more details.
- W. o: r* L" D6 b0 [ - */# P" Q: T. A5 _: C% x
6 S J3 R1 p% q3 ^9 ~; G) |- #include <linux/module.h>
$ H1 F# B' ^0 ^+ t4 c9 ?+ h4 P t - #include <linux/init.h>7 G1 y, b' x. b
- #include <linux/errno.h>2 C! H. z: u7 C
- #include <linux/types.h>
; `7 x- }( {, P, q$ h - #include <linux/interrupt.h>
7 g, A5 z2 p% E, J5 y - #include <asm/io.h>2 X$ g- u+ m4 w' I
- #include <linux/moduleparam.h>
) j) }! g3 \& l" |3 e - #include <linux/sysctl.h>
: \% B0 E9 k; ? - #include <linux/mm.h>5 K: K6 {- |5 W" d
- #include <linux/dma-mapping.h>
" ^# v! W: j- j4 P* n9 w- { - / m e$ O' y8 S, I
- #include <mach/memory.h>7 M0 |, m0 A. Y
- #include <mach/hardware.h>
1 f5 r/ q0 ]3 n2 { - #include <mach/irqs.h>
3 E* ^! H8 n2 W - #include <asm/hardware/edma.h>
* t# d* q5 D- ~
& Y2 `# p, U1 n9 \- #undef EDMA3_DEBUG- F0 J6 o+ P \/ m! W' n7 v2 a
- /*#define EDMA3_DEBUG*/
5 k4 J, s. [* j b: h# C - 9 T6 K/ k g% P
- #ifdef EDMA3_DEBUG
6 f( T1 o, s8 s0 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 X) b3 N- ?/ Q) Z7 Y3 i$ X; y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ a3 w) d; Z8 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& y& |: H( U8 B% |: ? - #else4 w* x" f6 @7 G9 _" P, R
- #define DMA_PRINTK( x... )6 S# `" ?1 N: N1 f6 z: ^
- #define DMA_FN_IN
6 A; e( F' j9 {3 L8 O' U. Q - #define DMA_FN_OUT9 t6 l# @. `. ^) ]
- #endif: o: | j+ W1 ?# W1 a3 b
( [; l5 j- r/ ~5 k6 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" k1 R* Q6 y2 J
- #define STATIC_SHIFT 3
: Z( i8 @" v9 V! {! J - #define TCINTEN_SHIFT 20
1 J+ C' L7 H' ^' l$ x; a - #define ITCINTEN_SHIFT 21
1 d" R0 S( i8 Z! ~8 J - #define TCCHEN_SHIFT 22+ z, z6 y6 s1 l6 C8 S* A
- #define ITCCHEN_SHIFT 23
' L4 P+ s5 P7 a8 H
N: Y; k1 E9 Q9 X q- static volatile int irqraised1 = 0;. y! \' a" E+ A+ x+ k8 j4 \
- static volatile int irqraised2 = 0;# s% ~" _" P% x8 O! z( ^& T! x) s
- 5 y; L$ J* A7 e5 o8 c) D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Z& J2 ~) T1 o' q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n& t9 ~. f8 Q: U1 h0 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 k% d% n O' K' k( U6 d$ y( x2 A - . Z1 g7 d3 L* `* {& E9 Q' W4 R9 `- \
- dma_addr_t dmaphyssrc1 = 0;
1 J% s0 Z0 f+ X; N0 W2 v/ v Y2 U - dma_addr_t dmaphyssrc2 = 0;* J% Q7 Y* s6 X) w( t
- dma_addr_t dmaphysdest1 = 0;; t; W% }* `% K1 g9 D* n8 Y
- dma_addr_t dmaphysdest2 = 0;
% c8 B* S6 R/ v; W" e4 b - / s* m' R: H4 b2 q# L4 j& G
- char *dmabufsrc1 = NULL;
, g2 L7 m! |" t1 i1 j - char *dmabufsrc2 = NULL;3 p0 |1 v' G/ f R- ^7 u5 L
- char *dmabufdest1 = NULL;
6 e4 j% r5 @# K - char *dmabufdest2 = NULL;
6 W9 D3 G0 J' } - ! d$ Z" D3 U }
- static int acnt = 512;5 h+ |. i% n1 H. ]5 C
- static int bcnt = 8;
# r& E( J" e! s& U - static int ccnt = 8;/ J z! u1 ~ n
- * o3 a! [3 _3 ]) `* z" A7 R
- module_param(acnt, int, S_IRUGO);
9 V7 h# j% n6 y9 |, Z - module_param(bcnt, int, S_IRUGO);
. L' {- r {/ g) ^+ F; ^ - module_param(ccnt, int, S_IRUGO);
复制代码 1 h" b# i# ~2 G0 g( O% M
8 z# M+ i0 D+ H* Q8 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! z6 D9 n+ ^% p- T, u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
L; p2 Z) C% a1 }, z0 l1 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X9 B! }8 ^1 C# V7 K2 h! E" Q Z0 ?% \/ s9 N [0 Y* y
5 ^1 ?2 U* j$ d$ G, P0 }; B8 B
|
|