|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g8 l( n; E1 N0 }- [code]EDMA sample test application
' Y& x0 {0 ^ B, p/ i$ B3 q9 n - /*
3 R, _/ X& K- h) q' v! C - * edma_test.c
" ~, G" y" m6 p# n$ W( m - *4 p5 Y+ x5 q# s: r, a9 U0 l7 l
- * brief EDMA3 Test Application
* _+ n: v% E6 J& m' ]$ P - */ v6 d, g8 G, R4 a5 w9 K1 U
- * This file contains EDMA3 Test code.
; y, |0 c0 P5 S2 C, W1 s- c! L0 S& t - *& |/ T/ {/ g7 ?! s: I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ?5 l0 }9 K# ?" Y T4 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( Y, C; z2 q3 s$ i6 t% ^! d( @8 [ - * TO CHANGE.
. H' w1 A& d5 s" q$ n1 K' W - *& y4 A0 d: g% A* v( ]+ y2 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( }2 N2 W# s, k0 R9 L8 J* l+ E! c8 H - *
4 H) F8 f7 ~+ v" S$ N - * This program is free software; you can redistribute it and/or
3 n ~8 {' D: j- J( M - * modify it under the terms of the GNU General Public License as0 j6 `; a, t1 H) p
- * published by the Free Software Foundation version 2.
6 x$ L$ l- t# m- n8 G$ w - *
2 n$ e, n: z' N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# X s2 o H* N/ g1 V
- * kind, whether express or implied; without even the implied warranty1 V* P$ u, S4 D- F. `+ \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; r0 k$ l' K5 R2 D) `) m
- * GNU General Public License for more details.$ J g4 R! s: E
- */
5 Z$ h" T: Y, Y, K6 \ - 6 m7 B! {& }8 y
- #include <linux/module.h>$ K- f2 j, o* R* s, B) B! g- Z$ _
- #include <linux/init.h>
& K0 x7 u6 a* Z) z- v - #include <linux/errno.h>; [" p0 A* W7 Z5 K. _& Q% v
- #include <linux/types.h>4 x h: X) [- \( a0 D
- #include <linux/interrupt.h>
; V4 a+ w' Q" a1 q( y. _' t - #include <asm/io.h>: P2 I2 P+ n4 W" @/ c
- #include <linux/moduleparam.h>: V. k& l5 b$ b2 f. i
- #include <linux/sysctl.h>
2 k+ i$ p% i |+ ]/ a - #include <linux/mm.h>
2 f2 k$ ]3 Y8 m5 d - #include <linux/dma-mapping.h>3 c1 s& k* s4 S4 l
" d& q) U3 R) ]" X% a( f- #include <mach/memory.h>
+ X) e D0 D5 V! U9 R# T$ ?. _ - #include <mach/hardware.h>5 y; |( g2 C+ h, a: @+ v
- #include <mach/irqs.h>
4 |$ I4 }4 C r& Z - #include <asm/hardware/edma.h>7 e% n' U! u" C8 g
" W) a4 i9 T8 D+ V6 E8 s z9 Y- #undef EDMA3_DEBUG
# E, s8 N3 ~4 K' L2 {9 L' S - /*#define EDMA3_DEBUG*/
, [: L, l2 s( n9 V' V3 B( B: u
6 a& i- r" U! ^, j" P/ E- #ifdef EDMA3_DEBUG( I# r4 Z4 f+ V& u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 k# d" ^% X, U' H% J+ ]: o9 M* S. J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O3 ^( d6 s; K$ U7 K) ^" m3 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s. k( G! r: i( x3 [; y) X9 _
- #else
0 M) q9 Z5 ^, m, u: y8 c5 k7 B0 J4 g - #define DMA_PRINTK( x... )2 M+ f2 c# K' D
- #define DMA_FN_IN
/ O2 o6 ?2 ?. `. r" N4 n - #define DMA_FN_OUT
) k8 i4 s7 X8 P* E! J( Q - #endif
( x/ m. W8 J! V/ Z2 a - * k+ ^6 j* ]% b2 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 {! W1 R; \1 y" v
- #define STATIC_SHIFT 3
' O) {# P6 L) ~( @7 Y" U3 n' t6 P3 |9 @ - #define TCINTEN_SHIFT 20
% J- Y+ M2 p8 U, o, B& R; c - #define ITCINTEN_SHIFT 21! q) F r j8 B6 c+ L
- #define TCCHEN_SHIFT 22 U3 N5 o! M7 Z p; S1 ]1 n
- #define ITCCHEN_SHIFT 234 g/ S8 H$ ~" o* P$ I7 l) s8 ]
O) Z+ E$ i! m) Z" L0 [- static volatile int irqraised1 = 0;
8 \1 L% C0 |7 p0 h. V1 v+ g- c - static volatile int irqraised2 = 0;
: ~& k+ E' L& P8 p# L - ! V3 f; u$ R* A0 D& C e8 ]' u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- A4 h) R; S% r/ n+ N$ l$ k! ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Y8 @7 [* A4 }, C; K$ s; P) C( Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ s. S6 J1 h. N
' M v. N: S3 p" v- dma_addr_t dmaphyssrc1 = 0;
5 g/ ^/ D- H. L1 Q$ U7 S( T - dma_addr_t dmaphyssrc2 = 0;* a' f8 P- {! l7 s' t# e0 s4 b
- dma_addr_t dmaphysdest1 = 0;0 ?5 c; y2 N1 O% I# P& M: ]
- dma_addr_t dmaphysdest2 = 0;
, Y" o B- F7 u' g) D" J
$ u/ \4 o+ [" W+ y- char *dmabufsrc1 = NULL;
5 `9 S% ?: k3 \: I3 J! e - char *dmabufsrc2 = NULL;& H3 D1 [- j5 }
- char *dmabufdest1 = NULL;
' |; J2 g3 [" O3 `+ Z - char *dmabufdest2 = NULL;$ V# @ P0 U/ O4 ^
- " D- x% g; O: Y& n) K7 w. f4 h
- static int acnt = 512;
+ Y0 H. y, O5 v( N - static int bcnt = 8;( ]3 A9 Y3 S, s. q/ y& H, z
- static int ccnt = 8;: E; g3 o0 t) d& k) A) a/ K
{' i! e- F; K4 k- module_param(acnt, int, S_IRUGO);
# Y) G! r0 m1 L1 I - module_param(bcnt, int, S_IRUGO);
' Z% N: Y+ I5 q* ^ - module_param(ccnt, int, S_IRUGO);
复制代码 0 S' {! G$ o0 I) \; V$ T r9 p
$ Q0 E+ t. U) Y- W' T4 u/ e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! x6 }0 u2 T& T/ m6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! B. H. V6 Q. m& p0 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 r: A- f1 X h# k, C. V1 `5 R
5 c/ ~9 z- b$ q9 u7 J% K$ [) J* Q& f1 t( s2 Z" L( j+ g7 A
|
|