|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 @$ c5 q7 B! Y# m
- [code]EDMA sample test application: L" g4 o: v7 B* r) q
- /*7 a3 u/ E( u( U3 C+ D
- * edma_test.c( K+ n4 y8 W: _" \( c3 [ G' F5 J J
- *
; D* S1 K. y' Q - * brief EDMA3 Test Application% W: ~8 J3 f+ N" W5 |5 o/ E
- ** o& j, |8 d; f, l7 y3 [
- * This file contains EDMA3 Test code.
y2 e# f8 q, G) n. n& @7 Z - *
1 i( p, a# P; X' Z0 b) E+ w) M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- v& y& l* V- q$ L: } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 B" ?: t& e* Y' Q; c2 {% f2 j( S4 z - * TO CHANGE.& P5 s$ L$ C5 g. l3 U7 A
- *0 ]: o8 L( w7 i' Z) u1 j2 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' U& q3 Q7 p$ L - *
+ s9 v/ c8 K- J3 C$ y+ Q, T( l - * This program is free software; you can redistribute it and/or
R) `( A% C% w: ]8 Q - * modify it under the terms of the GNU General Public License as+ J2 r" p8 M) U) Z' k" V& j
- * published by the Free Software Foundation version 2.
% u R1 m2 ^2 V7 n: ~' D& G - *
W0 c# m' N! } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) T1 l* Y" n; L1 H; _- G+ O - * kind, whether express or implied; without even the implied warranty n5 I0 L/ G& D5 ]. q% U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 B' i4 n# S# ^) N: t' z
- * GNU General Public License for more details.
( s* ^+ A, E$ e3 z - */
% f9 S" G! @5 p$ s, G
, x( w4 n7 J, _0 h- g; U- #include <linux/module.h>
5 W' ]( u7 V% P; h' B0 ^ - #include <linux/init.h>
( O' k! _* m: j - #include <linux/errno.h>
9 s8 b7 d. N/ y8 k2 x& D5 f$ t0 Y' y - #include <linux/types.h> d6 u; n s" i( s0 Z5 c
- #include <linux/interrupt.h>% S5 `; z/ b8 `
- #include <asm/io.h>
; Q* q* }5 |( D; v5 ?8 R - #include <linux/moduleparam.h>
; r- X) @; W* \0 c- u6 u% ~/ [ - #include <linux/sysctl.h>5 e: M2 ~% n1 z A! K1 O+ B
- #include <linux/mm.h>7 j9 z6 `9 v. ?6 \0 h0 k+ i' [
- #include <linux/dma-mapping.h>
/ }# }2 [- J" |5 W9 R9 f0 _ - ) S9 `" s# }9 [
- #include <mach/memory.h>
. P F; H) b4 x( k0 `1 y. F6 o - #include <mach/hardware.h>$ {3 E; {, Z2 q7 g V
- #include <mach/irqs.h>: b: j1 R) {/ g2 q" A' v
- #include <asm/hardware/edma.h>
( f$ b1 j0 T! H5 |) O" v$ b! }' l: b# l
* w! g: b% J) i8 o( g- #undef EDMA3_DEBUG
$ t5 Q! p+ z5 i x8 { - /*#define EDMA3_DEBUG*/
- z5 ?' n+ k, R& _+ I - + ^' w" I- a6 {1 u
- #ifdef EDMA3_DEBUG
! P @" `( {$ W; X9 v! {& U% f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( N4 g( v2 a! T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" _8 L; ~' z- p; d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 f$ z9 k$ b1 H" h% q% U# D5 I - #else
1 k, ^" R/ _, }" W - #define DMA_PRINTK( x... )) t) e* ?4 i( K& R" ]- [
- #define DMA_FN_IN" s0 y, O+ Q) V$ e8 ^, I. y
- #define DMA_FN_OUT7 `+ u- j/ U) @6 t: u
- #endif, i ]! Y' B' _& Q$ f: C
- ' O& n+ a) {3 q$ u) O) ]* Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 |8 T4 S6 j; D6 i' s( T
- #define STATIC_SHIFT 3
% @5 A- d, {3 r) S/ C' W - #define TCINTEN_SHIFT 20
+ ~8 k+ o1 L1 X( R: E1 n | - #define ITCINTEN_SHIFT 21
8 m9 l* S5 G7 C' P; ]9 K3 e - #define TCCHEN_SHIFT 22
( D7 y% \ @) g0 w2 @+ r - #define ITCCHEN_SHIFT 23
3 [" L+ ^0 s. H! D. J, h - 6 w( P+ ?, Z2 w( a2 K
- static volatile int irqraised1 = 0;# w \; U$ l* G1 X& \' ]
- static volatile int irqraised2 = 0;
6 g2 l8 Y# E: o8 K
0 o a) W3 W3 M6 j+ X$ @6 o2 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [' U% a5 {% t) x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) F3 ?/ w% f7 l; p' ?9 f t$ l8 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?- w2 ]9 L% O8 M
9 ]; p6 N; G/ I* a; r- dma_addr_t dmaphyssrc1 = 0;
/ r$ @9 K X# n; J3 _ - dma_addr_t dmaphyssrc2 = 0;
2 X1 H4 }) p& u7 m& _: ]% @5 W - dma_addr_t dmaphysdest1 = 0;# T ]) i6 \4 e# }( j2 Z
- dma_addr_t dmaphysdest2 = 0;
! a O; v6 W7 m
9 C& w: o4 G1 S' p% i$ e- char *dmabufsrc1 = NULL;% R: {: x5 f) M8 ^
- char *dmabufsrc2 = NULL;: e: _0 k# n1 ^ W4 c! J: g
- char *dmabufdest1 = NULL;8 z* E; F3 P4 k9 a+ ~
- char *dmabufdest2 = NULL;. g7 L x: }1 r9 [8 `0 ]# i1 P# ?
- ! m( _& @& F* n7 q1 ~+ A' H
- static int acnt = 512;: n" [, c2 Q9 }0 }2 e
- static int bcnt = 8;
4 |1 H4 C! b4 A7 J9 N+ i# V! q - static int ccnt = 8;
# O" q7 M9 n7 |- ~, P7 B - % {1 @3 Q S3 w( F) h3 D* I
- module_param(acnt, int, S_IRUGO);
$ X2 S) L) ~ v4 ] - module_param(bcnt, int, S_IRUGO);5 i- k- P! V8 D0 V' v
- module_param(ccnt, int, S_IRUGO);
复制代码 & Y% D3 A# z% X, n& X& y* ]
6 d! }/ Q2 j8 y8 V; [0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 D4 c/ {6 F& T. K% X8 m, q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i @' }! S% R8 F, G5 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 A9 e1 t; ~/ K$ ]: E
4 J. L4 Z4 i! n# Q. z. Y j9 _) b2 O9 B6 L6 _; `
|
|