|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 [/ x4 _1 x6 L+ i
- [code]EDMA sample test application
) e% c1 U+ v& p8 N0 g - /*
& e3 v: I" p; |9 r) {! f3 ] - * edma_test.c
' g5 f( H4 J9 q. q8 |8 Y/ q - *
2 g% T* n/ B: S% r Z - * brief EDMA3 Test Application5 t. M. I- T$ a5 N. W
- *$ I! z: `: T) f2 @3 q
- * This file contains EDMA3 Test code.
* X. Z1 {" }) r( d! l- d - *
- l- d' H/ Q3 W6 {5 n9 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( w$ b. C: d0 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
r2 Y# p5 s( |, x - * TO CHANGE.
1 r L7 h: e) e6 ?' p7 m. q - *# o& y( Z' Z! P+ D, D! M5 M' p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" x: C7 w0 s+ [5 Q9 q, f# e - *! P+ J0 `" w6 |
- * This program is free software; you can redistribute it and/or
7 ^2 [8 I8 J& F( R2 `% G" d$ \: R - * modify it under the terms of the GNU General Public License as
. [& _2 E, V2 @: a - * published by the Free Software Foundation version 2.! B$ r$ {# w% l3 S5 V& ~
- *7 M; C9 G* r- r! t- i1 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q0 O, b9 B4 G3 d5 c2 [
- * kind, whether express or implied; without even the implied warranty( i- T) _+ R. ^4 M# w8 m- J$ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- |8 t; c3 v) y% c! {; T
- * GNU General Public License for more details.
! @1 W2 T" N8 I0 Q" I - */3 |' b" x* U" r1 t# M J$ N' V
# n8 o' O/ C( F7 F, Z4 S- #include <linux/module.h> R7 P; a* l* i" R
- #include <linux/init.h>0 S$ r8 ~: e d J- O1 Y; s& t
- #include <linux/errno.h>+ f5 v- y+ i. p
- #include <linux/types.h>
6 @0 o# \ V' C% n+ h/ t/ L - #include <linux/interrupt.h>- G2 l3 I$ {; e( Q' r
- #include <asm/io.h>
% j+ }, q x1 f - #include <linux/moduleparam.h>
9 Z" E; l* q# w# y9 K0 u - #include <linux/sysctl.h>1 C6 I* F4 T4 q0 H3 ]' P8 \
- #include <linux/mm.h>. ~8 e1 `$ G3 {# H' Q
- #include <linux/dma-mapping.h>
2 u$ w( u9 U* m" A* F# |$ B0 s - 3 d" Q2 I1 Z0 _; a% h( y
- #include <mach/memory.h>0 I: V6 o$ ] ?; W: f' `
- #include <mach/hardware.h>( B# c# G* j6 f4 N
- #include <mach/irqs.h>
- g( W; K- f! @/ a8 R' s& Q - #include <asm/hardware/edma.h>
5 ]+ J! d: K) J! @7 x0 y. Q
, n; a0 P! S: c# O1 X4 S- #undef EDMA3_DEBUG% ^" m) J- G, p) F+ ?( i
- /*#define EDMA3_DEBUG*/
8 k1 E# S) m, }2 y* D+ B7 F
+ F. r% t- e6 _: d- #ifdef EDMA3_DEBUG
/ [1 ]* K; I. @. G: _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: f. c9 g. u9 ] u# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _9 j* `( j4 }4 Z+ Q3 T+ \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ~3 ?4 I7 V. P' |
- #else0 e4 k/ X$ v' F4 R8 ^$ E7 n' [# O
- #define DMA_PRINTK( x... )2 G5 p" M" r% Y$ \" Z4 R
- #define DMA_FN_IN
( N r: H; o8 t - #define DMA_FN_OUT
0 t1 W9 B& t) L" D# k+ o - #endif
3 k5 p$ k+ O( p% }4 b0 q+ i& K" E - . R$ [* j( ]8 O- M( U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- W9 o" T3 k+ F9 {& u - #define STATIC_SHIFT 3
: c5 ^/ }9 V+ q2 G# U; ~- m - #define TCINTEN_SHIFT 20" k" t+ b+ \" n0 m9 {5 Z
- #define ITCINTEN_SHIFT 21
5 x* P3 u5 c9 D; U& N - #define TCCHEN_SHIFT 22: t2 Y; n+ {& y2 N) j9 _
- #define ITCCHEN_SHIFT 239 V# |" j d9 b0 ]+ n" Q
- 7 S$ g) A- f5 L
- static volatile int irqraised1 = 0;
6 E( _4 X, ]# f - static volatile int irqraised2 = 0;, j6 M; ~( y& b9 m/ P% ] H3 m4 f1 ?
- " n# l( b1 d% _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% o; r5 [ u6 e7 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) L t# |% c3 U/ z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' {3 P/ H6 ? s' ] p
- k" E- R: |% Y6 O2 j- dma_addr_t dmaphyssrc1 = 0;
' W3 a" K7 T q) g3 R - dma_addr_t dmaphyssrc2 = 0;8 D; I' V! z( m% F6 @
- dma_addr_t dmaphysdest1 = 0;
) o2 t+ F0 e+ f, x( c; g u - dma_addr_t dmaphysdest2 = 0;! {1 u$ }- ?7 ~1 {/ B( d7 ]
" L4 x3 S- Q+ z2 V3 m! o- char *dmabufsrc1 = NULL;& `8 O# H: m1 i$ C+ ?: \; y# z7 m
- char *dmabufsrc2 = NULL;
# O4 p5 c, b+ v8 O* h! {; L - char *dmabufdest1 = NULL;" V- O6 W) M1 i- L9 u$ M
- char *dmabufdest2 = NULL;9 Y+ T {' N- w1 M0 w( v1 B" {* F
2 h3 l9 `8 n( |4 k- static int acnt = 512;
! R! H. S9 \* J* J/ b" A - static int bcnt = 8;2 T4 e$ D$ ?# ~9 N& E
- static int ccnt = 8;
, t& s% {- {9 E5 L* q. f - 2 Q; @! A# ^" o d+ k
- module_param(acnt, int, S_IRUGO);
' C& d1 ]3 U1 b6 f - module_param(bcnt, int, S_IRUGO);, R( ^! D9 ?& f0 @% X
- module_param(ccnt, int, S_IRUGO);
复制代码 # V3 B3 ~5 @4 W
- A, |* P# c2 B2 u2 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 O; l, J* U8 j4 S: k: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 r8 C" T) {! e7 z! r9 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 c* ^! u! b2 q, i# a
6 S& w( b3 y$ W; r
- o* `& y3 C: P* J5 S; w2 A! ^ |
|