|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) [0 J8 y5 q3 `0 V$ X* {. o- [code]EDMA sample test application
) l7 }0 B5 S# G. `. S - /*
7 U+ B# p! h" I+ u% V" ] - * edma_test.c
8 `- o9 v9 g9 p) R - *, h. U, t. l% Y( w. e; r+ g
- * brief EDMA3 Test Application/ z/ P; L) T# D5 c1 H- ?+ a
- *2 t3 R/ e, s k0 Z2 U( M8 {. P3 H
- * This file contains EDMA3 Test code.
$ \8 u# Q+ t5 d& [ - *
2 G) b- @# ^+ w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* s- W# X% S' A7 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; E) F0 e4 d% o3 M; c+ X1 F/ }( U, } - * TO CHANGE.! E2 I1 {9 N% w0 _
- *
6 d/ J1 K$ U) O2 `) r$ X4 \; \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e- I2 X& B8 b5 \9 u" B
- *# ?6 I: D u7 U3 E% O' N
- * This program is free software; you can redistribute it and/or
* ?- I. M- z w: b o) u. Y) P - * modify it under the terms of the GNU General Public License as# H+ n9 s. i# a
- * published by the Free Software Foundation version 2.4 e6 k: {+ W0 f! l
- *+ ~9 O p! t7 p) \1 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W4 J2 M# e; z6 w$ {0 u& _3 Q0 m/ }
- * kind, whether express or implied; without even the implied warranty) W( y* z4 u1 L) P1 |4 E1 c4 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% i$ j) f$ I0 X' L/ T* W
- * GNU General Public License for more details.0 d3 q5 c& t; L9 L. _8 X ^
- */' r9 |0 C! n. a0 _1 ]
- % V: }' t! x V5 `5 l/ y
- #include <linux/module.h>
5 t8 k% V R/ r2 g - #include <linux/init.h>
6 q3 b1 E: S( `$ W - #include <linux/errno.h>1 O1 q6 a( `) c- i3 y3 j
- #include <linux/types.h>3 t4 N R- m& o8 w
- #include <linux/interrupt.h>8 F m$ _# M9 h8 T+ v K: @, X. |9 N1 W
- #include <asm/io.h># D# C* y6 j7 r3 V6 F; L
- #include <linux/moduleparam.h>
7 _6 |3 v8 u9 {! R8 ?9 A - #include <linux/sysctl.h>2 t' f' y# R- H
- #include <linux/mm.h>
& P+ q5 J9 v; G6 C+ x9 ~3 L - #include <linux/dma-mapping.h>$ ?7 l& V7 J) V$ P3 a2 T r
- ' A" \: I X: s0 {7 b3 j
- #include <mach/memory.h>
5 Z2 X F1 R' H6 Y# s; m. ?/ A - #include <mach/hardware.h>
1 V$ G V* V) n3 L1 z' T - #include <mach/irqs.h>4 Q' i+ f" Z8 X) E7 L' Z
- #include <asm/hardware/edma.h>
) P8 V- I( g0 {( u
: C$ R, p2 N3 H+ `- #undef EDMA3_DEBUG) j0 N+ T- k! E% z
- /*#define EDMA3_DEBUG*/
2 Z+ D, B" k5 S: t" n - 3 A2 P v. G" {" T! m0 b' S
- #ifdef EDMA3_DEBUG# A* n s0 d7 @1 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V: _/ e& ?1 e- z1 y8 D, z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 A- }% u. F y0 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 w4 d$ }1 u) y1 ~. ^
- #else5 T# e1 d7 R- N8 Q
- #define DMA_PRINTK( x... )
6 d) M! ?6 y* n2 V4 \' q1 j - #define DMA_FN_IN
6 V) o6 s* R l - #define DMA_FN_OUT
' j' _/ n4 `8 V1 K! i - #endif
( T) B* B7 X w/ x) ^8 V& D# l - ) K7 {* [9 y+ f, g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! g* `4 N' q8 V3 _
- #define STATIC_SHIFT 3
. q9 c" ^3 O" B4 w2 R - #define TCINTEN_SHIFT 206 f; `8 W/ V0 I
- #define ITCINTEN_SHIFT 21% q% f, K2 f2 Y4 u1 J4 n8 ]6 c/ y
- #define TCCHEN_SHIFT 22
% E4 i5 ^, g0 d; U, |" I0 K6 a - #define ITCCHEN_SHIFT 23
2 O* l0 M/ z) H/ C5 x0 i+ A0 D9 i# ~
. U1 Y; U& `: r% x+ e& ?0 N) L- static volatile int irqraised1 = 0;
" E& j% j) z1 z9 a; l4 _ K - static volatile int irqraised2 = 0;! d" C, w0 b& s; P3 B& V
4 E0 c7 z& i4 f( g3 J9 ~- S2 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# l# w. m- w) b) Z5 g* }6 R ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& \: F3 n Q. Q( d7 f" W$ o$ X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c6 l" [1 c) x7 z+ \) Y
9 q% e6 n4 I; p9 o }0 T- dma_addr_t dmaphyssrc1 = 0;
8 [! [- [4 D- M) ` - dma_addr_t dmaphyssrc2 = 0;2 V: t9 g d9 _
- dma_addr_t dmaphysdest1 = 0;; ^- E& [1 L0 h# ?* d
- dma_addr_t dmaphysdest2 = 0;& O5 A* C! F& Q3 c- R
- ' b" S! r ^0 v+ C/ p
- char *dmabufsrc1 = NULL;
! ] r+ F/ P$ J4 \! p; U - char *dmabufsrc2 = NULL;
- b5 W! t! \# I# s - char *dmabufdest1 = NULL;+ w! l8 K) F, }# E( M$ F3 n' [/ p+ f
- char *dmabufdest2 = NULL;
( J9 B% u7 N6 D- C3 O
$ k J$ }6 L4 z; G" e- j1 `/ c- static int acnt = 512;5 b" w. E0 W; W7 T8 `
- static int bcnt = 8;
/ p+ d9 r- T: W$ L" y' A - static int ccnt = 8;
0 E6 J0 _! o- c7 {; H
, ?5 |+ _4 ^% R1 k- module_param(acnt, int, S_IRUGO);
5 d* f9 U2 Z: l( u - module_param(bcnt, int, S_IRUGO);! B8 u4 ?& c2 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
- O5 i4 @& ?7 [/ d) H. H; l( M$ M2 Y" [: M) D1 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C: b2 g$ @' g* x8 x& ~& |2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! c+ H5 {8 |, \7 ~- C/ R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. G+ O- r; F! \5 N) \5 Z- ?
$ ?, x; m( _& ^( w; p$ s5 y* C( R% B4 P3 Z/ G1 M
|
|