|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- i1 g3 ]" R! t" N l( `6 F- [code]EDMA sample test application, ~! C$ O6 W4 j2 o
- /*
: {. a L R( f1 v - * edma_test.c5 O) c! A* R* D6 Z# w
- *' S3 y4 Y+ g7 U: X4 v) I3 T) Y1 f
- * brief EDMA3 Test Application
" _: I5 F# m* m) K - *
; G- `/ T+ Y9 [ - * This file contains EDMA3 Test code.( `: Q1 g; h2 Z% M+ `0 {7 }9 H
- *3 c3 J3 [" v( M( q$ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Q, f+ @. f. g* k: i, O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: z j& c$ ~4 J" Z) v% S - * TO CHANGE.! s! \- o6 ^+ ~
- *1 c3 x$ }( e* X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ S; Y) C7 p& b8 f! O2 [( `( C' N; p - *$ r g+ W0 n! m: J w# h' U
- * This program is free software; you can redistribute it and/or, h) e5 B2 T4 V- l9 f
- * modify it under the terms of the GNU General Public License as
" l' `$ B1 B5 F4 X - * published by the Free Software Foundation version 2.
) H" r- Q. @$ z/ a K$ w$ P - *0 `; v6 T& K) v) k% V4 B. p5 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 e+ u5 I: b% p6 e" Q - * kind, whether express or implied; without even the implied warranty
# t5 R2 v: Z; |/ `* m6 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ u3 I! h3 |* g - * GNU General Public License for more details.+ ]8 N+ o$ |( i( J3 \0 O
- */* Q7 @. @- p4 O0 S5 `# z
- 4 D2 D" O5 D; L, `
- #include <linux/module.h>
/ q' o% x8 l" v- V3 O4 Q8 W - #include <linux/init.h># d$ D5 H# ?, V% w
- #include <linux/errno.h>
7 x; m# ^3 I1 a! Z$ y0 N0 E - #include <linux/types.h>
: y' a+ u% ~! R! r# v1 o - #include <linux/interrupt.h>) p0 U9 O& S) X0 N) ~# w
- #include <asm/io.h>
: B" L% |: L- S+ B( x - #include <linux/moduleparam.h>
# b: ?, J' P( a8 O - #include <linux/sysctl.h>! B" v! [6 Q+ ^6 |4 R* ?3 }
- #include <linux/mm.h># r9 @/ [4 F; L5 m1 v% Y% L
- #include <linux/dma-mapping.h>
2 B3 z' [! J1 T% Y7 ~ - " i$ T* E. x6 J( ?0 a D
- #include <mach/memory.h>
* I2 c) q2 y( Q; D) _- B+ c/ H% I - #include <mach/hardware.h>
V. G4 o: l: W8 f - #include <mach/irqs.h>
0 C' e0 r4 x+ ^, W - #include <asm/hardware/edma.h>
+ ^0 R) j. V( J/ R" U5 w - : V# y: G T! w( G" L
- #undef EDMA3_DEBUG6 K+ d' S* T: a" N
- /*#define EDMA3_DEBUG*/
$ @) k, H5 k7 B* {7 ~( _4 K - 4 M9 w* y+ V. |5 Q+ C
- #ifdef EDMA3_DEBUG7 G8 ^2 R2 [ d& {6 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# l$ J0 R; J- c y& z( `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ X# r6 D: [# J" W: n L$ r; r# I& A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 u3 t8 Q" r4 p5 a i
- #else
: F7 u# r/ M% [5 k! E - #define DMA_PRINTK( x... )
8 E& `1 |6 @" @ - #define DMA_FN_IN+ _* i- W7 f, N$ y# h1 V! t
- #define DMA_FN_OUT
% C1 Y' y* F# f$ ^" Z - #endif4 h+ |, Q, m0 M3 K. P1 e2 _
- 0 `/ J" q; w" I# `; |) ^; D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( T- @; G& e' u - #define STATIC_SHIFT 3
2 M3 W: V$ |& }6 E4 ~ - #define TCINTEN_SHIFT 20
( f" S* ^ b! p - #define ITCINTEN_SHIFT 217 P4 N& y& }3 x) t: F% J9 y: u6 O
- #define TCCHEN_SHIFT 222 ^) G- K% Z" Y* [7 P6 h' h: W3 H
- #define ITCCHEN_SHIFT 23
, j( S! {1 X' h - * R( o9 x0 a/ U" C. E4 G" B
- static volatile int irqraised1 = 0;
$ V4 Y' w. |1 L, G - static volatile int irqraised2 = 0;
: z% v) j c6 U - ) t( y y' R" q- I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M; |+ w& N) b3 C, C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X" w" A, |7 l$ K) o5 d- o, e+ G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ]. i4 t% |4 H4 i5 z; g i5 h4 _
1 f1 B* V) n6 [- dma_addr_t dmaphyssrc1 = 0;) @' Z; ?0 c c* I% e2 l# C2 P
- dma_addr_t dmaphyssrc2 = 0;, B Q! d# H- Z& A0 }) {
- dma_addr_t dmaphysdest1 = 0;" e1 z8 v M5 X. v) b" x; O
- dma_addr_t dmaphysdest2 = 0;
8 ]* I& N$ ` S$ Z! @ - % |! ^( U2 Z6 E) m
- char *dmabufsrc1 = NULL;
! A$ `. Z9 B4 a+ ] - char *dmabufsrc2 = NULL;
5 s) z- h& c% H - char *dmabufdest1 = NULL;
: C/ {# S7 M& M - char *dmabufdest2 = NULL;
: q& R! p X. _' ^
$ h. G4 k! `" U* H+ s9 T- static int acnt = 512;
+ ]3 ^5 }8 n, o! `: g H - static int bcnt = 8;0 m2 K$ C1 a+ C- i$ b' m) R2 d
- static int ccnt = 8;
+ S* ~) L- ^4 |( n! A - 4 _3 u! ]' l3 w) i
- module_param(acnt, int, S_IRUGO);
! w& M# ^- w* X6 U - module_param(bcnt, int, S_IRUGO);' f, k3 y7 m t
- module_param(ccnt, int, S_IRUGO);
复制代码 " X% E& u. k/ Q; g, z5 |
: w# k) N+ [3 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Q5 Y u3 @' `# n& o5 P$ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B9 D t! S8 h8 \+ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" J4 E+ t% u# s3 w/ h% ?% l4 q4 q, e6 } | D: f
* T$ j) n( n" h7 A7 G
|
|