|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; d6 c6 J2 |7 {8 r p* `6 [- [code]EDMA sample test application
( `% h) g2 I' ?) @ - /*2 N) N: f$ v! f% e& I3 [ d* o" x
- * edma_test.c$ h. q/ B; W# r6 l' |, J' J' s- A0 A
- *
- Q7 K& k B# e i3 }* P# } - * brief EDMA3 Test Application
# H: V' u9 j0 h2 C: W - *( d4 _* [: v$ p5 `+ o" I+ l) a0 s
- * This file contains EDMA3 Test code.
/ l- K- p. ]4 K; c$ } - *
7 I: m! A( D* M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. Z! p+ b& `9 r1 Z/ }/ Y3 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% h6 y1 t( s* j. p& b# Z! W& J9 D - * TO CHANGE.
9 w9 I2 G0 Z* n0 ~ - ** J8 {/ b' g. S/ d! X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 P, h9 y) \) L" Z7 b; D - *
- r: u; d( c# ]4 r9 `/ m - * This program is free software; you can redistribute it and/or
" m4 R5 Z) x! b1 E! s7 E' y0 O0 [, G - * modify it under the terms of the GNU General Public License as/ ^) J2 n4 v; S) k5 t8 H! A
- * published by the Free Software Foundation version 2.( ]: r9 S0 q: s- ?" W
- *
% J* C5 E1 }& f' L# f" J' | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 p C; O7 K) e v' q! O - * kind, whether express or implied; without even the implied warranty3 _ F( ~% V$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 r7 C0 _. ^$ s& U3 u$ Z - * GNU General Public License for more details.; U/ X4 u5 w) ?
- */
/ f5 i' t9 {& E: ^5 R+ K
, ?+ j+ Z. W5 v& B# T4 g3 z- #include <linux/module.h>; y- p1 c4 h6 G E6 x* W- y9 O
- #include <linux/init.h>
~' `+ x2 _9 X0 i - #include <linux/errno.h>
, \0 A: r" Q- t0 t$ X - #include <linux/types.h>
' [2 [. k& g; T/ {0 Z5 o* h - #include <linux/interrupt.h>
- {0 I- C ?4 o& j2 b m - #include <asm/io.h>
3 ^! T: ?& M7 J1 E R - #include <linux/moduleparam.h>- P; L1 U0 b2 F2 v$ e3 m$ @
- #include <linux/sysctl.h>8 B, u6 P2 }4 ]+ Q
- #include <linux/mm.h>
( Q- B# g) D e8 u a - #include <linux/dma-mapping.h>7 G. U9 o+ n9 q5 J+ H! \7 z9 @
% f+ V/ E' W+ {( A- #include <mach/memory.h>; N5 ^. s1 @8 ]3 ^- x: W1 m
- #include <mach/hardware.h>0 X' W' _ {+ q% f$ P$ h
- #include <mach/irqs.h>
, u: M1 V2 |0 S5 T3 B% l - #include <asm/hardware/edma.h>. O. C2 a+ F, C: _9 F
1 f% J |5 Z; V; M `- #undef EDMA3_DEBUG- g% F; U. U# q7 o; h
- /*#define EDMA3_DEBUG*/: T" G. f' `; ]( f
; W. _! I# n, c: K- #ifdef EDMA3_DEBUG
0 } M) a, C3 J6 n* ~% \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; }* G) ^' l/ N. \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, u$ w8 E+ t+ M% D! C" f/ @2 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ m0 ^/ R8 k4 L$ T; w! P$ A" |1 j - #else# H: {6 T# m1 |3 V4 g- X) m- j6 a2 w B
- #define DMA_PRINTK( x... )4 i p- E$ c* [. E: J3 u6 s( o
- #define DMA_FN_IN
- D+ I# k; x3 q" U* ? - #define DMA_FN_OUT
1 y4 D4 A: ~7 P# t - #endif/ m- R# H% N! L& i3 j( `% C
* X. W5 L" Q$ `6 u/ g. ?. c9 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 b$ ^. Y% n1 A& i# C' L - #define STATIC_SHIFT 3/ o4 A* n! J7 R0 |( H
- #define TCINTEN_SHIFT 20
+ a% m2 {2 g, Z# n9 F" ?7 B( q - #define ITCINTEN_SHIFT 21, I; L9 A% ?; l/ r: o$ l
- #define TCCHEN_SHIFT 22
% a3 T# f" \" q) C! R1 R - #define ITCCHEN_SHIFT 23
- u- F% a2 e' P: A/ H
5 d+ B3 |& L. r5 X- static volatile int irqraised1 = 0;5 p( {, A( E4 \5 \3 T. L0 R
- static volatile int irqraised2 = 0;: L7 L4 q% F0 ^1 }0 q$ _! c
0 K6 s4 U: F. X+ H6 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k1 Z4 Y" |1 m4 A: ^( G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Q, M% }# e* v q& w: W, B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% a5 I7 B$ g7 s' E. V" j1 J5 G
2 u# x1 o! ?) D3 x# N# j7 m7 c* O& S0 t% g- dma_addr_t dmaphyssrc1 = 0;3 E) z$ b# X' u$ M$ \! R
- dma_addr_t dmaphyssrc2 = 0;; x0 E$ X" T1 N( g5 G, }
- dma_addr_t dmaphysdest1 = 0;3 a2 y. a9 m6 V, |- d" N
- dma_addr_t dmaphysdest2 = 0;
4 g* R7 M. g6 r S, Z) L4 { - 1 |5 u7 }* g1 F
- char *dmabufsrc1 = NULL;& A# u7 i+ v" A
- char *dmabufsrc2 = NULL;: V4 D2 S. f* t" Q5 j! H; L6 ~" ^
- char *dmabufdest1 = NULL;
0 u' L. P. C* x7 _ - char *dmabufdest2 = NULL;) C; {* O0 H, {
- 8 X2 S, x- |# g( Z% W9 q
- static int acnt = 512;! i( a( C# x @7 O2 m9 L
- static int bcnt = 8;9 B0 L. W3 B+ m% [4 k5 ?' _
- static int ccnt = 8;
& z5 B6 S, q9 T3 F8 Z; l: I, w, O) r
5 N; I) f2 j2 k; [1 Q# T5 k" R- module_param(acnt, int, S_IRUGO);' C, t, r3 Q3 ~" B; D" |% e/ [9 ~
- module_param(bcnt, int, S_IRUGO);
& Z( S: z# w/ m! V" f3 d0 q( x - module_param(ccnt, int, S_IRUGO);
复制代码
1 `0 X/ n' x% b
% {- X5 ?7 A1 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" `: n* o Y0 c3 {1 |7 u- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- h! @9 l) b* D5 ? @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 h: M d! |: L) R. Y
% n0 S: w" P# P3 q# K
3 [/ j; r2 M+ U4 s' N* m |
|