|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \, U2 Z0 I' U# ^# T3 g4 ~- E
- [code]EDMA sample test application
& r* _: y8 Y8 D4 o1 k5 R( h( q - /*
( q4 _4 r7 i; B0 ?1 A# V - * edma_test.c/ r) S4 Z* o0 K7 `9 p5 {/ D
- *
0 X' R: q$ t; P3 H. b4 R; L0 L - * brief EDMA3 Test Application
. o- t. k5 b w7 Z% b# p, C - *0 l' k' Z" \ _. G3 Z7 l
- * This file contains EDMA3 Test code.
/ I% `2 j" ^& a) M0 E - *: o$ l$ k2 r) X$ |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# o& K `4 j/ T3 ~6 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ i2 ?( B) E5 F) E
- * TO CHANGE.: _; F3 t# p0 a5 M% V; u% r
- ** r/ V$ t# }) c5 N; J, d- ^8 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// m. w3 b: W$ w V# K5 q1 z
- *$ `8 H) h5 `( b
- * This program is free software; you can redistribute it and/or
+ }2 D6 ?# t# X9 \, [- J- [ - * modify it under the terms of the GNU General Public License as" \4 p! s' T1 f7 P0 ]+ X Z: I+ D
- * published by the Free Software Foundation version 2.: U7 m; q4 E( w, E% H) y1 d1 F
- *
( a7 F! `% q3 J6 a- S. A7 _' T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( g6 A1 I& \' O" H$ T - * kind, whether express or implied; without even the implied warranty) _1 l# h5 \ U f$ C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 r% s. j* W$ K3 f+ ~/ {# f* C. w
- * GNU General Public License for more details.
* F1 `9 ?4 i# B+ G0 P& g1 R! a - */
. e9 [3 A4 q2 P) E
/ j+ w' n$ k9 s- #include <linux/module.h>! r5 f3 r- Z+ r( a
- #include <linux/init.h>$ N# [) f+ b! ]$ H
- #include <linux/errno.h>
; R ]( R( g: _! U4 e9 f - #include <linux/types.h>3 |0 Y& [ b2 T
- #include <linux/interrupt.h>; x( H3 ^, R; H& `/ U# G8 `( `
- #include <asm/io.h>
: A4 G' ^" w) \2 R C) W+ m - #include <linux/moduleparam.h>
! b0 f8 \6 b- Y! ?# a6 f# W - #include <linux/sysctl.h>+ z( T( }" P7 u8 A5 g# V
- #include <linux/mm.h>- h8 H" ?) |7 ?) p- C% h m
- #include <linux/dma-mapping.h>
: o2 M, |& e& u9 d - 1 Z/ E0 k6 I# L5 t# M# l- ^( u4 ?
- #include <mach/memory.h>
2 h" G2 s! p% E& J - #include <mach/hardware.h>
! T1 \6 t. O( N - #include <mach/irqs.h>, G2 h( B# s# V
- #include <asm/hardware/edma.h>
/ q+ {4 S6 A) K, f/ L - 5 i8 N& ^2 A6 Y9 p7 I0 |4 a
- #undef EDMA3_DEBUG, S- s. H3 Z& N% ]$ B1 ^
- /*#define EDMA3_DEBUG*/
! ?$ K, g3 {. K5 T+ K% y) y7 ~6 l
: H- N+ ~. O8 o+ p0 Y4 Z4 r( R- #ifdef EDMA3_DEBUG
& M( u3 B# y7 N: Y2 [6 K, J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 n, U0 z' v6 M) _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" D% ~" |( u# i9 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P' Z/ e, j. c/ n
- #else
- u* b( }' M0 D a - #define DMA_PRINTK( x... )5 o, k4 I3 C- H- n4 e: z" K+ V
- #define DMA_FN_IN
0 B5 m7 g% N7 T* V9 l) w - #define DMA_FN_OUT
( I& C' b9 a& u. C) c - #endif
$ a+ ^" x5 ?( R5 ^! K" S
8 P. h1 p/ V, i: x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 j* i {" p! a5 I" z% q. F - #define STATIC_SHIFT 3
$ O3 \' u7 s+ @) d. R1 w7 r - #define TCINTEN_SHIFT 20
# Q! U! j$ r8 y1 D3 e3 { - #define ITCINTEN_SHIFT 21
. A7 a! T5 G' h, }+ W9 ~ - #define TCCHEN_SHIFT 22: z9 Q! X! i h6 L7 N- [
- #define ITCCHEN_SHIFT 23 A4 G$ M5 r" J) E4 w+ X& O
7 e" a' N( g0 R! |+ E- static volatile int irqraised1 = 0; s* I( l) G3 H, D$ O
- static volatile int irqraised2 = 0;
7 }2 n0 K/ X5 P7 {4 F
- E% [8 b( u: h5 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 T7 U* A4 ~' _! d' ]6 B5 w% t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 D4 E+ t1 c( i/ k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W( g! x: U" L) p! n
( [6 D8 X; k+ P5 B0 Y- dma_addr_t dmaphyssrc1 = 0;$ }0 N8 ~) l! W: X
- dma_addr_t dmaphyssrc2 = 0;
: S# I) a6 K% X; k+ j4 ` - dma_addr_t dmaphysdest1 = 0;; P+ U' \, U2 O) ~
- dma_addr_t dmaphysdest2 = 0;
4 _" j$ F' U7 \% _" w$ e& x$ L* W
u4 p# U6 l$ C4 v% X" X2 V$ d- char *dmabufsrc1 = NULL;
Q, O2 u& L: g: M$ @ - char *dmabufsrc2 = NULL;
& B5 A1 ?& |/ k) D% W2 G - char *dmabufdest1 = NULL;$ P3 J- d+ U: t! h0 S
- char *dmabufdest2 = NULL;
5 `2 p2 O. t$ c
5 {3 |2 H! T9 ^# a. M- static int acnt = 512;( D. [* @/ I+ Q1 r
- static int bcnt = 8;8 h) W! Z) H" Y/ f
- static int ccnt = 8;4 {% b1 Q3 J/ n c3 n& }
# U" c1 S+ y. D& V: V2 H- module_param(acnt, int, S_IRUGO);
* h4 w3 c9 o6 d% S- u - module_param(bcnt, int, S_IRUGO);
3 j# d. y! b) Z6 p5 f1 z7 G' v, o" b - module_param(ccnt, int, S_IRUGO);
复制代码 % j' H [& j6 @* V; U
! ?$ N2 P9 S7 C4 S! \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% i6 S3 U+ O9 Z5 Y3 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 G8 E2 [4 q+ [$ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( p H+ G+ J( y" y9 N) h/ T( W) T1 b# |" k9 e+ S: B% F
9 P4 j2 h7 P5 v3 w
|
|