|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
{3 x) V; W4 ]6 M- c8 y" C% B& M- [code]EDMA sample test application1 [: @2 L% k7 X7 A, N
- /*
5 P$ ^9 I) e( J9 \" J$ b; }2 ?# ~ - * edma_test.c
2 o' f, Y( h$ J2 A9 y - *8 b2 d; _' r" ^* U
- * brief EDMA3 Test Application0 F2 I! A3 D w7 |) D
- *+ P2 x) D9 e0 H8 e- v: n7 S
- * This file contains EDMA3 Test code.
0 f$ s. B( O4 S0 ?/ z: E# N - *" o. G1 o$ O) e1 y, f% D) A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. H2 g1 U( v# P& j; X y% D5 o0 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 h( P# D$ [$ s: f2 @! T" I( u3 g
- * TO CHANGE.' Z! m. L8 p" U* e2 L
- *
6 x2 f+ c1 T& }5 L! Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* O7 z$ j: r$ v& f. c3 o - *
- e9 J/ ^: v% `( A3 m6 i! x - * This program is free software; you can redistribute it and/or
0 U/ O2 X( D! X" l* n/ _7 M4 P# e - * modify it under the terms of the GNU General Public License as
J1 q+ ?; s& J" d - * published by the Free Software Foundation version 2.% ^. w6 f! C) L% h+ _9 y/ f
- * v% r5 C2 n3 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% W5 @# J6 i$ ~0 Y7 D9 ] - * kind, whether express or implied; without even the implied warranty% u8 B6 k( S$ x/ e2 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 L! ]+ E% ~: k: I( M6 K - * GNU General Public License for more details.
b+ ?& [% t5 G V' U# Q0 H8 | - */
. i+ A8 i: f+ O. r4 H; E7 }
1 s) v7 o$ q( f8 o* w- #include <linux/module.h>
0 t( U, o0 t5 l! q1 d! y+ u& Z - #include <linux/init.h>' D, @ ~; a n' y8 l
- #include <linux/errno.h>" l* Q+ y: I/ b
- #include <linux/types.h>, [- q- D. R7 `$ e6 @
- #include <linux/interrupt.h>" k1 u$ M4 b2 P! F2 K" U
- #include <asm/io.h>
9 T0 G+ R% f- { c* D - #include <linux/moduleparam.h>
6 b# F# T6 ~6 _/ R - #include <linux/sysctl.h>
|0 X; K. s, B/ \% @* a: d - #include <linux/mm.h>% F9 H3 C$ u, v) Q/ K
- #include <linux/dma-mapping.h>
* W4 X9 \0 l: W - 5 Z2 d. L$ V$ D7 q) K. @3 h
- #include <mach/memory.h>
7 q! X! z" y8 q6 u1 K; d - #include <mach/hardware.h>
* N ^6 g- E p/ p3 F9 G) `7 T - #include <mach/irqs.h>8 I. u! s% A) ]7 }& z
- #include <asm/hardware/edma.h>) w, M) E# X# Y* d1 w
, y$ j$ p/ N7 ^- \6 x6 K- #undef EDMA3_DEBUG. ]: Z1 l( a& A& [
- /*#define EDMA3_DEBUG*/# W% ^( J; G% o# Y: i0 Z
) y+ b; d5 z: T/ l9 w* W: [1 |6 k- #ifdef EDMA3_DEBUG
) k/ @$ {4 b5 I) U' `" P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Y2 ~& @7 W. ~ Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) v0 K% M: N! Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& _9 h. C4 { d9 c7 g |7 i) y
- #else
2 o/ ]$ t* e" f' C5 } - #define DMA_PRINTK( x... )
" c4 `% `5 }7 K6 U9 B; N - #define DMA_FN_IN
, _/ p" w0 I R( K$ F) Z - #define DMA_FN_OUT, _9 h8 q0 s! i7 J9 |( a" f; ^
- #endif# a: `. D6 j& y/ q
! E8 K2 w9 [( [) `/ M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" A0 F- J# b# c! @) f$ S2 O - #define STATIC_SHIFT 3 M r* l! E9 n, a
- #define TCINTEN_SHIFT 201 F# x8 ~4 g; Z0 K( U; Q
- #define ITCINTEN_SHIFT 21/ v6 E- p$ B' ~; P4 o
- #define TCCHEN_SHIFT 220 ^. C8 I9 G4 q1 r1 U7 n' W! o; }
- #define ITCCHEN_SHIFT 23
! x% t' h; B x/ s. n - 0 j. S8 i* |2 ~4 J! G4 K! S) Z
- static volatile int irqraised1 = 0;
. ~* A+ z+ a0 ~" b6 |+ h - static volatile int irqraised2 = 0;
|( V4 q: `9 Z8 H3 o# j" ^ - " t$ N" V$ g" K9 e& _+ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G: P7 P# {9 i5 i9 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L* e; I" t& A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" n2 v1 ?+ R L) Y
: Y: n4 c# }& k- dma_addr_t dmaphyssrc1 = 0;$ h' v/ c3 C7 Q9 W' n- k" |; y
- dma_addr_t dmaphyssrc2 = 0;' W" M( t- c6 [, ]& c/ d
- dma_addr_t dmaphysdest1 = 0;
& o# Y+ E5 `8 ?* p' q0 e" c - dma_addr_t dmaphysdest2 = 0;
! q, N2 {0 g1 \" V* z - ) d K& |: v2 \# r2 G. N
- char *dmabufsrc1 = NULL;1 z4 N: m( j3 c( t7 M3 V
- char *dmabufsrc2 = NULL;
d: c; o, ]5 k9 ]/ J* N3 ^/ G - char *dmabufdest1 = NULL;; K" O! z0 I) L0 \# C) J
- char *dmabufdest2 = NULL;! A/ T8 \4 e( d k; u
- - f1 {& I" o5 O& t4 x" ]4 b
- static int acnt = 512;- l2 D' f- m; V2 g! p* R6 H1 X. ^) a
- static int bcnt = 8;& E9 f2 W/ S/ |7 ~. w" s
- static int ccnt = 8;
0 o5 P S( Z8 i: s5 K/ d - % T, w; K3 E' @& k0 J5 G
- module_param(acnt, int, S_IRUGO);( Y; w. q: i- K1 B P6 w
- module_param(bcnt, int, S_IRUGO);6 X2 |) I8 w/ E# V0 M
- module_param(ccnt, int, S_IRUGO);
复制代码
! i- g3 I( n8 @4 @, s" f; s7 P. d4 S2 r# v& V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- M# ?% I! ~+ c: r- D$ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 i9 E' j7 {" b2 O7 K5 q8 K! E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ]) C5 p7 B g: `: i( S% K
, z$ ?. v' B; E- q7 m c! z* l0 c ~8 g6 H: a( g* u7 U
|
|