|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \$ A6 `9 `8 P, }+ E0 E- h9 r' M- [code]EDMA sample test application
8 r) m5 ~" `$ ~! B - /*
5 O( G+ _* q4 W" E6 O - * edma_test.c
5 e8 B( l" A6 c, P7 } - *
9 L: Q3 m9 C C: U8 t% e1 |2 } - * brief EDMA3 Test Application
+ D6 D2 w0 F+ j: R S - *
% O- r1 S5 H3 f; j - * This file contains EDMA3 Test code.! b1 v8 A. H/ c1 ?$ C
- *1 y; @. S. T1 `4 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 X6 ?3 y8 i! L- ?$ l; O9 K( y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 M0 a3 g+ n0 A+ ^# E; p - * TO CHANGE.
; l, m/ W; I0 z0 Q) \: Z1 L - *. j5 h# Q' q1 S" _' y4 N4 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% y0 Z& V! b& b! Z - *! T; Z: C( x( K1 X
- * This program is free software; you can redistribute it and/or5 v- w. z5 @% J) I$ | `
- * modify it under the terms of the GNU General Public License as+ U/ r7 i5 I4 F. g
- * published by the Free Software Foundation version 2.; E' r, T9 v& ~8 n
- *( l1 P; ^* z d0 D7 u" Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& L- ?* R g0 M1 d- R
- * kind, whether express or implied; without even the implied warranty
0 I# |& w* M: o' V0 F6 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 M$ C( n6 i7 d
- * GNU General Public License for more details.
) F+ U) d3 h3 K5 t! |$ s - */4 T2 D2 {1 ]4 e% v* p
- 0 d; E) m K( l! l+ p1 M
- #include <linux/module.h>& k, T- ^: i `- p
- #include <linux/init.h>
' x- `. Y0 L7 n+ J - #include <linux/errno.h> s/ s8 P2 y+ x- F( ?5 E3 a9 ^5 S0 F) f
- #include <linux/types.h>- y) b3 |) M0 ^
- #include <linux/interrupt.h>
+ [' V6 h9 ]% W& ] - #include <asm/io.h>
& P3 L2 z* X: G - #include <linux/moduleparam.h>
; w) y9 d. ?7 t( K$ C5 b - #include <linux/sysctl.h>
- t1 K9 _6 X) d6 O V; l - #include <linux/mm.h>" p- n/ A3 j) Z) o/ {+ T
- #include <linux/dma-mapping.h>$ Y2 a7 \( z5 n
- 5 e( O. F7 n3 u' L- A
- #include <mach/memory.h>
, o% F8 G A1 }+ d- j2 x1 w - #include <mach/hardware.h>! |& }# J) C& P( s8 j/ k% _
- #include <mach/irqs.h># O1 V' H: N4 a
- #include <asm/hardware/edma.h>
; H$ u1 t4 F# {1 y, z
0 v8 Z# q" m3 U1 A* Z- #undef EDMA3_DEBUG
x" `6 h. a% `4 F7 |/ T8 E# ^' n - /*#define EDMA3_DEBUG*/
. t1 c& A5 I A0 S' i# x5 C7 @ - 6 ^/ r* h* J" ~6 L2 D" G# n% Z
- #ifdef EDMA3_DEBUG% I& F' G# {6 r2 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
v. Q6 I) s( x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); N! t/ W( h( u1 g6 O! I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ `* i5 B' A( A9 ]7 r+ Z5 R
- #else
! m* k# x/ ~; ~# A/ l - #define DMA_PRINTK( x... )
; Z7 i% v [) l7 v" |6 @* M - #define DMA_FN_IN
$ o3 K' b1 t$ j% l; w - #define DMA_FN_OUT0 o7 s" v3 _6 |0 {
- #endif
6 L. u1 o" ?- s
, \4 j7 L9 n7 F0 ^# C* U# J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 s. \- D4 P3 e# c9 s
- #define STATIC_SHIFT 3
* z! X- J" {! j" w1 q% ?& M - #define TCINTEN_SHIFT 20% w$ n; \2 ]9 [# z0 P& u0 } f+ {
- #define ITCINTEN_SHIFT 210 x+ G- A" b) |, _
- #define TCCHEN_SHIFT 224 I4 U4 _) q2 Q$ M% W- Y' o- C
- #define ITCCHEN_SHIFT 23. h" i' T2 G G& c$ G: x7 d
- ! M5 }; p/ t& ?
- static volatile int irqraised1 = 0;. G! c& p% P0 o: y% H# q; D
- static volatile int irqraised2 = 0;
- }" b! w G, X: e' a5 a0 L$ x, q - 2 c1 B8 x2 x& i- H$ \" {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[. a; L8 g8 n4 S, W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: e& ~9 \: }) {6 j0 Q& C+ h7 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z4 w+ z/ Y9 _% F
- , Z! D( @: ~+ g, b# T/ x5 |0 B
- dma_addr_t dmaphyssrc1 = 0;
$ @# r+ z+ Q: o- A6 ]- y - dma_addr_t dmaphyssrc2 = 0;
7 Y5 b# p* M: d - dma_addr_t dmaphysdest1 = 0;" o( H7 E* e' ?
- dma_addr_t dmaphysdest2 = 0;& [) u. `! u/ f7 a& O+ t
1 [! T' G0 s) r! u- char *dmabufsrc1 = NULL;* }2 Y4 M* U) [
- char *dmabufsrc2 = NULL;2 j0 P$ W' o2 e3 Q9 G9 c
- char *dmabufdest1 = NULL;" z$ g; D2 A& s/ f
- char *dmabufdest2 = NULL;- Z: `; |- v& x$ X
- 3 b( ~6 E' j/ p
- static int acnt = 512;* H# g4 F+ ]6 [; L4 Q/ n0 l
- static int bcnt = 8;. f# n" R+ i& w8 z, f
- static int ccnt = 8;
' g( a2 E/ o6 K. y, _7 v
2 y& V" J% Y7 S, b' x- module_param(acnt, int, S_IRUGO);6 n4 A% t2 S2 D( ~) m( E4 i A
- module_param(bcnt, int, S_IRUGO);
3 ?# {1 @2 E* B! E - module_param(ccnt, int, S_IRUGO);
复制代码 - `( N3 {; z! E! w8 E% R4 ~
* W4 u7 l# C. Y$ p- p$ _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 k q0 Y9 J# x% H# Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! q. i0 E0 q! q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- ?3 E* i! r" `3 i J' T1 e5 }2 u0 m" q" b4 Y7 Y
" d' r8 I/ X9 F* \; C# q# X |
|