|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) t. j+ t6 _- r( a* i- [code]EDMA sample test application# k# d% d" w4 i2 p
- /** [. G" S9 Z# x: m: R, a% f2 ^; ?6 E
- * edma_test.c
4 g3 X7 }7 I1 R6 v! z - *1 a( j+ E( y- P) ^9 \" \
- * brief EDMA3 Test Application) p- T3 A6 J9 D# i8 o$ P: G
- *: L$ k. Z5 z- H9 ]7 L- L
- * This file contains EDMA3 Test code.- D- S8 L9 }- O6 ]; F: f9 [/ B
- *
$ t: |, {% g; D1 \2 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: N5 c& q) B. c) h1 H. I! L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c" N, ^4 p4 \+ J! l
- * TO CHANGE.) _' M2 N/ \& f9 Q3 \' r. E+ E
- *+ f+ B3 A V4 E: o! c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {) P' C0 B0 ^5 l8 F1 D+ [. |
- *; |: P4 i9 c {. I# Y w) _: g2 Z
- * This program is free software; you can redistribute it and/or
# ?$ n8 a- C* n0 z - * modify it under the terms of the GNU General Public License as
: R4 F/ V0 e6 [7 ^ - * published by the Free Software Foundation version 2.
- w: Q) f/ K9 i' e$ @ k' `$ m1 p- I - *
+ ]7 C9 g5 C1 r$ M0 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) a9 h; n0 u% G+ N5 e: I
- * kind, whether express or implied; without even the implied warranty! Y! e7 G) q/ L8 V, |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [$ Q2 P+ j) p& N3 R& t# B8 ^- K# B - * GNU General Public License for more details.5 j$ a$ s& {. o1 a! ?5 T
- */
! H/ B7 {0 `" V( ?$ P+ k, q+ u
' e. z4 G% B3 j6 K2 Y& z1 A" |- #include <linux/module.h>
: u7 Y) K( U+ w) b3 J5 ` - #include <linux/init.h>2 T% i5 I1 Y8 o
- #include <linux/errno.h>
& }6 _; w+ o% k - #include <linux/types.h>( Z7 S) m/ Z" J( Q6 i
- #include <linux/interrupt.h>
$ L" O6 M, Q: e' s - #include <asm/io.h>
5 w2 b/ N0 N3 W0 L! L9 q - #include <linux/moduleparam.h>
2 q2 F' z( X; F t- F' i - #include <linux/sysctl.h>
' [: }5 b H' c - #include <linux/mm.h>, f! e z- h" z" _6 S# u# U, U9 _
- #include <linux/dma-mapping.h>* {% x+ ^7 g7 [& V: L$ t' G
) J j, |& Q# P+ a- #include <mach/memory.h>. e! K. S: T6 ?
- #include <mach/hardware.h>
1 U( s! Y8 b. B( q/ O! Y - #include <mach/irqs.h>
' s& J0 z) l1 `8 C6 G6 g: p - #include <asm/hardware/edma.h>9 c2 B5 N* `. Y* v& f* R
- , h0 L: p' A( {8 K- B& P$ v9 m
- #undef EDMA3_DEBUG
0 ?) Z0 A8 ]7 s% d: G - /*#define EDMA3_DEBUG*/" z$ R5 n4 q" U, `/ _8 P
- ) h4 k" H% c% T- b/ C4 T7 S
- #ifdef EDMA3_DEBUG
& x; g( K K9 t: c7 C( X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& [" D$ d+ i/ X4 T/ m8 A% E } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i3 g0 I4 I m' _4 I0 Z1 ^& G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U" T" h# N% @2 K: I- S( X
- #else
, B9 G% K4 |: T. n1 r1 i - #define DMA_PRINTK( x... )
5 u- R, |& c: K+ ~! r3 u5 I5 e5 Y - #define DMA_FN_IN
+ ?$ N0 j& @+ ?& g" P, @6 Y - #define DMA_FN_OUT
/ S0 m5 B4 p* I" Z- ?+ o- A" V( _ - #endif6 d/ D( G4 w& Q* x
- + y# g, X# m4 v5 }( z- [/ O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" R; [2 t3 m+ P4 j - #define STATIC_SHIFT 38 J' j7 ?2 c! e& f# b3 p
- #define TCINTEN_SHIFT 20
* M3 @: D. b. b/ ] - #define ITCINTEN_SHIFT 21
2 D0 ]; D L% `" c* G1 z1 ^ \ - #define TCCHEN_SHIFT 22" r& z5 X; D, a8 t, k" I$ T
- #define ITCCHEN_SHIFT 23
6 e9 h8 w) ^+ s- `+ Y - 6 S4 c' c" a3 T1 i" y
- static volatile int irqraised1 = 0;
$ O0 s4 I% C5 C) ]! v' Y3 J! S - static volatile int irqraised2 = 0;$ t+ P& ? D/ N
- $ R( R6 ]4 _: j; M) N% s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t+ T7 m/ j/ `5 p4 N3 d* ~& v/ `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# g# u, K6 i1 l' ~% H8 e! {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I3 X" b: H1 G: [* S) [7 q* C
+ Q( B$ b0 T8 I1 Q7 k+ h6 h- dma_addr_t dmaphyssrc1 = 0;
/ S' x: o, _2 o, J. ]; q- W - dma_addr_t dmaphyssrc2 = 0;9 _# O7 N3 r0 M' Y8 A5 [
- dma_addr_t dmaphysdest1 = 0;
! r2 \: K* G6 t - dma_addr_t dmaphysdest2 = 0;' K |! h0 B' ?1 P$ j( z& X
- / u7 Y8 j( X+ @ V' u/ m
- char *dmabufsrc1 = NULL;* [/ R o: B4 P2 O7 h, {7 v
- char *dmabufsrc2 = NULL;' g# l+ [6 @5 D$ ~/ \
- char *dmabufdest1 = NULL;
A( G+ X1 l1 y. ^3 L2 ?5 g - char *dmabufdest2 = NULL;2 |; @& x6 Q' y U) k
- [* V" R0 I; }7 X
- static int acnt = 512;
& ]3 ?8 Q4 Y& [/ j - static int bcnt = 8;
8 A6 E7 X: t3 ?! C! I - static int ccnt = 8;+ }; Q* ~. g" b, p( r1 G
- 1 z% K' F2 e' l0 h! m# m$ P$ E
- module_param(acnt, int, S_IRUGO);
5 [ q3 H4 w& h% D - module_param(bcnt, int, S_IRUGO);8 [0 ^% C1 T$ G( }6 t. M
- module_param(ccnt, int, S_IRUGO);
复制代码 % T7 g) f2 n0 z' U. _% r; D
5 S7 L" z- X: s7 |. p& U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. y' S1 d% X0 _* z, K l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Y1 F- e6 x7 g. I9 ]( E) Z* e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- [' G" p" r# W! y
2 [. y' w" w* s6 O" @& I6 z; r3 v) f) q, Y! p
|
|