|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @3 f! I& o) E- g
- [code]EDMA sample test application
$ ^9 D5 Y# \# ]. u: p- S - /*, p" K- s5 x% j1 _& K1 X$ `8 s
- * edma_test.c
5 i6 ^7 X! U2 V) b7 k: R - *
0 X6 b9 L2 Y ~ - * brief EDMA3 Test Application
0 f _ W+ k6 W- g* F1 ]3 r1 H - *0 B+ y; ?- A8 M, g, y P
- * This file contains EDMA3 Test code.
7 g0 o% S3 Z: U, p1 O - *4 z1 Y4 i" _; ~1 t$ s5 Y0 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: H2 z" v; x; [" Y0 r9 }1 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- |5 B& K+ i3 k1 x( x - * TO CHANGE.
# K8 [) v) e0 X, b - *
8 g# v8 R$ `$ |; U- H2 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 c0 e4 c* {' W& O: j
- *. q& o/ o! X5 ^- p6 T) W2 J
- * This program is free software; you can redistribute it and/or
. Y. e. O3 b: F0 L( U+ I& S - * modify it under the terms of the GNU General Public License as& ~# u$ v- Q5 \
- * published by the Free Software Foundation version 2.- `- c) P! _% o' D' ]3 a2 \% h
- *
( }! E- \" h6 T+ P A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ {9 ~5 p+ }1 O) w# ^9 _3 ~) ], ] - * kind, whether express or implied; without even the implied warranty
0 t4 I6 N1 P! b: J: G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 p ^ E# A* q
- * GNU General Public License for more details.2 A$ v& l' Y+ j$ r
- */' }9 Z! G1 X: o/ m, R
2 C1 `" `$ T" q& ]- #include <linux/module.h>
/ S6 |; ?8 y. L6 ^7 l( m c( w - #include <linux/init.h>
+ I( F! k( `- W - #include <linux/errno.h>
% A- q, t7 x/ u5 t/ b7 K$ [ - #include <linux/types.h>) ~- T7 ^/ e$ r1 [
- #include <linux/interrupt.h>2 d- Q2 w: g7 X& e
- #include <asm/io.h>, X0 X9 j" `% H0 w' N( m
- #include <linux/moduleparam.h>" X/ r5 K0 ? l9 A
- #include <linux/sysctl.h>
! d" I4 }+ s- ^: w4 j5 n - #include <linux/mm.h>
0 O9 L: D6 ~5 z/ E" U( h( k - #include <linux/dma-mapping.h>1 o1 U! C- w+ Z: t& o! F
6 ?5 d* F, ]3 H" c% v- r5 r5 M- #include <mach/memory.h>
$ I" {( Z7 C3 y0 r, L - #include <mach/hardware.h>
" e' y6 i W" t1 t - #include <mach/irqs.h>
: b6 p0 y. {1 V: ~. b3 m- i - #include <asm/hardware/edma.h>, s: V& | Z K; m) m1 @
. f/ F! O3 t( N3 d- #undef EDMA3_DEBUG ]9 l; w" w0 x2 |7 S" X( F+ Q
- /*#define EDMA3_DEBUG*/% m0 E" V& H, u) w
: L" X- ~7 p4 s4 b- #ifdef EDMA3_DEBUG
: ?' i2 r! ~; M" T7 s2 h# J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) }) }9 m2 C! P( { N; S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, t8 Y0 U; Y# o- I3 ?. U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ k5 w8 ? w U- n - #else
e/ K$ t$ M* o( O Q* M6 q - #define DMA_PRINTK( x... )7 b& k& i& f4 `* f7 Z- Q
- #define DMA_FN_IN0 y( ~( \0 j! N' I' f, ?+ |9 B
- #define DMA_FN_OUT
; ^1 k/ @! F% @6 b! p# y - #endif
0 j+ K& P& E( k& ^/ ?& @ - ' B7 k+ [; B2 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% n0 \3 \ P7 v6 w4 |) v
- #define STATIC_SHIFT 34 I2 S" _9 n7 Q- z8 Q
- #define TCINTEN_SHIFT 20
, `+ W; O! D/ t4 \* { - #define ITCINTEN_SHIFT 21
! O3 t& b" D5 g - #define TCCHEN_SHIFT 22
" l$ [7 u- o* R6 W - #define ITCCHEN_SHIFT 23
9 s3 X8 _- R* o; W
$ J( t+ p6 \4 p# ^( H+ S6 d- static volatile int irqraised1 = 0;
! | ^. G7 E7 Y# k# U, V. ]$ |1 u! Q - static volatile int irqraised2 = 0;) U! [! i7 N q' Y+ F6 G2 }
$ V5 s5 {- U& N+ K- L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H! v! `+ s1 \1 p; P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J) r1 G: L O2 Y! W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D5 v/ |' K1 I. ?' d* e' Z
- / y* e/ @6 i; |2 z% Z, v" ~. ^
- dma_addr_t dmaphyssrc1 = 0;5 W. y# `' g/ t
- dma_addr_t dmaphyssrc2 = 0;: G) n1 Q7 X& t
- dma_addr_t dmaphysdest1 = 0;- m* x8 w( y, q+ b% a4 ?
- dma_addr_t dmaphysdest2 = 0;- G4 _8 {; U& V+ C6 G9 \4 E
( D+ k+ \0 x6 z. c* i# i0 [0 E- char *dmabufsrc1 = NULL;
8 e6 E6 o" K9 k! ]( L - char *dmabufsrc2 = NULL;3 k6 H5 m) h9 D, @; u' d2 H8 j* V3 G
- char *dmabufdest1 = NULL;
4 m7 ?; L2 D- G5 R) E: \ - char *dmabufdest2 = NULL;
! a, q7 j" d, m. f- E( a6 x4 K
' R' S% r$ x! o+ ` j6 K- static int acnt = 512;
' p' P* e0 M! z* d: {0 D4 O - static int bcnt = 8;
3 S/ |! v. z6 } - static int ccnt = 8;
, @. \; F9 g' P! O& Q( q8 j7 l) B
- u' A3 D% q8 x( q1 @7 `' a- module_param(acnt, int, S_IRUGO);
/ K' k, [7 ^7 |( o5 d: r& r - module_param(bcnt, int, S_IRUGO);
7 A: R/ m6 T2 ^4 N: a - module_param(ccnt, int, S_IRUGO);
复制代码
2 @' h& o2 _9 v: _' i* t! m9 `* v* f2 |/ i; S) t" J5 x2 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 s4 g1 k$ b- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% S% Q% K. C/ R7 v) N) {/ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @3 z" G- `4 j$ i4 A, ?0 G
3 I4 D/ I0 n8 j! c# M0 T Y
0 @$ _* v. p/ Z' ?
|
|