|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 w) d% l, \: }( m# ]# |0 E, T- [code]EDMA sample test application' j: V# {+ X4 A E
- /** O2 ^( a) R! c0 F7 |# ?! U
- * edma_test.c
8 l4 v% d$ c( b! x1 o - *
7 Z2 J8 ^" z5 Z& a1 y1 d - * brief EDMA3 Test Application
* C% t7 d4 d( L+ B! u - *7 A/ ]8 r2 Y6 e3 ]3 C. [
- * This file contains EDMA3 Test code.! U2 K4 x+ ^8 k' J
- *1 a) _6 p) g7 Z1 ^; p0 L6 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y# b# Y, f; c6 _9 H9 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" v0 Q, \6 Z; s) R7 K( r" F - * TO CHANGE.9 c! T. [1 _+ i# @/ A
- *
$ L r! @2 |% ]3 ^6 P9 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' {0 k8 J+ _' M. v) _1 N2 ^
- *3 L; M3 v& J9 y" x( ~3 w" C) U
- * This program is free software; you can redistribute it and/or/ X# G' a. Q. u1 ?. H7 _
- * modify it under the terms of the GNU General Public License as, b+ c+ D; I: o% H
- * published by the Free Software Foundation version 2.
6 i5 g$ s0 X. W2 w- m" n - *: a# F" N6 [9 l4 r" [6 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' x9 R% Q1 C7 N( L) {1 e - * kind, whether express or implied; without even the implied warranty) B; f7 E2 J% \8 N. U* v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- p$ g+ Z/ ?5 q6 i* H! x9 Z
- * GNU General Public License for more details.
( k; |: }8 b3 y1 j' i - */3 P' H: O1 a' u$ W7 C7 S
# b3 G, K' C/ n- #include <linux/module.h>) T) U, b1 z, j
- #include <linux/init.h>3 ^2 `8 ~ ]/ K/ Y/ F) w
- #include <linux/errno.h>
! _6 h4 r+ u8 I g8 R - #include <linux/types.h>% p$ L/ j- d$ h* D9 r
- #include <linux/interrupt.h>
6 R7 I' q2 c0 E$ f0 q6 {2 K - #include <asm/io.h>
. r( T5 _* `3 f5 f - #include <linux/moduleparam.h>
# m& \ W' ^0 V/ Y2 X - #include <linux/sysctl.h>
, J8 H6 G& G1 ]1 ~3 b- C - #include <linux/mm.h>
1 v/ B/ Y$ d! N - #include <linux/dma-mapping.h>- f7 J3 P! o. \3 T8 X& m2 I
5 L- K& s% \4 Z, z1 b$ z8 F; [; n9 M- #include <mach/memory.h>
8 O7 z3 M7 }4 r. W D' } - #include <mach/hardware.h>
* e, j5 B0 X+ b& z0 Q2 l( h/ V - #include <mach/irqs.h>% j7 p- {' n I% \
- #include <asm/hardware/edma.h>
+ v) |5 L2 j: Y U0 ^
; v+ ~2 ]/ B8 Z7 t' B- #undef EDMA3_DEBUG, B5 S% S- P- I9 ?( L
- /*#define EDMA3_DEBUG*/0 l, z) d5 f/ y% \2 a+ I! I( j4 m
- 3 p* j: l- f! S
- #ifdef EDMA3_DEBUG0 @( D5 \. E' Q. Y+ l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% z/ W P( r+ C4 ?& ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" H0 K$ O, j4 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ @/ `; B4 t$ [% w - #else
8 r1 y5 Z. ?" q" U' n/ H1 B - #define DMA_PRINTK( x... )
9 V1 R, `9 _. g! [) i - #define DMA_FN_IN3 K6 [1 d& e$ W' T m# D) R6 K- l
- #define DMA_FN_OUT
+ a6 r6 G, H1 t2 T+ x - #endif, I- S6 @0 w: J8 t: s
' E( z2 a" ]9 b4 H. m2 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" ~- x: Y/ m4 C1 H
- #define STATIC_SHIFT 3
) A) R6 v% e4 A& v ` - #define TCINTEN_SHIFT 20
5 ]/ Q6 M" [. ~3 Y% u+ _ - #define ITCINTEN_SHIFT 21+ U; V7 T; n' g4 s
- #define TCCHEN_SHIFT 22) k( s: w* Z+ c" h& c4 ^9 H4 X% G
- #define ITCCHEN_SHIFT 23
" {& \: y' ~ o
B6 h; S/ ]4 i. k# j* t0 k7 ~. Y8 g- static volatile int irqraised1 = 0;
5 r6 t. T5 |+ W3 m3 s - static volatile int irqraised2 = 0;
$ A y! C: d1 x$ a) ?
P: c+ ~% d7 T0 B9 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E) a8 |; v! `1 x8 J z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ E' \3 d: m0 f" r& F- @/ Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ B- p0 ~' g) z( Z* ?2 h- A5 p: A8 k6 K - 8 ` b: o! @ Q* J O
- dma_addr_t dmaphyssrc1 = 0;
6 W7 ^: @6 G9 ? - dma_addr_t dmaphyssrc2 = 0;/ k' h# N h2 F. Z
- dma_addr_t dmaphysdest1 = 0;) Q) e6 c+ Y! {( s4 K+ }# k) J
- dma_addr_t dmaphysdest2 = 0;8 N0 F9 L7 X$ E1 L' s5 P1 O
- 2 q- x# J |" v, w$ X6 {
- char *dmabufsrc1 = NULL;3 c+ T8 E6 p6 S2 x/ j* j
- char *dmabufsrc2 = NULL;
& u, J! v$ j5 B( C - char *dmabufdest1 = NULL;1 i# ?/ _( H' y5 C0 [5 |
- char *dmabufdest2 = NULL;
6 e5 X% x! O" m1 {
3 _- F' o! y3 k; G: Q( `- static int acnt = 512;. _6 i( O& x! K/ e4 {
- static int bcnt = 8;% M* D% w7 Q# X; d- h( v$ p
- static int ccnt = 8;
' o/ |* l" k5 i$ v0 V' P3 I - % b7 H# w) i3 W) U
- module_param(acnt, int, S_IRUGO);3 b% L# g! i0 P- [" e
- module_param(bcnt, int, S_IRUGO);
1 q5 B9 C, a( w- c$ A' E - module_param(ccnt, int, S_IRUGO);
复制代码 . n/ z0 e7 R; c( {% X
# k# A" `& D# v: I/ d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" j! Y1 o4 j$ Y; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 m9 D8 r" ]3 r" @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, |/ V' q. K* I$ N
" d; Z% T8 a1 n+ l
) [( D+ V* q) T# X& e
|
|