|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ M7 X0 U* s+ Y: p; o( Z- [code]EDMA sample test application
, T5 L) x: o! I- s - /*
7 K( b a# b7 k - * edma_test.c$ g$ Y+ t% p1 Y" c- i. V7 w
- *$ B2 ^, ]& Z, b: z* y
- * brief EDMA3 Test Application
/ O) X- Y5 V/ b; B- F - *. D% k9 n2 d+ r4 X1 Y
- * This file contains EDMA3 Test code.
+ q' j% x2 [0 r. r% _ - *
. R% D+ |4 l! t0 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) C6 I1 ~9 `- j0 K. I, J# F( w0 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 v; `2 n- r ~2 m& P - * TO CHANGE.
# e5 h' Q3 h( F - *) n, }8 J7 h& u, o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h: @! Y$ Y1 n3 v
- *( r0 v2 V! {# y: U. L* m
- * This program is free software; you can redistribute it and/or& q2 G% i+ H3 x6 M* h
- * modify it under the terms of the GNU General Public License as9 [ x5 U L4 M# i* I9 d7 e# p$ b
- * published by the Free Software Foundation version 2.2 C- x' l1 K, T0 f" @
- *
1 P4 `" r. w3 \5 l9 m6 H I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any j% F" }$ A# B& p
- * kind, whether express or implied; without even the implied warranty, a0 c% k: F0 M) [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 u# w2 Y6 {3 f: @" B: ^& ~ - * GNU General Public License for more details.
" A1 K* n4 e2 p9 h# @ - */! w& i1 ]. q3 `6 g
- 1 E, j. Q/ q0 Q n! @
- #include <linux/module.h>
" V2 `8 m6 ?8 B+ a! k8 w# V- o - #include <linux/init.h>4 A% Y( S/ b" f$ F
- #include <linux/errno.h>0 d3 v! t4 V1 O" h& \
- #include <linux/types.h> ~9 Q- N/ |) `2 O" p
- #include <linux/interrupt.h>
& Z% n5 _6 v5 S7 \$ i2 E - #include <asm/io.h>
' C" }9 L+ W } - #include <linux/moduleparam.h>
$ M% t" Y! @3 a4 z" a0 X - #include <linux/sysctl.h>
I! ]9 T L* g& O7 e K - #include <linux/mm.h>
' e1 @& e6 ~- E- q! ] - #include <linux/dma-mapping.h>
. ~5 B a }7 {1 r$ ?
* D% J5 P/ {" Z- #include <mach/memory.h>9 I$ A1 ?# \- R2 }& p/ W9 Y. v1 ^
- #include <mach/hardware.h>
9 ?3 C2 x, q' N# D( F) [ - #include <mach/irqs.h>: r+ G. M* g! E7 \" w u( V
- #include <asm/hardware/edma.h>8 S- r) M* X+ u8 I8 `: |8 c
& E2 K$ u9 ]# z5 N( g4 Q4 J- #undef EDMA3_DEBUG# {" w# G1 E! P1 H. p, \
- /*#define EDMA3_DEBUG*/" ^& L5 Z8 l; @1 [5 {9 i% `
- ) {; J* w: S2 R* ]
- #ifdef EDMA3_DEBUG$ c" e( |4 C6 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ j5 o# V5 ^ O3 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% W* ]% O( k8 f- @% Q* f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [) A; S7 Z9 `* ~" v
- #else
9 r! z4 L9 U/ Z3 g - #define DMA_PRINTK( x... )- F5 J- I9 p2 D; G5 D& h
- #define DMA_FN_IN
1 N; e5 l5 p* @ - #define DMA_FN_OUT' \# {' _2 ~2 Q) T
- #endif0 e7 c; g& _+ {6 f3 E! e w1 A x
4 U5 h, d; M8 o X# e$ K! L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 m6 `; l5 v+ P; v* V - #define STATIC_SHIFT 3& C) M( F) r4 c0 P& j$ X( ]
- #define TCINTEN_SHIFT 20( S# r/ v& V" u# `9 w
- #define ITCINTEN_SHIFT 21; f( p, C e* Q- Q7 J
- #define TCCHEN_SHIFT 22
' d. n. q; ]3 [& ] - #define ITCCHEN_SHIFT 23' v* M$ F" }. L6 ]! [% R" z
( _, R, Y g% `- static volatile int irqraised1 = 0;6 ]( R* y* {5 |# R: }
- static volatile int irqraised2 = 0;
3 D( Y3 c7 H( @- P' ~& ^
- @! }9 L- z5 u, h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K8 d# i& F; p/ g2 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" y) K" f: E( h8 T E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b4 d' [& _1 @
- 4 N( B+ a* c/ C2 n3 r5 S# F1 K Q
- dma_addr_t dmaphyssrc1 = 0;
4 @" y+ u& `' ?! A - dma_addr_t dmaphyssrc2 = 0;
, I7 p" ?3 |: _3 ?$ u1 u - dma_addr_t dmaphysdest1 = 0;& C& w" V( j5 L$ v/ b
- dma_addr_t dmaphysdest2 = 0;
- |6 O [% H( t( y+ `4 I4 b: ]
- d7 S$ _! y" l' x( Q- char *dmabufsrc1 = NULL;
$ s) u. i1 L+ ~ J, S4 C' E - char *dmabufsrc2 = NULL;
( y8 L* e; t% o' B( o7 p: M* x - char *dmabufdest1 = NULL;
6 [5 {$ V9 W& f- A8 T - char *dmabufdest2 = NULL;; t3 ~% Z- }: i* i
0 ?! D' j9 s/ d! S& _- static int acnt = 512;
. D7 W8 h9 a$ j! `/ A! q - static int bcnt = 8;. R0 x$ W4 x' t: E
- static int ccnt = 8;
7 b$ G7 [! a5 w( i: q" J- w
; h: M$ n @# G- Z; s6 O- module_param(acnt, int, S_IRUGO);
3 d1 `& u. O# T - module_param(bcnt, int, S_IRUGO);7 M" m. Y# x. X, O
- module_param(ccnt, int, S_IRUGO);
复制代码 . G2 J9 Q2 q- J) v3 \
% q! p! \/ p' o# u5 }6 R; M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \, V0 S" @. Z+ s0 }6 _" S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! d/ O9 r z% ]. Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ I% t. b) ^4 H1 k' K: i
/ c3 f$ _, P' W& A' ~# l
7 y) D v2 S1 c$ Z" v- w |
|