|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; _8 H1 N6 {0 U! t+ ~+ c% E- [code]EDMA sample test application
+ H+ r b# f n9 Y& \ W/ k - /*2 J) I7 F) U. A" }* ~8 `7 j
- * edma_test.c
2 A: s0 F$ J; U, r# y4 f: k; A - *) W1 {8 Q g2 \, v' F
- * brief EDMA3 Test Application
2 K. O" c' z7 C" c - *
& l" X! E R; [ R6 J" m - * This file contains EDMA3 Test code.; I, o' I! A4 H! c
- *
3 e$ }4 C5 n/ A; Z; |' v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
@: `2 C4 G. c4 L! j; J j: g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ F$ Y8 n5 X+ K3 z
- * TO CHANGE.0 M4 K) e+ [# i6 M
- *7 E& _, G3 b0 C7 F" s1 ]% J+ p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% _9 c4 l% Q; `
- *. t7 M+ H4 i% A& k3 D" n
- * This program is free software; you can redistribute it and/or9 }# E0 P9 h. q# H1 @
- * modify it under the terms of the GNU General Public License as
' {& [+ W7 t# G5 \- Y - * published by the Free Software Foundation version 2.; }; y$ f! X* _4 E
- *
3 T1 b) y% ]8 `4 T2 |! N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 t' c& Y+ G1 P# g3 z+ v5 v
- * kind, whether express or implied; without even the implied warranty$ i P$ \# R! ~- z) z+ [, a+ g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' `0 ?! z/ ~) V! C
- * GNU General Public License for more details.
/ c3 K. L% L# ]8 x% V* w+ S - */% m# y$ Q6 w. t7 ~* y
1 V" v; f% C6 |% P1 b1 j- #include <linux/module.h>% s2 O% V& V) E' N
- #include <linux/init.h>% }, Q' ]; n+ a" B$ P
- #include <linux/errno.h>
- F6 P: Z, H. G - #include <linux/types.h>
6 ^- V! Z* `/ E6 q- O# T4 b - #include <linux/interrupt.h>6 l/ H- r% g4 M3 y4 Z
- #include <asm/io.h>
+ z- Q. x2 |+ l# L - #include <linux/moduleparam.h>$ f, U2 S4 W6 v8 i8 t3 n9 p# H8 E
- #include <linux/sysctl.h>
' h4 a. |; [, c - #include <linux/mm.h># ^: z5 B( L: y' U
- #include <linux/dma-mapping.h>
1 Y( P, `0 f# m; b2 r - ' A: W1 ?$ g9 f3 M
- #include <mach/memory.h>. ~( o0 p$ B: v7 y8 J; {6 e
- #include <mach/hardware.h>( U: K* u$ v5 Y$ P/ U3 G, C
- #include <mach/irqs.h>7 Q; q& }2 o' B2 [8 P" D: m/ v
- #include <asm/hardware/edma.h>
7 ] l! x w$ c/ [9 w: b
$ D& A8 G' ~5 H7 N- #undef EDMA3_DEBUG1 C% t. W4 [8 w, N' F8 [
- /*#define EDMA3_DEBUG*/
$ A0 f1 u0 W- o' n3 Q' q U! T- p! A
b* |& y/ y6 H- #ifdef EDMA3_DEBUG' {6 ~4 Q# [/ j: C2 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L) t7 G! m* V2 L' ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), {( o1 k7 s/ G+ k! d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- r- y. C6 a+ }/ ]' H
- #else" |+ \. F: w. u
- #define DMA_PRINTK( x... )# U7 u1 M1 y* O4 P
- #define DMA_FN_IN+ q$ Q6 c3 {( K e
- #define DMA_FN_OUT
. R9 p+ x- }' |% v7 Y - #endif
" u8 B6 ~6 J2 t- P# K
+ l+ n Z* t. v- s+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% i% j' \' ?5 N) X1 j
- #define STATIC_SHIFT 3
/ B/ F, N2 o( U5 ?% S% j z - #define TCINTEN_SHIFT 20
0 q6 a6 a6 S- U' [ T' T - #define ITCINTEN_SHIFT 21. g6 v" P0 |. [' I4 ]2 t- ~
- #define TCCHEN_SHIFT 22' k5 h1 G# h7 f2 p8 @
- #define ITCCHEN_SHIFT 23
- y+ I* T& m1 Z! O4 l N4 y- l9 x - + T; B) ]. |/ k; b
- static volatile int irqraised1 = 0;2 r( O- a' ?4 A, A
- static volatile int irqraised2 = 0;
- W) a) f$ Z; ` - - y( g" Q. V8 k4 N/ v+ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ?7 X5 d. D+ c0 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 {, ]/ N; V, \2 j7 u" M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 K7 G! Z$ ?* f% I
9 s( Q1 Q a" h# g& [$ P- dma_addr_t dmaphyssrc1 = 0;+ G5 I g' o- J" q' q5 a
- dma_addr_t dmaphyssrc2 = 0;
$ U1 }. q4 i+ j! w# r" X - dma_addr_t dmaphysdest1 = 0;! S% K& d1 `9 A& ?
- dma_addr_t dmaphysdest2 = 0;, C4 k3 K( x6 {
) c: y0 g+ z9 s; Y, f- char *dmabufsrc1 = NULL;
* n0 ~) I0 U. J) q4 K9 N# U - char *dmabufsrc2 = NULL;
3 |3 g0 q5 D, c# m - char *dmabufdest1 = NULL;# M( g5 H9 p+ G2 F6 }1 R! S
- char *dmabufdest2 = NULL;4 f w. }/ `5 T4 }
( T1 A% Y: C$ W' v9 J& x% N2 l2 j# F- static int acnt = 512;; r2 s8 L; a/ j5 l3 ~1 O2 W. u/ H" X
- static int bcnt = 8;
0 F% x+ u; q3 I+ a+ o - static int ccnt = 8;
5 M* u/ N: W8 K! z - % ]/ ]8 x: J/ f( t/ w
- module_param(acnt, int, S_IRUGO);; u: B, C8 R# I a5 m# z
- module_param(bcnt, int, S_IRUGO);
5 x" ?) E! s* Z1 z" @/ l8 \, E Q - module_param(ccnt, int, S_IRUGO);
复制代码
9 M" t2 J3 K) s9 J% Z- Z0 J' t& ~( [6 h3 Z6 P4 D) M6 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n& Q5 x6 z$ E) G) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( {( x4 x' D, f. V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ @8 B( G4 Y! D& M2 ]
! U+ k/ s$ q( K+ S: `/ A! s
% R4 `. T5 M/ g- {4 {- c |
|