|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 k' j" K0 `- b$ t) g# a5 q
- [code]EDMA sample test application5 R6 Q/ c. [- H# k7 j y9 m
- /*1 J1 ~& Y) X% i4 A
- * edma_test.c
! d8 o- T z8 U6 S1 P - *
+ B n: B9 d* H! T1 @ - * brief EDMA3 Test Application
2 V% _& B) `9 B/ @1 ^- c! T - *9 c* `( ?4 l; e$ T* f
- * This file contains EDMA3 Test code.
3 m8 b ~8 y1 O - *
9 @4 s+ g! G1 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 w: e! O6 e! z; k( f" n' \# u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 y6 d( k: N+ m2 D - * TO CHANGE." F4 _& a. L/ s# P4 l M
- *
2 s7 @3 X& A; P1 f, V$ ~) C* Q0 `8 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 g6 H' _7 c: c - *3 p/ U9 e' t' C5 W! C" ~
- * This program is free software; you can redistribute it and/or2 `1 f m+ f3 G( Y
- * modify it under the terms of the GNU General Public License as4 H. ^2 c3 h* C4 I4 r
- * published by the Free Software Foundation version 2.' J8 C3 r, Q7 }7 f! J
- *5 G# ?' o4 ^8 h, f' [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o& m7 y) `7 \! U) b1 E" H2 S
- * kind, whether express or implied; without even the implied warranty& n* r4 o4 W" v( U1 g7 H" A d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 \# F x6 Q9 _ o - * GNU General Public License for more details.- R! F" {4 G2 ^; {2 h ]5 D
- */
6 `6 T& K$ H& r" b$ I5 s/ D: F) \
4 @, |/ P! ~/ H- e- #include <linux/module.h>
2 D9 e4 _6 D) U0 J - #include <linux/init.h>; A* `0 M2 y+ m& o4 {
- #include <linux/errno.h>
9 k/ X% ]" j4 V" V - #include <linux/types.h>
8 l9 s* r9 y, }, ~ - #include <linux/interrupt.h>* y' u5 @5 N8 P" X( J
- #include <asm/io.h>& \' x$ j$ V) F1 A9 g6 q7 Q6 W
- #include <linux/moduleparam.h>
9 t* s3 Q+ m, b/ I; Q - #include <linux/sysctl.h>
5 ?7 b6 \8 Y) P# Y - #include <linux/mm.h>
$ C9 n0 z5 x) A9 A* t; d8 N! m - #include <linux/dma-mapping.h>! J( V& ^8 C9 ]! I1 B
- 1 r s* {; m/ P2 B' H
- #include <mach/memory.h>
" G, h" ^$ P) ? - #include <mach/hardware.h>: D- X( v7 O6 N, U6 h
- #include <mach/irqs.h>
# g' a ~8 Q2 M: F+ j - #include <asm/hardware/edma.h>
9 S! o0 |, F( k, t0 C- s. A
! N4 J# q) M5 j# ]9 F- #undef EDMA3_DEBUG
" m& d. S" W( a1 h) y% r. Z - /*#define EDMA3_DEBUG*/: \3 ?" `2 e6 T% Q+ D
8 ^* u' n I# }5 ~- ~8 H- #ifdef EDMA3_DEBUG
5 `7 C* l! k. _% c9 g+ v% l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ d! j/ K1 N" Q- l. H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 A1 ~* G! e" |% u: U5 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ l* [1 o# M$ F }" g6 R8 c - #else+ N3 t R( T7 }8 I+ C7 |! w
- #define DMA_PRINTK( x... )
- C. T3 B5 } C/ {$ O6 h/ R - #define DMA_FN_IN5 `2 V, a: G/ D* |3 ]# L
- #define DMA_FN_OUT& z/ V) G1 h$ C) ^1 v( q# q
- #endif( `$ s$ S+ ?. v4 H% T- {
- 6 {' f7 B! q: G5 O$ b8 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" p, T/ U, U6 X! s! C$ \
- #define STATIC_SHIFT 3
( L. P) [0 N- J- N4 w0 D5 e' R$ s - #define TCINTEN_SHIFT 20) l$ A6 D- V' g8 y' W
- #define ITCINTEN_SHIFT 21; n) g* P/ `* S5 n
- #define TCCHEN_SHIFT 229 H- d0 J2 u5 l5 R8 @. c9 b% ~+ b
- #define ITCCHEN_SHIFT 239 h, @" w5 e. p7 z$ y
$ g" f8 {. X5 m- static volatile int irqraised1 = 0;3 T. X2 ]( x( [. G& T
- static volatile int irqraised2 = 0;
# n% D" ]: `' C5 z4 Q. Z- Q$ K - 7 f% x' K; z' A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t6 x1 q* ~5 z2 S7 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' z" S1 A z# ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, x1 q$ P* i& t1 p% ~) U4 r+ X - $ Q3 r" v1 x. f) b
- dma_addr_t dmaphyssrc1 = 0;" `, ^3 J; @* L* S( D: v$ ? a* `) k
- dma_addr_t dmaphyssrc2 = 0;
) H4 ?, P; e, c+ M+ V- R8 z - dma_addr_t dmaphysdest1 = 0;
g/ B) q! p0 J" [+ @2 [& ^& ? - dma_addr_t dmaphysdest2 = 0;
6 w S; L% _0 r8 O) l
0 c+ W- T2 a6 N+ U- char *dmabufsrc1 = NULL;3 w9 x5 K3 @1 P- K8 _- c
- char *dmabufsrc2 = NULL;- @; F% Y, p, N. O* h+ d+ O( \7 L
- char *dmabufdest1 = NULL;# L+ L; `% u8 w2 [3 _3 i# N
- char *dmabufdest2 = NULL;% r" F$ A/ E" g4 Y& O
$ ^# @2 V+ O6 [+ R! L4 `- static int acnt = 512;
3 s' o5 Y6 }1 S5 a, n: N3 H' ? - static int bcnt = 8;
# D8 Y5 b: ?) p7 H9 j) o/ [! ` - static int ccnt = 8;
6 {) g2 z6 |+ e7 i - + u0 q* i2 A& y5 v+ R( P% s1 w
- module_param(acnt, int, S_IRUGO);; C+ l* j5 i; d( j9 u! T- f
- module_param(bcnt, int, S_IRUGO);. S+ B2 O2 p& B; E4 s+ c' w4 G( p% A
- module_param(ccnt, int, S_IRUGO);
复制代码 $ N% E+ r. k2 J% p5 e. ^9 `, Z
" _, @; d- [; L6 i' @& C- u5 }! r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 A, U( V* M" G. Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% n! O' A( d. s5 U! p, f! `: \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \& D$ U+ B) i3 `- m* o) l4 A* Q9 E4 l
3 K' @0 Y9 k( }6 c6 }6 |) w3 h |
|