|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 l. y8 j D6 V+ T: g5 V- [code]EDMA sample test application2 e4 }* s7 u) E! o- ]; P6 [- Q9 E6 w k
- /*2 J n+ g+ J& }5 d! w
- * edma_test.c
{4 x/ T# d$ t - *! j' G7 m& \* E8 t* ]
- * brief EDMA3 Test Application0 r4 t2 s: H1 P2 \1 F: X, p
- *
5 F: b0 v! O8 ]8 d" `! m& z - * This file contains EDMA3 Test code.+ N1 {2 o$ L& B; t" [
- *$ ]: B, j/ B5 l, N9 e. q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( t1 Z. C, a: k" g3 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ |' o3 P, V7 A, E" V0 m - * TO CHANGE.0 f6 P; l; l1 e1 e9 m
- *: g5 M% h$ S: Y! E1 B# ]! r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' o. V- O$ f" i8 ]# }
- *
! c1 v; k5 \8 @; g - * This program is free software; you can redistribute it and/or
$ M; T+ H: R+ k p - * modify it under the terms of the GNU General Public License as
) V2 Y$ {# i* G6 K" Q, b# u - * published by the Free Software Foundation version 2.
_: }9 W+ u/ |9 ^' X3 Q: I- _ - *
+ p7 L7 Y9 ?1 v R( C( r7 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! H) \; G) }" u, x: W4 e
- * kind, whether express or implied; without even the implied warranty
2 \8 `- x8 n! V* a2 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 L0 r" Z1 {4 P1 ?) A6 t - * GNU General Public License for more details.
5 l1 l- }2 G/ S8 p3 m( C - */
" \5 f+ P6 J3 E6 J! p
5 z, h7 j. l S( g6 W5 o6 o- #include <linux/module.h>! B$ D j8 v2 l/ h% b9 Z
- #include <linux/init.h>; {: ^# \; z! L
- #include <linux/errno.h>
# }# a f9 t$ Y+ c% ` {$ N - #include <linux/types.h>
6 {3 p! F( ?$ d4 B& {5 v - #include <linux/interrupt.h>* {' Y# {: C3 V. f( r
- #include <asm/io.h>
p: O" \& O& r) \ - #include <linux/moduleparam.h>
9 p) ]9 G8 p5 ^ - #include <linux/sysctl.h>
" d% k8 O) o ]) E' T - #include <linux/mm.h>: }, `3 q* T5 B# s* B3 I3 }7 s% J
- #include <linux/dma-mapping.h># h" \; W; e. P" x4 ~
7 c `' e1 J4 C3 d/ q- #include <mach/memory.h>6 j6 q# `: {- i
- #include <mach/hardware.h>
1 r( e$ P% u% j7 J4 E$ l - #include <mach/irqs.h>
+ \1 B8 A( [2 k9 d - #include <asm/hardware/edma.h>
4 H- L5 D0 N: P+ C% G+ A1 N* [$ ~
( X% k1 k+ B4 Z/ m( U- #undef EDMA3_DEBUG8 C& t) @7 ~9 C1 {' G& P5 j
- /*#define EDMA3_DEBUG*/
) B7 n; a1 J3 m, L
' @9 o* {7 e" M% v, K) b- #ifdef EDMA3_DEBUG
8 M- X3 M2 d" k8 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( J: N* j: P \: o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# f5 B) _5 [! f& A- W' q5 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K$ C6 D& p/ G. Z' P
- #else3 s* g, _9 O5 u; ^: n* l+ K
- #define DMA_PRINTK( x... ): h; D& z2 l. _0 ]: P/ `0 G% a
- #define DMA_FN_IN# g# H% R5 y( l, u" K. \* `/ Y( h
- #define DMA_FN_OUT
- B* z$ c2 W) N0 J' J - #endif
3 l7 ]+ Z* S6 A2 y" i
$ Y( s }5 t+ U! u+ U2 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ P( X9 J7 t" l( D
- #define STATIC_SHIFT 36 ]; b. W& `. {/ F# S
- #define TCINTEN_SHIFT 200 q! b* ?$ @* t
- #define ITCINTEN_SHIFT 21+ }8 Z. v6 @3 [
- #define TCCHEN_SHIFT 22: K6 I; ?) O! K9 g' l2 U Z
- #define ITCCHEN_SHIFT 23
: V& w' H2 z6 K$ M! Y - + ? K" _# q0 c* @, t
- static volatile int irqraised1 = 0; Y+ {- ?) J2 a) L- a
- static volatile int irqraised2 = 0;, T \% a: D* V- n4 A7 H O2 r
- , A9 i g9 {0 U+ S# ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; w. C# p; A" K: d* h4 E- f% g ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- a1 g* ~% m7 B) K* P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ?4 X' y, C8 y$ Z0 j - 7 o: I! l( x' A( q
- dma_addr_t dmaphyssrc1 = 0;
) |1 L; b( v0 F4 [ - dma_addr_t dmaphyssrc2 = 0;# c* D; J$ M8 F
- dma_addr_t dmaphysdest1 = 0;' \' X. |& a; u* H. V% H
- dma_addr_t dmaphysdest2 = 0;
# E! t: x0 ~ v9 s
. o, E, o7 ~# [1 u* Z2 ]( F A8 r- char *dmabufsrc1 = NULL;
% o; i4 U" o& h; z; Y* } - char *dmabufsrc2 = NULL;% P( B1 ?3 A4 \5 ^( ~) U7 c
- char *dmabufdest1 = NULL;
, O$ v! _9 B! \' y - char *dmabufdest2 = NULL;
$ _4 `- ~" @! S$ f3 J! h
& O, M- A6 p. y- static int acnt = 512;( k' L8 b8 Q' h) g/ m9 J z
- static int bcnt = 8;; ^5 I* a! @( B, ^! D0 u
- static int ccnt = 8;: W- w' m2 S" s, ?" W; v
- X2 h# j$ T; n% o: F
- module_param(acnt, int, S_IRUGO);+ C! R# R% k, ?* t& @
- module_param(bcnt, int, S_IRUGO);5 K% X F7 [+ |. T0 \/ V. Z5 _
- module_param(ccnt, int, S_IRUGO);
复制代码
8 u2 n6 E9 r/ T# a
; H/ |' R+ z1 H0 y% ^9 V1 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. h2 ?& \7 m+ J/ ]) larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# w% _: Q( W0 B8 | o: M1 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 |6 S% j" I9 R9 R* g# r S+ w0 k; ^
4 t; c. i) o) E! a$ j j; ?; D% V
|
|