|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' G0 F q3 w3 {( p- [code]EDMA sample test application' t# C4 ?! `* d% T. @$ x2 Y8 m
- /*
; y1 s( m' M/ t( E - * edma_test.c. s" h6 E/ |; \* p7 H* S5 U0 u& o
- *
$ u6 V$ q% c0 E! f1 X" ` - * brief EDMA3 Test Application
, B9 R/ [9 s4 e8 `% ~- C0 ^, n2 @9 f - *: P, d& _0 A2 w
- * This file contains EDMA3 Test code.
9 e9 y4 M6 k4 P+ Y9 G, s - *5 B0 [, E: A5 t: m" d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 Y$ f0 H: l8 I7 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' T) v' q: E% L2 M
- * TO CHANGE.. d% ^. V- I' _& x0 b
- *; r9 H+ a* y8 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 x! U2 G% L0 E; }4 \6 o
- *, q5 O9 P E. n* K8 j) g
- * This program is free software; you can redistribute it and/or/ o" y: C }; W1 c* I- `9 j u
- * modify it under the terms of the GNU General Public License as$ W) p8 g9 q. \/ _1 g" J F* e
- * published by the Free Software Foundation version 2.
2 N) [ f( F3 s" r9 \ - ** d: P9 w: C+ M4 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 l0 `9 Q% r$ ~4 }
- * kind, whether express or implied; without even the implied warranty
) c `6 |$ d% N( B6 _1 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 K( T! y+ J- i; @% n8 m - * GNU General Public License for more details.0 m7 S$ q/ a8 b6 M2 N8 c& N! k
- */
* ]8 o0 d9 p" ]6 X - ( p' T& \, }! z! a* G! [- t
- #include <linux/module.h>4 q& Y3 U" p1 f; m2 M
- #include <linux/init.h>
, [( f1 o: u, o, A( ~( R - #include <linux/errno.h>3 D% f8 p/ i! w+ T" g7 S
- #include <linux/types.h>
, f1 d: U; n( D4 J - #include <linux/interrupt.h>
/ c6 o! q) P( x w a! P - #include <asm/io.h>' _2 }: h+ H8 A3 [
- #include <linux/moduleparam.h>
, G" q6 W, N( E- m k - #include <linux/sysctl.h>+ l( J7 u! N1 I' z
- #include <linux/mm.h>; k- s) |) z: z+ @) d' i
- #include <linux/dma-mapping.h>2 i: J5 U( h- Y& {) q
9 E, I6 ^2 A( ?1 e0 X1 S/ e- #include <mach/memory.h>
( L+ y6 \' c4 ]6 D! U - #include <mach/hardware.h>
- H5 Z6 A. B( L8 C1 G# ^) J" o8 z: A - #include <mach/irqs.h># l& p7 g; m S! o* |- G# t3 J9 ]
- #include <asm/hardware/edma.h>3 }: u: i4 S8 H$ {# G7 x& C
- / z% g) }* K0 D9 q3 H
- #undef EDMA3_DEBUG
+ B; r# t7 h7 d - /*#define EDMA3_DEBUG*/
7 [7 F( q( [9 G" d& L8 H - " ]! Z) s. G- l/ W$ }. K
- #ifdef EDMA3_DEBUG& d# R8 n+ r& W Z. O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* g- Z o/ P9 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Y! K2 }2 C5 C, i3 k. ~$ L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 A7 W2 V5 @' N5 a# {8 y* s
- #else) k8 |, ^, P1 g) r. `
- #define DMA_PRINTK( x... )) K7 Q+ x& n j) f+ u. _
- #define DMA_FN_IN g! C/ W/ _3 w- q3 C
- #define DMA_FN_OUT
# O4 r! t$ y0 r2 |' Y - #endif; V/ L! z: I3 f* Y% I. w
3 ?1 A6 w' G! A0 Y# m1 e9 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ `8 F+ M, e$ }% J* z( s
- #define STATIC_SHIFT 3: F4 V* O, |8 Z2 f9 w
- #define TCINTEN_SHIFT 201 `1 b" c9 i% e* S& |; d( Z
- #define ITCINTEN_SHIFT 21" u1 k. j: j2 g: [1 t& L- B
- #define TCCHEN_SHIFT 22
+ E: a/ x4 y4 m - #define ITCCHEN_SHIFT 23
2 u( Z# O2 q/ m) Q X8 Y: O2 t
7 A ?1 U& O" }2 Q' p- static volatile int irqraised1 = 0;
6 d6 x' l7 k' O1 p; a7 v" `' e/ B+ c - static volatile int irqraised2 = 0;
& [" F5 e# ?3 T# C. G
9 v2 t; c. |: I- ?* L" d G a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) a: H2 `5 ?- z6 F$ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ? E Y* T# j9 W) o8 Z7 ~; Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u8 o! K6 A# k0 M" V$ U
K% }# z6 V- o8 f- dma_addr_t dmaphyssrc1 = 0;
: v: E* N% d* t7 r4 n, F( d' v' v - dma_addr_t dmaphyssrc2 = 0;0 v' o( X9 j/ R) l# I
- dma_addr_t dmaphysdest1 = 0;
0 s. ?5 w( p- X( f8 L0 K: \4 A - dma_addr_t dmaphysdest2 = 0;
, @$ h g6 `& t - ' Z, Y1 T: c% J2 R0 N9 S9 S& M
- char *dmabufsrc1 = NULL;+ i3 n7 s" p( C, Y. _% d
- char *dmabufsrc2 = NULL; f$ S/ E( g3 \" q! u/ N2 ^/ I
- char *dmabufdest1 = NULL;. d0 m" E6 s0 [, \- I
- char *dmabufdest2 = NULL;
, H* O5 d1 D; O3 R0 z - - _' s4 k3 s6 E0 L& ?
- static int acnt = 512;( Q1 M; T3 S& J, W4 F$ [
- static int bcnt = 8;
' k+ z' W9 V" W* U - static int ccnt = 8;
9 ^7 D: x% d0 P: h' S6 Y - L# ?4 g6 R. R# r; ^
- module_param(acnt, int, S_IRUGO);& p7 F0 n8 q% L6 K4 X- A [
- module_param(bcnt, int, S_IRUGO);
' v- V7 j( H' ~ - module_param(ccnt, int, S_IRUGO);
复制代码
* Q; M! H' k6 m: t/ i
+ X" M$ }9 v- g3 O9 l' I, t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R0 z: F8 n1 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O1 O2 ]5 @4 i+ _2 r: z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' a5 t- _+ _7 b8 i2 k
8 R( z# X* x+ r4 s
5 W9 Z6 l6 G% M/ h: }
|
|