|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M/ j6 S( J! F$ s& }
- [code]EDMA sample test application
6 y9 ^! w0 V% r - /*
- g, i2 V& P: q, R `! V$ r* q; u - * edma_test.c- j$ X4 F8 ~5 c$ ]( g9 }* J# x
- *9 N- D4 V' M0 B9 R0 W9 L
- * brief EDMA3 Test Application& x/ w; Y, g ]+ }' K) {$ ?5 R
- *
4 l4 a' l! B6 Q( X3 x/ X' Z - * This file contains EDMA3 Test code.
' I7 x3 N$ U; Q. _ - *
, y& a$ r; ~9 C7 q+ Q+ ~7 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M; f; E' {8 n& P& w" x6 @/ M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 B/ C$ f x# r t U2 t; a
- * TO CHANGE.
! h" L) _0 R( T6 F+ k: o - *# {& _3 c" Y- J* V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* @1 D1 y, ]+ W7 }4 q" h. v
- *
m: V' e0 q9 k! p/ I - * This program is free software; you can redistribute it and/or
& {. A# H0 L1 v - * modify it under the terms of the GNU General Public License as
, X+ M: @7 {2 p# H - * published by the Free Software Foundation version 2.
$ P4 s$ t0 h2 `/ E7 a# i+ k - *& _, s2 H. v' A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 F5 V6 V" k' K Y6 @
- * kind, whether express or implied; without even the implied warranty
' E7 A# m. q, Q5 n3 _9 c" D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( s" R3 \8 {7 l& F
- * GNU General Public License for more details./ N) S" ~7 p7 T/ n1 Y* ?
- */7 p5 V- l) | w* u
- 8 S& Q# p/ X1 C! F; l8 j
- #include <linux/module.h>* P! T" [. F; C' g; y
- #include <linux/init.h>
* I, W) b( E1 W3 ~/ L - #include <linux/errno.h>. | [2 ^6 y* G+ h. z" b
- #include <linux/types.h>
6 j& _% P8 A9 v. ^8 X! t - #include <linux/interrupt.h>/ G. E* ?% Y" u3 C, \$ |- F
- #include <asm/io.h>9 \7 |" _ |: W2 ]& h
- #include <linux/moduleparam.h>4 k* g1 U8 r; H
- #include <linux/sysctl.h>" W! d8 E8 @; j, Q n3 {
- #include <linux/mm.h>
' O2 @. ^9 y) a4 g( ^ - #include <linux/dma-mapping.h>
, w- { }( [ ~
2 T# @$ f. Z- e9 A7 G- #include <mach/memory.h>( d6 w2 J- \+ x/ T5 T
- #include <mach/hardware.h>
: C5 a" J+ T3 x - #include <mach/irqs.h>
- K9 a' p: c2 s' p. W1 t) r' U( i - #include <asm/hardware/edma.h>6 N) A9 ^) j: u4 @& Q1 H, y
- 1 C# }8 [2 u3 e* @$ {! p9 c- Z' x
- #undef EDMA3_DEBUG4 g" T4 O9 Z& M/ \2 f5 v. b+ k
- /*#define EDMA3_DEBUG*/
7 j+ @; m1 e/ `3 H+ O - % Z S# M, F$ Y$ T
- #ifdef EDMA3_DEBUG+ U9 P1 r1 M5 H9 E9 h9 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 m4 h$ g2 z* y' ^& Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g7 t+ u( o7 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 c/ J2 G1 B/ g9 _' V- i# u' R - #else2 \+ u/ G2 S; ^% B( ]
- #define DMA_PRINTK( x... )* h. U% d; ~7 L0 @2 W3 t, B
- #define DMA_FN_IN6 C7 W/ h, p0 y. i$ F, l0 Y
- #define DMA_FN_OUT
! H+ _2 I5 A# P6 g - #endif* Z" v: t r' Y; e& J+ V
- 0 {7 F1 @- V( w1 V7 Q- y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _- Z! N" S' Y3 }' _ - #define STATIC_SHIFT 35 u" R4 ]) ]: u" X
- #define TCINTEN_SHIFT 20/ E2 U v$ l/ j' O
- #define ITCINTEN_SHIFT 215 R- v( f# A5 S; t0 v0 Q
- #define TCCHEN_SHIFT 22( _" T! z, w" L, Z
- #define ITCCHEN_SHIFT 23
) f3 C, w4 N& ~: V' t; ^
+ S- m, I; I/ U% z) M# A$ C6 R7 {1 T9 ~- static volatile int irqraised1 = 0;9 |# Q0 G/ f6 P N `; W
- static volatile int irqraised2 = 0;% `4 h, A/ H! R# s! l. t
7 c: L) ]; R% N' M6 }6 s+ O% H& k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 [& y6 A! C Y( U5 V5 `6 d a: I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. }( f0 x1 u1 n0 p7 }1 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u# [ V: n; l6 Q
- ; g8 h( q" `3 b; |7 H
- dma_addr_t dmaphyssrc1 = 0;, D- O7 n% F7 u- {, m
- dma_addr_t dmaphyssrc2 = 0;
4 e# t- w. w0 |/ ]% u( F- f - dma_addr_t dmaphysdest1 = 0;
8 s, n9 v4 Z4 F$ y: t; Z8 L - dma_addr_t dmaphysdest2 = 0;
& b# `* |& [) s: P4 T5 g7 g& f - , J( L( X3 I* ]4 }6 w7 G! }
- char *dmabufsrc1 = NULL;
; x g4 _* {; |1 Z7 A9 X - char *dmabufsrc2 = NULL; O g: |, P) n8 @4 N
- char *dmabufdest1 = NULL;
" b" ^% X- b. y6 D - char *dmabufdest2 = NULL;
4 f {/ e- L+ [* s2 D
* M; o z5 ]7 @# q! T- v- static int acnt = 512; O6 N' `, T. B( }. K2 O% J
- static int bcnt = 8;% b0 m* F! X$ Q# F/ w/ a) h( [$ Y3 U
- static int ccnt = 8;
0 f4 N! ~. v2 ?% V# |
9 [" |) W; O3 x2 M- module_param(acnt, int, S_IRUGO);3 Y' |# g3 y) z# }& j
- module_param(bcnt, int, S_IRUGO);
9 ~3 h b- g& W1 G7 O& A1 Y - module_param(ccnt, int, S_IRUGO);
复制代码
1 C, {5 k3 \1 K9 B$ L! Y0 p1 j1 I- |) L) _ h- h4 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- D) I& c7 W, _: E/ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# g _! [$ E& ^8 H0 }8 c3 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Z$ }6 V `( \5 L0 E" W
& }. P# T, p; E z+ F t
% O8 k6 f6 _! a& S5 o |
|