|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L1 L3 g& N3 k( {- [code]EDMA sample test application& F( w- F B e9 w4 E; \
- /*
$ F: E: A8 H1 v! Y) P4 X9 I5 } - * edma_test.c: y0 _$ Y& `0 ?0 E0 Q
- *7 G0 H2 B. o& _! N
- * brief EDMA3 Test Application
7 U" q5 U% H' N2 V* L. B9 Z: H7 O - *$ B( p0 n, K' {# f( r7 h# [
- * This file contains EDMA3 Test code.3 C4 P& ] y9 R( K9 k/ O
- *4 O2 P' @2 v3 R& y% r) c! A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! q' c9 ~# C( R$ d+ F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 g$ `$ @) W! P2 y8 ~) a( p - * TO CHANGE.# @& F ~2 {; c6 J8 w
- *. Y3 ^' U3 M' I7 p6 G3 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 f2 C; _2 C1 c$ g/ @/ c' s2 c4 f+ F/ p' }( B - ** U% I3 h$ [- q, H3 L
- * This program is free software; you can redistribute it and/or
; C. }* d Y) c8 L5 O - * modify it under the terms of the GNU General Public License as
; f5 {) v7 s% O9 L1 e: |6 k - * published by the Free Software Foundation version 2./ B( V: @9 |8 D' M
- */ T! x, M2 `7 J, {% h! {; ]* M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! q! h2 }* P; f6 J4 T( w - * kind, whether express or implied; without even the implied warranty
- [* N- q7 _: H) b5 O! F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 t! C3 Q: U V1 G
- * GNU General Public License for more details.7 [. P! |5 ?: d7 T7 V
- */
$ l1 |7 T( h# D5 B& _0 m- I
8 s" P6 V; M1 s9 L, ~- #include <linux/module.h>
* [- L' ]; `. j& { - #include <linux/init.h>
1 n$ E* z5 a3 C; s+ n# `8 z# d N - #include <linux/errno.h>
( X) q1 B- ?" J2 v4 @ - #include <linux/types.h>6 S5 i L) L- k; j
- #include <linux/interrupt.h>
- B/ C) I/ D2 j6 U - #include <asm/io.h>
$ M7 a3 K- n$ `9 j7 I - #include <linux/moduleparam.h>7 M* m& z' p/ x& g8 Y- q
- #include <linux/sysctl.h>
8 \3 _8 R) g8 A& [- J2 ]1 }0 j - #include <linux/mm.h>& P: y4 O" ?8 ~3 }0 W @
- #include <linux/dma-mapping.h>3 S( O4 L3 ]9 n
6 C. ?- g' i; X) H/ ^5 r- #include <mach/memory.h>* z2 I, S+ R3 n4 s& Q8 C0 c
- #include <mach/hardware.h>. E$ h6 K \2 D
- #include <mach/irqs.h>/ A7 |, l; O4 ~8 W" S
- #include <asm/hardware/edma.h>
+ [5 i1 } n2 P ~5 o, |
; R) z5 X; X/ e) m- a1 c* E- #undef EDMA3_DEBUG+ |2 s9 R2 K7 r. [
- /*#define EDMA3_DEBUG*/# J: o" D/ [6 y6 {- p
( E7 O. l2 ]6 Q- #ifdef EDMA3_DEBUG: T9 Q( t# J* ?" O0 `/ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 \5 ]5 ^: T7 ~6 `, }* ` u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 R% P r5 o9 W; i6 z, [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 I9 e8 ~' M# D* P* w6 K$ P - #else
. e" ^/ j) O6 m! O! D - #define DMA_PRINTK( x... )9 j2 n# B/ Q/ {8 R0 c; Q
- #define DMA_FN_IN
9 Y& l3 ~: k+ e* A7 g4 P, A - #define DMA_FN_OUT
+ U0 K% T0 N) n) c, w - #endif5 j/ y' m% @6 g. y5 ]6 E( H
- 5 Y F G$ j6 U5 G8 Q& B) M1 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ~0 `1 V# s4 E1 L) N - #define STATIC_SHIFT 3
* |8 \- M$ _/ A' y- H - #define TCINTEN_SHIFT 20
2 I8 g& V9 Q! g9 O - #define ITCINTEN_SHIFT 21$ l0 y1 n5 e: B( c& f' ^4 s, Y
- #define TCCHEN_SHIFT 22
* G8 [- \5 V+ ~2 p5 T Q" U - #define ITCCHEN_SHIFT 239 E) W" A; ^, w' W) a0 I# \0 ?
1 C4 V$ g6 x& }, \- static volatile int irqraised1 = 0;& O- z F7 P: g, M7 v" n) ]
- static volatile int irqraised2 = 0;
# G+ Z: y2 y, n3 F/ Q6 e
) T J# Q7 h8 \8 p1 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" z$ z6 V0 O5 {5 `6 d# U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d! K4 u8 m% H4 `+ ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% n7 Y* Y5 ^" o0 k9 y. r1 c) F2 Q - ( r9 Y, P0 D0 J3 ^# M3 e5 i
- dma_addr_t dmaphyssrc1 = 0;% l# T! Q5 H5 J% |
- dma_addr_t dmaphyssrc2 = 0;
2 B; j: e( \" I/ o - dma_addr_t dmaphysdest1 = 0;& }1 a# r" F) ]
- dma_addr_t dmaphysdest2 = 0;% p: W+ d# e$ `# K5 j5 E4 Q1 H
: Q, i4 y. ]6 ?) z- K- char *dmabufsrc1 = NULL;
0 a/ [- B2 E& ^' G2 h0 A9 t" P - char *dmabufsrc2 = NULL;
p* `/ O# _, F6 o6 s: e/ x9 \" U" ? - char *dmabufdest1 = NULL;
- l5 C8 | \) J. t/ }8 S - char *dmabufdest2 = NULL;% u6 g( S; \- T6 z* J
% K" {5 o4 A" P& f8 R7 w- static int acnt = 512;
* Z: h) ~& {$ U1 v3 g - static int bcnt = 8;
$ t" L X: @% p - static int ccnt = 8;
5 _# W; A6 u. q5 I, a - ' `4 {: V6 u$ f$ J" r+ f1 B* ^
- module_param(acnt, int, S_IRUGO);/ w5 C! T6 B4 J( V
- module_param(bcnt, int, S_IRUGO);& z- w N- q5 K4 x3 s) |) w
- module_param(ccnt, int, S_IRUGO);
复制代码
' L1 o: c0 t' c) d0 q7 g. i1 t4 Z% S! Y' Y, @2 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B9 M7 o* z, K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ]& z l$ _# b! Z6 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* d& c4 @5 W" O; z, I. G! K" j7 Z
" j# z; O/ ?( K. M- Z" F7 q( |2 I0 E
6 O' o- y0 q( @/ B
|
|