|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 o% z! L1 H4 {, M) Z- [code]EDMA sample test application" M$ G4 ^ S+ b q! D$ J
- /*: W6 r6 I x8 U5 g+ A5 G
- * edma_test.c1 h- g9 C6 o8 Z4 {1 j6 f m: u
- *# ^0 b1 L. g9 ?" w; ?6 k2 a
- * brief EDMA3 Test Application
; z' ~! r( a- P- m3 y+ c1 R' S6 J& v - *) g2 [ N* C, _5 L" R% X8 _, a
- * This file contains EDMA3 Test code.
" d- ]5 I! {; O+ @ - *
/ D; M0 D# Q$ O2 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ~7 h9 B+ d0 P* V( e! S1 P/ A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 T, c/ ^$ s8 f3 R( x& e8 n - * TO CHANGE.7 D2 q A$ p+ l! ~
- *4 z* p3 F9 g4 }7 e2 o! t5 q# L' D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Z# Q- I9 N& E - *1 s1 f6 j" I2 ~* P
- * This program is free software; you can redistribute it and/or+ u* ?8 `9 @# r5 Z6 M) U
- * modify it under the terms of the GNU General Public License as
* e; n$ C% _/ j" H - * published by the Free Software Foundation version 2.0 @/ R% L' t) i3 H
- *
3 V, ^. j: ~+ o l, Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" z1 p% p* _3 f9 l' `- g- _
- * kind, whether express or implied; without even the implied warranty" n5 \( t7 |* @3 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# J7 q. l! S' t% L
- * GNU General Public License for more details.8 s# C$ Y3 Y6 G' n% H& A4 {
- */
' B9 _# _3 P. M
4 q( g* i) f0 V) |+ [& c- #include <linux/module.h>
) N) B ?9 E% s7 [; G: G/ e - #include <linux/init.h>
! O1 v+ Q K8 I! E+ D4 h4 o! T) n - #include <linux/errno.h>
! {8 `) n" `8 u/ B3 I' [. F - #include <linux/types.h>
" b8 X0 o! O$ F - #include <linux/interrupt.h>; B9 [' C( n5 ~8 Y- U
- #include <asm/io.h>
& W- |2 E9 L7 n2 p, c, t3 i; ^ - #include <linux/moduleparam.h>
- {/ r5 _4 F) C. b3 P2 b - #include <linux/sysctl.h>
) ?* u) O. q! F& m; {1 f - #include <linux/mm.h>
4 u6 F7 C# y! ~! ~! D - #include <linux/dma-mapping.h>
! K, R2 s! P" f& U4 _4 \ - $ l) D6 M; o/ j+ [
- #include <mach/memory.h>* g L- m& c7 N; b' H4 J
- #include <mach/hardware.h>1 a7 N+ |* k. X0 e/ L
- #include <mach/irqs.h>$ R2 D( C) c% _1 Z. V1 f, _0 v
- #include <asm/hardware/edma.h>
; @1 U8 h2 }: Q) h - - G# `# n) a+ w" `9 c7 g6 G- X
- #undef EDMA3_DEBUG
( _8 i: n+ u( l. l# m - /*#define EDMA3_DEBUG*/7 B i: d' d3 m0 K, P1 G
- 8 y, ~$ C' u. P) p
- #ifdef EDMA3_DEBUG& p+ R I& }$ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( W' H; f# o i6 H; |* l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ h3 w7 [1 s! d. k* h: X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U6 R0 y1 u) t x - #else2 Z9 E% L4 c, ^
- #define DMA_PRINTK( x... )0 p$ O9 O4 R" P- K! N
- #define DMA_FN_IN G4 o- Z- v6 g% a8 i. a# `
- #define DMA_FN_OUT
, Q" D# _3 n" |( Q4 z% x$ S" \ - #endif
4 m9 a: `3 q4 x6 j9 {/ p. O' \
7 j2 V9 N! b# ?% L( J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& e% b0 u0 G- o8 Y9 `7 H
- #define STATIC_SHIFT 3* P6 }, k/ W& \' |/ }/ L: }
- #define TCINTEN_SHIFT 20
; w0 S: Q$ J" m. t; S - #define ITCINTEN_SHIFT 21
6 a! ^0 c- ^. O' |4 W2 G8 x - #define TCCHEN_SHIFT 22. W- m7 _* r! M. i
- #define ITCCHEN_SHIFT 23$ L4 f( C, O! }; c; ~1 X; }7 V8 Y( {
8 _ j- o+ _: F- Z/ K7 _- static volatile int irqraised1 = 0;0 N* f2 w5 @$ a$ r
- static volatile int irqraised2 = 0;$ H, q# Z0 w9 P- E/ Y
- ( f) y E( ?8 l3 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _: F; c8 m4 N. F9 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T, w, W+ s. B2 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( X$ ]; H, i" K
+ `$ T/ H& g+ b# R# O3 g- dma_addr_t dmaphyssrc1 = 0;
& h5 P* w1 {/ e: c, r/ D - dma_addr_t dmaphyssrc2 = 0;8 ^9 g7 i5 m4 T" Y" K) p
- dma_addr_t dmaphysdest1 = 0;
4 B1 h/ H4 j. f Q - dma_addr_t dmaphysdest2 = 0;2 Q5 s$ L; Y# X+ z# I3 \
4 Z) b. N8 C5 e. B" P- char *dmabufsrc1 = NULL;
h& e# B4 G% \& P/ P8 A, ]% G3 w - char *dmabufsrc2 = NULL;
3 t" _; t% U/ b3 ?, u - char *dmabufdest1 = NULL;
+ {- h0 Y' T ^6 |- q) d. X - char *dmabufdest2 = NULL;
Y, O! o: ?, f2 C2 F- h - + |4 y4 f2 m5 `; ~; m' U2 t3 n
- static int acnt = 512;; Q w1 S9 w- P \. ]3 o2 h
- static int bcnt = 8; Y9 ^0 A9 J# M5 T7 J
- static int ccnt = 8;0 ^9 K. q U- B; y7 V
5 J0 P7 g: m) n/ k- module_param(acnt, int, S_IRUGO);7 p2 ^9 r4 N$ t5 B
- module_param(bcnt, int, S_IRUGO);) B2 _) K- ^/ ^
- module_param(ccnt, int, S_IRUGO);
复制代码
0 b' m* u9 @* z0 f O: b; c3 ~6 u. I4 Z- A' Y/ X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ o$ y5 l( I7 M6 _' Q) {4 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, [+ C0 u u- A6 C O* n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ F8 M2 `" y( D" C6 e$ B$ F" B! k" o6 u; Z* H' i2 Z
& O0 j" u/ N# v9 Q% D0 `
|
|