|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + j) u6 P6 c% @! R( D
- [code]EDMA sample test application
! c( A F R6 J+ ^ - /*9 d# b, R" x6 B6 A% D; J& W: y
- * edma_test.c
) S3 k/ ]' ^: f - *
( r# ]( X m d$ {1 Z5 a" E - * brief EDMA3 Test Application
/ R" {$ t7 g& j2 I8 y8 i6 G - *
# u/ G( T% H/ ^: j - * This file contains EDMA3 Test code./ R, d" C* w9 F* Q4 \, o
- *' {( R' Q7 m( @% q3 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- W! W. r4 x- q$ s! z( r( W; u/ ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 _7 G" b" c7 s3 l, n# F
- * TO CHANGE.2 ]" m& U5 S8 Y. | O+ M
- *
$ F; i7 D% Y3 M- s! }- \! C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 I! j n7 k: r4 ` C, ^, V - *
/ T k/ v8 G: S! b: P5 @0 L - * This program is free software; you can redistribute it and/or/ S# }: F( v0 k
- * modify it under the terms of the GNU General Public License as
; e6 K8 ~; Y8 ?) A& f7 t - * published by the Free Software Foundation version 2.) _0 `2 p i+ K% z7 c& w; T9 c1 A. F0 y
- *
* x' y2 M- k+ a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; B1 {# I( o6 `& f1 w - * kind, whether express or implied; without even the implied warranty
7 O+ X) ]9 y7 W7 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 U4 o! s" X3 G- Y; L- x - * GNU General Public License for more details.
/ c# y) B" K# u - */" q( O3 q N" Y1 M% \) f( P
- . p) N3 Y& G! u$ ?
- #include <linux/module.h>
/ h. T- S' J- k$ A! A: k. g" [# I - #include <linux/init.h>! Q: |2 \. _/ S! H
- #include <linux/errno.h>, R; e! g: A% @3 P5 v
- #include <linux/types.h>
6 o9 Y2 B& y1 a2 S - #include <linux/interrupt.h>
8 p' V$ ^, o4 [8 @ - #include <asm/io.h>
7 E. P, `+ \7 i - #include <linux/moduleparam.h>5 |6 f7 \& C! R
- #include <linux/sysctl.h> i1 P; z7 h. a, z3 l! C
- #include <linux/mm.h>. m* B0 i) b& b4 q' z
- #include <linux/dma-mapping.h>
- _# b7 K1 S1 i2 C - 0 j5 b% ^6 d: b) u" a- T: I
- #include <mach/memory.h>. W9 G' z! |) w5 ^$ W
- #include <mach/hardware.h>/ W! ?+ l) u- O
- #include <mach/irqs.h>
u8 h* c$ {" h; H, | - #include <asm/hardware/edma.h> q. ?( u3 t" d
- ' [1 i$ @8 r4 H( z3 s
- #undef EDMA3_DEBUG6 C, o7 f; x" r" C0 X: h
- /*#define EDMA3_DEBUG*/; `* R( S( T S' c) G
- 0 H' i( Z- @6 L
- #ifdef EDMA3_DEBUG
) |3 X/ S( O) T* g- c0 Q A, ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& W$ d9 I7 u8 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ]1 l8 d; j. P% L: V `3 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' x1 r' o8 x( Z8 E& ]
- #else
2 O" C( ]2 _( W7 r - #define DMA_PRINTK( x... )- b0 m) o4 k9 J: @& F
- #define DMA_FN_IN
8 Q& x2 u A3 x+ ~/ G" t1 a) M - #define DMA_FN_OUT% o f; E' V7 e6 |" {
- #endif
# s. V: g) ?6 p - ( L7 N$ N$ c2 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 @; n' Q1 l, `( T4 ^! p+ ^ - #define STATIC_SHIFT 35 |& Z: `- m& L- J2 R9 r
- #define TCINTEN_SHIFT 20
9 k2 D C( u6 ?1 Q - #define ITCINTEN_SHIFT 21
& W$ S" Y4 H* v6 P | - #define TCCHEN_SHIFT 22( A' k( M/ c) O" G
- #define ITCCHEN_SHIFT 23/ o5 w' z& ]9 T5 n$ R
- 3 K, Z! J |: c4 u0 T* n9 e* R8 L
- static volatile int irqraised1 = 0;
! `$ k# L& |- n9 r M- ~ - static volatile int irqraised2 = 0;
) [: F: G. }( }& \+ \ - 2 C% j: q% @3 d. H" Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R9 X4 m9 s# S) n5 A/ S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, I$ k. U( |, M" o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ [+ E) D* ]) _# C7 i
- 5 {) k. ~( c0 H* G( O# g
- dma_addr_t dmaphyssrc1 = 0;
; N9 g2 E/ [' K- F# [$ H) X - dma_addr_t dmaphyssrc2 = 0;& h! w/ Q. ^! D# D1 L, h
- dma_addr_t dmaphysdest1 = 0;
/ W) L+ P% n# ^ - dma_addr_t dmaphysdest2 = 0;* ?0 U5 u: U7 C0 _, o0 q5 }0 x6 d# W
- % }0 n. Q8 E# R5 ]1 L
- char *dmabufsrc1 = NULL;) j+ x+ R( G- p. `2 X- g
- char *dmabufsrc2 = NULL;
: v, \# w$ Q0 M& g. h6 Y - char *dmabufdest1 = NULL;# {8 N5 f: m" }- E
- char *dmabufdest2 = NULL;
$ R$ O* ~9 }2 }) t
0 t* w0 r- B+ ]) ]. F$ q- static int acnt = 512;( l% p& H2 N" p6 g6 q: R, Z
- static int bcnt = 8;
[% J7 U! y: ` x4 k& a* a4 v2 D - static int ccnt = 8;
$ `' i3 u3 l7 N0 @- b
% e" p0 T+ e- f2 _) D' q" P- J- module_param(acnt, int, S_IRUGO);
; Y) g) _) ~* F$ ^! m1 V - module_param(bcnt, int, S_IRUGO);! ^1 e$ F, j6 l8 C8 \7 @5 ?
- module_param(ccnt, int, S_IRUGO);
复制代码 8 |* }& s; y; s% F) @: ~
9 Q+ _$ r" T8 H) d* M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# v3 u m& n ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- `5 y" i1 d3 U- q$ g( W7 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, [/ f2 @3 } I$ o1 X8 I) X
( B4 i+ J" d1 @. G9 a" q8 F) m# K3 \8 |% |9 ^
|
|