|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e0 N8 A- F* i/ N7 Z, N1 r- [code]EDMA sample test application0 Q9 [$ r, E' P6 @4 R
- /*
4 v7 x: N# N. w& n- V! V+ x0 w - * edma_test.c
+ T1 k/ n: w5 @" I9 F7 l' s' o3 I - *
: U+ w6 ?" Q* U( L) ]3 O8 R- Z - * brief EDMA3 Test Application
8 E. T# o* d5 q, f - *: T, i: }3 G3 i
- * This file contains EDMA3 Test code.
9 l( V7 t, _& i2 _- J1 W1 n# _ - *
0 ~, d Q0 X( t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# E8 G% w5 \% M& s$ D# {* z5 D$ m* r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W, h( c, Y& N* R% t5 V1 ]5 {
- * TO CHANGE.
. ?( {% L& f: [1 ?; Q5 g - *% f5 s- N- s" L4 i5 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' W' H4 S( G6 o/ R - *8 w4 ^7 h: [1 W% [( w
- * This program is free software; you can redistribute it and/or
+ K" y5 b3 @) y1 a - * modify it under the terms of the GNU General Public License as0 p7 g4 i* U0 z% t5 l5 u$ r _5 i
- * published by the Free Software Foundation version 2.; j ^# s9 j- y5 X v
- *
3 v% }& G! C0 d+ p/ X) P7 e; M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" `" n* K3 S# @- M% {" k
- * kind, whether express or implied; without even the implied warranty8 N1 ^' m6 B' ^# M2 t) G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 d, @ e+ u* Y* A. l) M9 n
- * GNU General Public License for more details.
# E/ t) X5 b8 R6 O( r - */
7 y4 T# N! {- w& h ^! S
- {7 p1 I! {* P/ r6 R# ~- #include <linux/module.h>+ {0 @7 g0 V6 d+ C9 S# i: {
- #include <linux/init.h>
3 ?7 b$ K( ~1 R9 P2 u - #include <linux/errno.h>+ S7 @3 u8 M' Q# r G' j
- #include <linux/types.h>: L0 K" U7 {3 r+ {4 L/ ]
- #include <linux/interrupt.h>3 Z4 Y: y# z* I0 U, {
- #include <asm/io.h>
8 e/ p, V, ]6 F* O7 ?$ H [ p! N1 _ - #include <linux/moduleparam.h>
* R1 _- W: |' r( r" y( {" U+ ` - #include <linux/sysctl.h># G3 s, X6 @5 K2 R1 m( [3 l
- #include <linux/mm.h>8 n; u% }$ A4 c t' T/ d
- #include <linux/dma-mapping.h>
g9 N6 t, \7 R" Q- V; t
& M! d7 r. f1 u/ E% n1 B) V; T& p- #include <mach/memory.h>$ D2 M3 H* r) A: q; t6 q
- #include <mach/hardware.h>* j2 e4 \+ _' r& [ ~
- #include <mach/irqs.h>9 L) h1 Y, W5 ?* v. ?
- #include <asm/hardware/edma.h>
6 D! m; t" E' B' x; a) \ - % N- F8 z1 s3 B9 E" g# i
- #undef EDMA3_DEBUG
3 }/ ?' G0 C, L- l - /*#define EDMA3_DEBUG*/
, t W- r' H+ G, I
P, s1 k& g' a- O" i- #ifdef EDMA3_DEBUG
/ h" E! |. N' I) P) j0 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 r* c0 x5 w" d% ^& f8 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 |8 l" t% A+ W- p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 \: u9 [9 F" K3 W, U - #else' J |% S$ ?5 `( r( C/ _ ?
- #define DMA_PRINTK( x... )9 t3 h/ U: E2 ^" E E
- #define DMA_FN_IN
+ E: \9 I4 s& K& i/ Z - #define DMA_FN_OUT
0 t- s$ [4 q6 F1 X! Y+ E - #endif
. p$ s% H9 {6 z& p( g; ?( f
8 K! L: T5 I; x. w7 i7 v5 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* B) C1 D# m# X. W
- #define STATIC_SHIFT 3' \! h$ p& q! |: P6 }& `
- #define TCINTEN_SHIFT 20
, V8 B( ^1 r1 ?( T- H+ M* u - #define ITCINTEN_SHIFT 218 V8 o7 K5 C1 x& _- n4 U8 N' ?
- #define TCCHEN_SHIFT 22$ ?( s \' A, X8 p9 r& A
- #define ITCCHEN_SHIFT 23
& d% C* G" S8 Y+ O. }1 n. z - 9 q5 T+ g% H" o, \6 _0 j
- static volatile int irqraised1 = 0;
$ P# ~ T* R$ ~5 P9 E - static volatile int irqraised2 = 0;
* H$ o' B. D; P$ D4 q# {4 r: {
; u, M s# }* C, j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T* ]" d; [) R; `" C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @2 g9 T1 z/ V, Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. i) O" J, A9 O9 J4 ~8 q y# J T
3 ~ M* r1 \* s _( o% A3 E1 l- dma_addr_t dmaphyssrc1 = 0;
2 B7 @' V. D0 d; w F - dma_addr_t dmaphyssrc2 = 0;
0 |# r7 \2 y: c5 e7 r( T - dma_addr_t dmaphysdest1 = 0;$ n: V; D* d+ j" v8 w! |
- dma_addr_t dmaphysdest2 = 0;
' ?2 P+ \# c% G& d2 j0 }" d# i( b4 \7 @
5 X$ c( @6 q/ [ x$ }+ f- char *dmabufsrc1 = NULL;; n: T/ c9 P- ? `$ N
- char *dmabufsrc2 = NULL;( r/ e: b8 \' @9 D- U, f5 S
- char *dmabufdest1 = NULL;
8 Z. o& k" h4 n: N - char *dmabufdest2 = NULL;: b* c$ S0 F! n8 t% Q- N
- , u% m7 j# x$ s d- F. `. B1 `- e, m$ |
- static int acnt = 512;
( J6 Y. e% T1 V; X( f+ m - static int bcnt = 8;$ ] v1 e3 d4 M# y, f
- static int ccnt = 8;9 y2 S9 f/ `# g1 P4 e) K# Q; _! _
- X7 e) Z: N3 b4 W7 ]
- module_param(acnt, int, S_IRUGO);
! o8 z' a# C! n+ A( Y& Z0 @ - module_param(bcnt, int, S_IRUGO);" D) D8 Z* m8 s o U' ]9 x; F
- module_param(ccnt, int, S_IRUGO);
复制代码
/ ~" l8 _2 k, R. m# a% P: f, }* M9 f6 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 r8 |- q7 z( M& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, H* ^. u) d! J; g, R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! _7 x' E8 o- L r4 r' t+ _9 [$ [, ^9 L% n% J3 c- e
- R' p- X' O- w5 b8 }2 O; ^ |
|