|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- K. C1 }2 v; r& @3 o, J: |- [code]EDMA sample test application# e" _9 G5 V y! D$ N
- /*4 h" S' T$ [5 ]5 m; P: S0 p) |' {0 m6 H
- * edma_test.c" F3 j: p8 h3 X
- *3 \/ k3 c+ I8 I
- * brief EDMA3 Test Application$ R) m$ r0 [7 D; I5 Q1 L
- *
5 a; O- Q$ ?& t* A2 U! [ - * This file contains EDMA3 Test code.
9 t# z2 J/ i' P$ W9 C3 @ - *
( |$ D1 F' q+ T; T& W7 u2 ^7 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ U3 `4 f1 w6 w h5 F6 {& w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 S+ V5 |% N0 f4 |+ o: Z x% f* L
- * TO CHANGE.
" g1 U7 b4 b0 b1 J3 {- g6 P I - *0 X ^/ z1 v7 M' ~% ^7 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ \' E5 a7 n) |* p/ t8 O
- *2 ^* c8 r& R4 Y7 g
- * This program is free software; you can redistribute it and/or
+ ?8 D$ g# P$ u5 v6 I J; q - * modify it under the terms of the GNU General Public License as _) R$ R' j9 o+ K2 E' \7 y ^
- * published by the Free Software Foundation version 2.
/ X7 b9 ?$ ]( q - *
- e+ u9 \4 Z" H+ V( } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ o9 H( o7 ]+ K H2 U# P3 G - * kind, whether express or implied; without even the implied warranty3 e: o2 z& V7 k# l/ M" G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 ~% W% c" I4 X3 S; W- ~, K* [
- * GNU General Public License for more details.
3 k+ ^6 ~; R7 C6 Z3 d - */ p5 d. z( _4 {, X O, M; s* y
/ L- }- i5 v+ g* I: {' T; ]- #include <linux/module.h># P! I& u' X" i
- #include <linux/init.h>
7 L) s0 j n- G - #include <linux/errno.h>
0 N$ ~, |. z$ F1 I- \ - #include <linux/types.h>
4 d8 u' p! @$ l. J - #include <linux/interrupt.h>: G3 J0 v+ A3 i' I
- #include <asm/io.h>7 ]5 k# N5 B* E# W1 I/ w
- #include <linux/moduleparam.h>5 V) A* q/ ^' _) G
- #include <linux/sysctl.h>4 p4 d, L( F7 v) i! m
- #include <linux/mm.h>
% {4 j3 e3 V4 k, A/ C3 s' s6 C - #include <linux/dma-mapping.h>
4 x- Q a* X3 r* T$ z# ^! D - 2 B9 Q+ X/ _0 r8 A
- #include <mach/memory.h>+ O! p) J2 n# M( j0 @0 [$ U
- #include <mach/hardware.h>
: Q* w( F7 B- |& }/ W; r - #include <mach/irqs.h>
) `+ D- Y' O% o' F+ x' ? - #include <asm/hardware/edma.h>
0 ^' A3 k+ s5 X- |9 G - " k& L0 s1 I! |: p; E6 L( b
- #undef EDMA3_DEBUG
$ E7 i& k# \$ A7 d8 Z - /*#define EDMA3_DEBUG*/) n3 u, M: U5 {7 e
- ! M- C" p7 t& z/ X ~, L' K
- #ifdef EDMA3_DEBUG
: e* h. V1 T- N5 {4 C* W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 S1 z+ \: ~. x% E( ]/ k4 A& y+ X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ f+ ^) K9 C$ V- `1 Q9 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ]+ [+ ^* \: T- @( A
- #else
6 r a* U0 z3 Y/ x. M+ A - #define DMA_PRINTK( x... )
: ^( d( q2 @9 k, G# [ - #define DMA_FN_IN
$ u9 h, Y$ }1 L; h - #define DMA_FN_OUT3 T- t* O# i% w) G" o+ V1 Y
- #endif7 L7 U5 w+ L0 {
' y+ c% M& p7 k% a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 W. g+ [$ ]: a, {% E" l
- #define STATIC_SHIFT 3
5 H5 ]" z: X0 Z% } - #define TCINTEN_SHIFT 20
4 D- y% ^! ~+ h5 p1 N - #define ITCINTEN_SHIFT 21
- _# G- Q6 U+ r" T. y1 s - #define TCCHEN_SHIFT 22
- `# @! v' ~* j" I2 W; q4 C* s - #define ITCCHEN_SHIFT 23
* g2 z1 _4 F B" Q I8 T - ; U8 q3 b* w: p
- static volatile int irqraised1 = 0;- V8 p- @9 \" S* V
- static volatile int irqraised2 = 0;; I' r) V# ^; I' O0 _, \
# \! G$ V+ ?, M2 B. I; h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s: ~. s- x: V% ^7 P( D0 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 L4 l0 ~; @5 N2 }8 @. u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z9 | z" U1 V" W
- 1 P2 t) R& k/ q
- dma_addr_t dmaphyssrc1 = 0;
6 y3 a5 l, v4 m6 @3 j" d4 G( p - dma_addr_t dmaphyssrc2 = 0;- \' y6 E* _) n
- dma_addr_t dmaphysdest1 = 0;
6 X7 S, d% k. z- x' ^3 ] - dma_addr_t dmaphysdest2 = 0;; r; j4 h, Z1 {6 {4 P5 Y
- 0 Y! a2 z5 R7 N, k
- char *dmabufsrc1 = NULL;& t2 g" U! v4 u: }# w1 V5 e
- char *dmabufsrc2 = NULL;/ e' Q e" J. [9 O5 Q- V; V$ Y7 }
- char *dmabufdest1 = NULL;
8 [8 X; r; d& j: {% m. I( j - char *dmabufdest2 = NULL;
9 F3 u/ {( Y) F. Q8 v
! Z; l7 M1 M. ?6 |5 Q- static int acnt = 512;3 Y+ n& n- e: ^) H4 P& Z6 j1 d; W- T
- static int bcnt = 8;
; o: u, H5 }; m" D - static int ccnt = 8;
4 N* P( H" Y" ~1 W+ i3 v# P( }: W
( l' ~( L4 R' ]0 x! E1 z- module_param(acnt, int, S_IRUGO);
7 h( j+ E: r3 @( O- ]- i* D - module_param(bcnt, int, S_IRUGO);
- E. @+ q! k# c2 Y) Q2 F - module_param(ccnt, int, S_IRUGO);
复制代码 " z+ c9 M! `* ^5 }) F2 g
6 q( L- V5 _+ y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% L8 [2 M0 m2 G; ?0 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ J6 |* S! F* a3 [( H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ T% s/ _. d, `
" p+ p/ H8 J$ Q& a" G8 { M: F, h, r3 f1 t- a( e, a" _8 z7 Z
|
|