|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # m7 c: f- U9 \- P$ H u& I
- [code]EDMA sample test application% n) M* a; F; B, p
- /*
+ t) ]) H, Y- e% h9 e - * edma_test.c" ?* J, M. ^# N, q$ P# P: ?6 J! v
- *
: o6 Q& C" w6 A/ Y1 H' _ - * brief EDMA3 Test Application
5 g) f+ T# f9 J. g! H( n+ Y$ O - *4 q `) `- ~+ n1 [( h
- * This file contains EDMA3 Test code.
1 F7 e; p" R* ~1 g) @- { - *
" i; q; W% W( \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `% |: z8 e" c$ L- j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
V& W" u, _! V- p# ?0 O' w' d1 |4 _ - * TO CHANGE., j& y* F8 C* [& n T' H% \
- *
# p+ p' r# b2 H2 p9 [6 n p0 N$ { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i6 M6 Q E) b9 r# z
- *( J, h$ g! a! G8 }
- * This program is free software; you can redistribute it and/or
7 T' |2 S4 R! {- W/ ^ - * modify it under the terms of the GNU General Public License as) o5 ]! j' R: |3 z0 }
- * published by the Free Software Foundation version 2.
* e- I1 x: ~% Z6 y5 ~6 o% R, { - *
/ A: b- P$ G6 n2 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y% U9 n( B @2 H
- * kind, whether express or implied; without even the implied warranty
9 g$ E, f1 C& V0 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ~, r y" B- S
- * GNU General Public License for more details.
4 g) w9 q5 s( a$ I1 H8 C9 G - */
! o1 U& ^# F* q7 @5 t: U6 a
" R& g" G/ n6 A2 ]- #include <linux/module.h>
" B1 u# Q- P9 C - #include <linux/init.h>
" g% d) R% W8 @! o `: D0 w' d - #include <linux/errno.h>
+ {& D% K4 F4 o3 h$ b" `' d( y - #include <linux/types.h>
9 U3 _6 @; A' e7 W - #include <linux/interrupt.h>
6 T; _, |: h) q8 Z( i' `* m- X, _ - #include <asm/io.h>
/ _9 \5 Q* ^% e; c& r/ \- w - #include <linux/moduleparam.h>% [* `* S' R( m0 _ [
- #include <linux/sysctl.h>
y. C7 d, z ]" E" i& }9 I - #include <linux/mm.h>
3 I- [- d% L# c - #include <linux/dma-mapping.h>
! L# i4 G4 P, G' f1 C
4 p) `: W: _. P) F+ W) h2 f7 i2 |- #include <mach/memory.h>
{2 @& E! ~4 ^- m' U - #include <mach/hardware.h>
4 J6 ?6 \. S1 p+ E" \+ s$ K8 h - #include <mach/irqs.h>
' G: F4 }. z8 @6 d$ T0 c0 b, m - #include <asm/hardware/edma.h>
( o/ S4 C3 h2 t. I, U( N
% r: S& b+ C( I0 ~& C' s- #undef EDMA3_DEBUG
0 _3 N4 f- I2 L9 N - /*#define EDMA3_DEBUG*/
% C$ Z+ @8 ?* A5 I8 x& I$ T - ! g z; d4 M+ ]8 V
- #ifdef EDMA3_DEBUG. j7 w( ~- G( s! H6 J/ i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 d1 H% N: V$ q$ Q! M7 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ H0 s, H& x7 l* M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; F* P; T( b0 t5 Q8 j/ Z - #else
9 Q, K) f5 p) \ - #define DMA_PRINTK( x... )
- ]8 Y3 m9 \* N, c6 x - #define DMA_FN_IN1 S L) I9 e5 s* P" t4 D% l
- #define DMA_FN_OUT' g. y( Z! j5 f+ C2 p3 k9 E- i
- #endif
) n+ |2 @) j, ` - : }! [8 T' Y& w8 x1 f: i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) e. ?6 o& M( B$ Z9 E
- #define STATIC_SHIFT 3' }( Q- s( X7 @/ i+ p n
- #define TCINTEN_SHIFT 208 y' b6 x7 t& Y3 A9 z) C1 E5 [
- #define ITCINTEN_SHIFT 21
7 P5 Z c8 m" }: X( {4 u- j( n% A - #define TCCHEN_SHIFT 221 Z6 t% N+ H$ l2 C! D
- #define ITCCHEN_SHIFT 23, a: E! s; L1 |) Z9 O. j
, q+ } g5 d' @$ R- static volatile int irqraised1 = 0;# F% ] l$ I; e* H: E$ @3 D9 z- }
- static volatile int irqraised2 = 0;
( C6 A; m& n& L8 r! d
+ V: y! N% K5 h$ p# r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d% }. y F0 J; k; L, h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]. \, k8 U( H! z( F; R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E% ~& V3 `/ `/ C9 u: p
; i: e: {1 s4 n+ ^' E* @8 j9 x; u- dma_addr_t dmaphyssrc1 = 0;
+ k4 X$ c& o2 e" e7 ?' \ - dma_addr_t dmaphyssrc2 = 0;
. k! h0 j! U/ Z6 \+ \; A4 Q" X: b - dma_addr_t dmaphysdest1 = 0;+ z: O6 l" q# w' ^3 b6 }4 ]1 G* `
- dma_addr_t dmaphysdest2 = 0;
; U" M7 h- f# W" ? ~- D8 [! C
! l/ x( V8 H- G4 `. `6 o- char *dmabufsrc1 = NULL;
/ k' _ w r+ L6 r0 |9 A - char *dmabufsrc2 = NULL;( N# H# ^- Q% k F9 ?: p( }1 O7 \
- char *dmabufdest1 = NULL;/ J6 {# Y( V" ^9 N2 u8 P' t
- char *dmabufdest2 = NULL;
% e( n- M; @% N- J
9 u- M+ t, l- |6 r) w- static int acnt = 512;/ p( n- O, u0 l, ~ G, N0 j" ^0 v. D* A
- static int bcnt = 8;
2 V2 w( u4 p# V. a5 K8 N - static int ccnt = 8;
* d( O+ W, G5 @5 u) I$ _
0 ?6 m8 ^" x9 d( j: w- module_param(acnt, int, S_IRUGO);
* @3 C% O- K2 [ - module_param(bcnt, int, S_IRUGO);# ]/ z& E5 h' ~0 X6 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
! L- s% G# |9 |; U$ P; w+ L; y# ]0 e; T; A _; q" |0 Q% \! ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 b& D$ w b* ?/ carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N# J4 L6 `& a# B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- G9 s! S1 k0 T3 j! G
5 I3 R/ i O- R7 g {" t4 h; G* l: B+ k8 D
|
|