|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 k/ [. `$ N5 X& h
- [code]EDMA sample test application+ h' ]! M8 G/ N8 _* o6 j+ K0 |( U- R
- /*
3 M- [( ?1 @: j1 X# x - * edma_test.c
" r* l( B$ g7 h5 n' |! u - *8 [8 u/ H0 b; W$ p# k
- * brief EDMA3 Test Application
$ |, V# U- W6 V3 E& V" A - *. u9 p$ G' s. f: k' I+ d% z
- * This file contains EDMA3 Test code.' m# \) o5 R% P3 E4 E
- *
! {# a% Q( P/ [3 \8 T0 e7 H$ U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, x- j0 [% z1 d1 O4 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 s. A* w0 U. F& G% H6 m' `: |/ V
- * TO CHANGE./ o" N G U# g/ U% i
- *
. I% V1 j* y9 c7 Z- m1 D! E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" r/ M# {8 v, t+ _0 R; X9 Z$ v; @ - *1 e- N* v, r! _* Y
- * This program is free software; you can redistribute it and/or
+ ~( i' g, I. w+ {) E - * modify it under the terms of the GNU General Public License as( [1 F1 ^/ N" v0 Q% V
- * published by the Free Software Foundation version 2.& z1 l, L/ Y" K) o
- *: B3 N- Q, t, I' F3 y1 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H" _; l/ [ J: ]: F
- * kind, whether express or implied; without even the implied warranty
& F; c# M% i9 }8 R+ V9 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ e, L! l2 Q8 ~( z9 I$ \6 Y
- * GNU General Public License for more details., R/ z+ d7 P5 u% S# K# B& S0 F; Z
- */
2 { f# X: d) B% n- t
, c5 u8 f5 D0 v# e2 Y/ }- #include <linux/module.h>
; H% s5 C: Z( N8 V3 P4 t - #include <linux/init.h>2 O4 t# d: Y8 _+ N# n, I+ r
- #include <linux/errno.h>0 C4 p2 U9 s, p; Q0 E
- #include <linux/types.h>% Z# n! S0 Q, g6 Q7 i
- #include <linux/interrupt.h>- X. H- ]9 D1 M9 Q& A' b
- #include <asm/io.h>
( T) v! V8 ?4 R- j, q0 S - #include <linux/moduleparam.h>
0 o. G+ S3 o( C' O3 E - #include <linux/sysctl.h>* { [0 O$ [8 x$ Z
- #include <linux/mm.h>7 ~0 Z( Y( H& t, q& r
- #include <linux/dma-mapping.h># T" c) [+ m+ H2 w1 a/ j
- 3 v# H5 J; V6 ~& j
- #include <mach/memory.h>
, A+ E# c' K7 G* j# }" @7 V! v - #include <mach/hardware.h>% C2 m4 |# d" E7 H5 u
- #include <mach/irqs.h>" ]: b, @0 y% g# d5 O: x: n1 d) A
- #include <asm/hardware/edma.h>7 `7 ^9 x) o$ P* a$ P; S
- : X2 c% ^: }. l4 b4 \: P
- #undef EDMA3_DEBUG" w/ h! i+ g' W/ i& o6 n
- /*#define EDMA3_DEBUG*/* e% s9 }) ^! T; l/ a' H$ R
- " A' v9 k" G" w
- #ifdef EDMA3_DEBUG
' v, t" x: B, k2 g N8 c; L" q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T. k: h3 L0 W8 C" [: ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 ]( u: K* @, G' A+ H. L& F+ D' l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 V$ c0 U3 R/ Z$ Q/ _8 L/ u - #else" v' }/ s! i( h' | J3 ], i
- #define DMA_PRINTK( x... )
' S; T4 }' h9 J B, M5 s - #define DMA_FN_IN8 {3 t4 D$ ]5 g( E! _; }4 j
- #define DMA_FN_OUT, E& l* h6 c# b' T) c
- #endif6 G9 x5 s8 V" @! n5 d& M
- 5 o4 a$ S0 a- @! z1 [4 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Y' D% g/ i' p - #define STATIC_SHIFT 3! E( P, R6 |& i. a/ l* {4 J
- #define TCINTEN_SHIFT 202 E2 ?( `1 s* k2 o$ t7 ^: O4 B
- #define ITCINTEN_SHIFT 21$ I! c0 n* Y' G
- #define TCCHEN_SHIFT 223 E! S+ z2 X/ v) t8 @
- #define ITCCHEN_SHIFT 23
% t( }8 o( z2 I" G9 K$ v' y
a- x g ]) V0 B4 i- M7 m4 h- static volatile int irqraised1 = 0;
$ a8 I- n2 P; v" K" a+ N- Y - static volatile int irqraised2 = 0;
- K n H- M$ u M5 y2 Z1 ]! E
' m& p9 }' J9 R0 q) u4 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J! n% M$ Y E6 Q+ [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N* I0 ^% R9 V# G( q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! a: ?5 ?8 C. [$ i5 [" h - " X1 _8 U8 `* ]
- dma_addr_t dmaphyssrc1 = 0;
' d* q' R/ Z' g+ j) K - dma_addr_t dmaphyssrc2 = 0;
& z8 @$ L9 {" |* `* @$ ^" D9 T - dma_addr_t dmaphysdest1 = 0;0 @4 B. a& D. X+ A% K$ ^
- dma_addr_t dmaphysdest2 = 0;7 A2 s( _' K- e, s
/ `" N6 E/ C6 M( C- char *dmabufsrc1 = NULL;
- a) h4 [3 l' ^4 U7 {/ J8 g - char *dmabufsrc2 = NULL;" {7 | i! b- b$ @( i! K2 d4 P: D
- char *dmabufdest1 = NULL;
) m4 M% ?+ n* E6 w9 D - char *dmabufdest2 = NULL;
8 e+ v1 e8 J _0 N3 [ - . O; S6 c, ~* D" \3 u
- static int acnt = 512;+ m& x3 @; ~' N2 M1 h
- static int bcnt = 8;- A k% X: p6 R1 M/ o4 E) Y: r3 G6 R3 ~
- static int ccnt = 8;. ^- w' D1 J: h5 t- |8 N* D
: ?1 |8 m* x1 A7 U- {- module_param(acnt, int, S_IRUGO);( _- a' Z7 q/ H% z
- module_param(bcnt, int, S_IRUGO);5 `1 P0 H) e0 l* m [( F i
- module_param(ccnt, int, S_IRUGO);
复制代码
6 m1 I g. f, R) k
# k+ L) N. H! z! g/ W2 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, V+ A2 B4 e+ g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 e( d( G$ E' s4 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, l% R( F0 f. ?: s$ n
6 O, ? U: F1 H: N) A
9 U5 S7 A+ {0 c |
|