|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; N' d' {. ?' R; E. v1 Y- [code]EDMA sample test application
" K' R; Y" M; h) g% K5 ^ - /*
& ] M: i" \1 _; a3 ^1 j1 E - * edma_test.c0 k( h6 \8 @; w6 ?
- *- e2 k4 D& S6 G; y9 J2 f9 I6 Z, f
- * brief EDMA3 Test Application
+ Q+ W' H* {/ J9 F2 d - *
4 q; p7 n# b% c/ g5 [9 K7 ]/ j" _0 @ - * This file contains EDMA3 Test code.7 p, h" D6 y) Q+ ]3 z, l! q3 A# x
- *
- e$ }5 d; S- y1 s6 n4 U' _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; f3 B& D1 F' \. U, W, t5 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 n' n* G6 {/ \9 j/ ?9 H' Z/ i - * TO CHANGE.+ H! i: A- s/ P+ U$ F t1 C, v
- *, s+ B: U8 ]; J) L# X9 z+ j# u+ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( w6 n9 W2 h2 [8 l) |/ g - *0 C, G' M* @# S- o$ X5 P4 y4 A
- * This program is free software; you can redistribute it and/or' g; ?. r& G0 ~
- * modify it under the terms of the GNU General Public License as3 j2 I$ o- [, m' b/ h! ~7 d" C
- * published by the Free Software Foundation version 2.
! j- F( E( G# E( A1 m - *
8 m5 h5 Y5 o4 l( W" ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 t' g4 Q7 C* c5 S/ E5 ~8 w
- * kind, whether express or implied; without even the implied warranty
; u3 [1 s4 _4 s- L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- I0 [) h! J3 e& m& U$ }* Y1 W. A
- * GNU General Public License for more details.
& T3 u' c. c5 | - */2 b1 I7 [; D" C; C) }
* t3 n/ D$ q# I) A- #include <linux/module.h>4 m1 X5 ~9 z' c! k4 V, a
- #include <linux/init.h>( i! u1 v4 j4 |/ E# ]2 @ [( l
- #include <linux/errno.h>
/ [ E4 ]% p+ }2 c - #include <linux/types.h>
e: l$ ^$ v0 s# g7 ` Z8 x, ` - #include <linux/interrupt.h>* C4 f) S4 g2 F) w
- #include <asm/io.h>' F; Z8 l9 S$ n5 l" B$ X
- #include <linux/moduleparam.h>
! y1 S+ v& Q0 ~- M4 E - #include <linux/sysctl.h>5 d8 ~7 O0 S7 L% g+ D4 x/ O
- #include <linux/mm.h>
^# f2 y: x5 s8 B" [ - #include <linux/dma-mapping.h>7 d/ N4 I- W0 Y/ ]( I
) Q3 I4 T, J1 @- #include <mach/memory.h>
; \: ~+ Q' j8 a - #include <mach/hardware.h>
8 Y, Y. I. J7 a9 f; o - #include <mach/irqs.h>6 g( j% R" _' m( \) U
- #include <asm/hardware/edma.h>
: a- {% n5 F" g# b% ?
* s" [ Q( ~6 U( n+ Q- #undef EDMA3_DEBUG
3 R6 n9 P- ]5 ~# P1 Y( z" ?) y - /*#define EDMA3_DEBUG*/
- D$ F# `4 S/ d; r' ^& b. f
- k& ]' J& a) I0 n6 K/ [- #ifdef EDMA3_DEBUG" f" P4 ?9 ~$ g2 F, l/ M* s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" E! w- r+ f7 s! W/ R% c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; N) B8 t# `" @6 f7 m, k- q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 J* d g. v' X5 h& x) ?- d6 _. s
- #else
8 N, }& `! h2 j7 P! X# ] - #define DMA_PRINTK( x... )9 N) P" _6 z6 ~# o
- #define DMA_FN_IN5 \) @5 _- S; C* X3 n! n
- #define DMA_FN_OUT9 a2 |1 S: ~9 V& m# ^. ~
- #endif
4 X, {) ~/ `$ I
. g2 e- M6 d+ F. |! s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 f* C/ E) u0 }" R1 k/ w* | - #define STATIC_SHIFT 3: E+ Y8 C- k3 f- q; Y/ b" F
- #define TCINTEN_SHIFT 20
2 U/ p* k8 B# K. [- J& g6 ~3 D - #define ITCINTEN_SHIFT 21& R. H) Z! ?; R: C% v
- #define TCCHEN_SHIFT 22
( n' ?' I/ B; z' T# @. z$ \ g6 V - #define ITCCHEN_SHIFT 23& n! E4 \2 i$ \* \
- : f# E4 \7 X0 i' u) e0 s
- static volatile int irqraised1 = 0;
4 ~6 {9 z3 ?5 T( \2 E; |6 f - static volatile int irqraised2 = 0;% x& s) S! K a$ L" {+ D
- 3 ]9 r2 Q# L* g: q1 Z( c0 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# t1 X5 K; ~' N" I8 Y1 c/ m8 W# r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q: T9 c: o2 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ C' A1 N3 M+ ?, ~: f2 ?. N
9 i3 O3 F0 G: c: y4 z- dma_addr_t dmaphyssrc1 = 0;
6 c7 A' I- m8 Y9 O W% s - dma_addr_t dmaphyssrc2 = 0;. j& ?2 H. z9 V' K/ V3 Q
- dma_addr_t dmaphysdest1 = 0;8 d9 u- g' }' Y, e' c9 C% U
- dma_addr_t dmaphysdest2 = 0;1 Y; E4 |( ~1 S# T( b/ f/ F
- 4 l8 O% v& K7 S2 Q+ F0 i: k; F
- char *dmabufsrc1 = NULL;- S% L5 h: g8 A
- char *dmabufsrc2 = NULL;% C* y* ]. K1 c
- char *dmabufdest1 = NULL;' S6 i1 L. R8 Z0 D! R# H2 e
- char *dmabufdest2 = NULL;9 B* K( i" w. f# V( v$ M% r
' a5 _: D# Q0 @( `7 z- static int acnt = 512;6 ~% Q* N- q" {3 l
- static int bcnt = 8;/ ~ h( ^$ y7 y, H5 W7 {( W- s; M
- static int ccnt = 8;3 }2 v* r) P* G- C2 L6 Y i
: j" B! d L; g/ j4 `5 R2 a- module_param(acnt, int, S_IRUGO);
# _5 m. s/ O. D$ `& U/ l - module_param(bcnt, int, S_IRUGO);* F4 L* `. O4 r$ y* V
- module_param(ccnt, int, S_IRUGO);
复制代码
) w, t" y/ z" F; J' G& `/ Z
2 y/ m( O; R0 N% U1 G. ]; B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T* R6 I/ g8 c2 Y6 U; M; B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ o. \% Z$ L4 E% @4 B+ K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
D' c4 s. O U0 t7 B$ _8 g3 R/ Z) c
- ?" T. y& s$ c9 f- p6 X$ L7 y |
|