|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * a% H2 m* m+ u/ i9 g
- [code]EDMA sample test application, {2 M& b. e. q; ?
- /*
) l. q, ?$ X2 L& i& G% x - * edma_test.c
4 X5 X% Z' I- u& U. a - *8 @( z$ s7 T8 _5 [* C$ E
- * brief EDMA3 Test Application* X) @/ g0 L' n0 w: A& \. _
- *1 v; `, D1 R' S* i2 G2 g7 ]! |0 y
- * This file contains EDMA3 Test code.) l) ]: t' S% k
- *' T" @% B" n0 G$ I$ [; k, e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" B3 n t% H7 L* i! R: D- n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% A: W; H# B9 _3 y$ o# V% o - * TO CHANGE.
4 E+ f; |& g" c3 s3 i - *
4 ?3 l/ q) c* |; Y5 D! Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 f1 T- Z7 @6 Q9 e. h - *
/ s9 f! n7 C2 H3 e: U - * This program is free software; you can redistribute it and/or" M) b' L% j$ m+ b( @, W
- * modify it under the terms of the GNU General Public License as3 l) n6 Q O5 t
- * published by the Free Software Foundation version 2.
( e: j9 h2 Z+ u( R5 u2 [ - *0 P% j9 s- i" T" W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! B3 h4 ^/ g$ w
- * kind, whether express or implied; without even the implied warranty' n/ g ^, v- n+ R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. e- B0 s% H, S - * GNU General Public License for more details.
, D8 |2 l/ A% j4 A3 E+ n# C - */% c4 K4 ^, m3 j3 h' W3 s
- " ^* Q% g) [4 Q. n U9 p2 x; `- A
- #include <linux/module.h>
8 d/ q5 p% [( ]* b# c - #include <linux/init.h>( C8 i M( z) P
- #include <linux/errno.h>
# N o0 l, i/ @8 U - #include <linux/types.h>* O+ L7 @# e- x [5 o! M
- #include <linux/interrupt.h>
. j* m. S. }1 b, D% c0 Q/ z$ L - #include <asm/io.h>, [% G7 \8 f7 i0 }, E$ D( k1 J
- #include <linux/moduleparam.h>' u4 k7 w. l$ t1 C. q. b r$ S
- #include <linux/sysctl.h>9 t" U& ]7 K( w6 \- G
- #include <linux/mm.h>7 v" j/ b7 X, i0 F S+ Y
- #include <linux/dma-mapping.h>6 L$ \! H- j5 Q9 a
- 6 b G" k' h- T
- #include <mach/memory.h>2 S, N' D- {7 H1 I! |
- #include <mach/hardware.h>+ F- g3 W0 ]: |( n
- #include <mach/irqs.h>+ `( H6 I0 x. U( ~+ C( o0 s. f
- #include <asm/hardware/edma.h>
. D! u: e6 L% L4 e$ Y. T6 Q
- C& K5 I( j4 p9 t( e& O" m- #undef EDMA3_DEBUG
: q2 Z. S9 r) k& L# C0 f - /*#define EDMA3_DEBUG*/
z/ H& K$ r r2 D1 W4 D$ F
+ i4 O7 }6 @, [- #ifdef EDMA3_DEBUG1 z# X1 T4 X' D# M: B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) |2 @2 h0 J2 r; j+ g9 A4 B% l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 X4 [6 F! v0 h" O# x, z5 }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 g$ B X* J! _3 M3 F. k" g
- #else+ x7 l8 ?" V7 R p/ R: W# |4 r R
- #define DMA_PRINTK( x... )
, r0 j: V% c. K/ N) W n: _ - #define DMA_FN_IN6 V/ O& `$ o& m
- #define DMA_FN_OUT
6 q0 m( f2 s/ e2 Q5 g: z( j - #endif9 ?* F( a# ]- V% ^' R. M6 q8 i
# _- I9 V' w' v# y( N- #define MAX_DMA_TRANSFER_IN_BYTES (32768): o1 u; r% c" m9 `. w1 C" ^
- #define STATIC_SHIFT 3
7 [8 y1 B$ o8 m! K2 T/ E" }# _ - #define TCINTEN_SHIFT 20$ D& z( B! r+ d" L: r6 ?% ^
- #define ITCINTEN_SHIFT 21
( w7 K/ S k k3 s+ m - #define TCCHEN_SHIFT 227 S5 h& K/ { `6 J! A; H
- #define ITCCHEN_SHIFT 23 D1 i4 K. l: ~; Z
1 Q0 C4 K$ k. [2 |. }. E- static volatile int irqraised1 = 0;- V& Z: ?7 T# o' }% I7 B$ s! M
- static volatile int irqraised2 = 0;6 @3 E/ Y0 x9 _8 U
; d5 a0 H+ H2 G( q% G6 Z L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 W! [" N f( r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- b& u+ D- W5 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H: g8 [3 F# v2 W
- $ [+ P- S' L' j2 E; i' b+ s x
- dma_addr_t dmaphyssrc1 = 0;8 r2 M/ Z! o; n) u
- dma_addr_t dmaphyssrc2 = 0;3 L$ C# I% e, S6 M6 v
- dma_addr_t dmaphysdest1 = 0;6 C+ [- {& V2 q( y
- dma_addr_t dmaphysdest2 = 0;. l' R9 e) }# t# \, F' ?; G0 @
5 q9 r- i* e+ N W9 }) [- char *dmabufsrc1 = NULL;
H W0 d R G8 _ - char *dmabufsrc2 = NULL;, o1 s2 c9 |# P" H& Q' g2 B$ p& h
- char *dmabufdest1 = NULL;
, \/ N) U+ U I* z9 L( t - char *dmabufdest2 = NULL;
, a6 |+ E' n% ]* v# Z' ^( F: N- d
4 Q9 z! P) J# \- H: E. C- static int acnt = 512;( c' c4 K: V5 |8 D, J+ s
- static int bcnt = 8;1 O7 m/ s& H' C
- static int ccnt = 8;6 A8 O- \7 ~0 [4 O0 z
* K7 y" t' J6 {5 T) B1 d5 M- module_param(acnt, int, S_IRUGO);
! d& t; Y! U0 `; x1 b. J - module_param(bcnt, int, S_IRUGO);
2 `. j# c3 k( O: |5 L, G- v' _6 `# n& G% Q - module_param(ccnt, int, S_IRUGO);
复制代码 2 w5 R7 U. b$ g2 }; G+ Z, k1 e
+ Z2 Y9 A% L1 B: ]8 ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |( \( V7 u. u! ~/ }8 u2 z: ` i* ^8 b: o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, Z. }# h8 B# e5 g- u+ z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b4 z7 o: c- J1 g2 e' }
. I2 T. U0 G* {2 P2 o) c5 B6 y
3 l& O( P, A' J1 ^9 Y
|
|