|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 G, ^( I4 r8 J
- [code]EDMA sample test application w; w6 A: B; E% M( E9 `
- /*! u E( T5 \ g# e1 S2 `* G: k
- * edma_test.c# B3 |/ @7 p5 }( `: f/ L
- *
: \: R+ w) `0 o2 p - * brief EDMA3 Test Application
2 p3 I+ P4 p' v6 E! |! g0 Z - *
: v' e/ z3 N I* L* y - * This file contains EDMA3 Test code.1 n) e) F3 ]8 @+ N$ H5 p' {
- *2 P! `- F1 _. P; b% g( k. y* B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" \6 c2 S3 D* |# b9 i* Z7 z: [, u! C F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 j2 {/ O3 v' S% Z - * TO CHANGE.0 K: E, d4 s- D, W7 A9 _8 L/ u
- *
' q9 t3 d! m5 i! G4 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# q9 v& X% a; @- z - *3 S$ K1 _9 y/ [9 H
- * This program is free software; you can redistribute it and/or( l8 R: g1 N6 |* J" u+ r! k4 H; J
- * modify it under the terms of the GNU General Public License as* H7 z( m5 \* J0 P
- * published by the Free Software Foundation version 2.2 \* i- |0 S8 F/ m+ t8 a
- *2 x; G | l% N: [% v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" h6 y( T/ R9 h% s
- * kind, whether express or implied; without even the implied warranty2 ~# U. A& c7 F' _; D6 i) f/ B9 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 {+ F& ^( v) O0 U' X
- * GNU General Public License for more details.
2 ~7 ~" g) r+ { - */
0 ?/ K# a y& ~
( b3 M" G7 q, B2 N- #include <linux/module.h>
( i) P2 {- c1 s7 n5 j/ i - #include <linux/init.h>
/ l6 Z! _$ ]3 a, P: C* r, f( N5 N - #include <linux/errno.h>
7 q+ ?; \3 B4 K4 Z7 U - #include <linux/types.h>
% B# B _, ^: |( F# Z" a9 ~ - #include <linux/interrupt.h>
$ X+ F) Z# j: t" u0 t. k6 o - #include <asm/io.h>
4 C# x3 L4 k; ~+ B - #include <linux/moduleparam.h>$ f6 v5 R/ |7 D9 C
- #include <linux/sysctl.h>
. x p. s* W, \% `6 g# @; V1 A5 A - #include <linux/mm.h>) y9 H1 a' _4 {# { ~
- #include <linux/dma-mapping.h>
5 Q* W9 a) O7 p4 e; x - ! `' [* y t; `! b) P4 l
- #include <mach/memory.h>
/ {* }9 [. ?9 z% K( A9 A - #include <mach/hardware.h>4 |" F( A% ^0 F6 Q! Y: K' _# `
- #include <mach/irqs.h>- O5 t0 h; @0 n2 Y
- #include <asm/hardware/edma.h>. s% S, j0 }! g
^% B! S7 b! Z6 \+ U4 X; I0 X- #undef EDMA3_DEBUG% {* r2 V4 [4 d- V$ y4 E! Z1 Y
- /*#define EDMA3_DEBUG*/
1 @' w) q) ^" Z - * I% W' ~4 t9 h8 ^6 O/ L" Y. i' ~
- #ifdef EDMA3_DEBUG
+ g3 b; y% `) O) y: k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ u2 `& {+ X: h3 m0 C4 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 S/ b- {: T5 l0 I, n7 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v% D V/ J- r( J5 h
- #else2 i3 p5 d5 ]7 x. D! T
- #define DMA_PRINTK( x... ). |% u$ y8 L" B+ U8 t0 w' m' m# r
- #define DMA_FN_IN0 ~# N5 u3 w' b$ t! \( V
- #define DMA_FN_OUT g4 Y4 y. A8 D. G8 G
- #endif
# Z& j1 z7 O$ Y: C
! N1 b5 I* c, Q. K0 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% |) |) h, m* h$ z$ V' b. P- l - #define STATIC_SHIFT 3 x+ L. e8 M! a' _6 l8 s
- #define TCINTEN_SHIFT 20
P, d, i/ N& S8 O& @/ ~ - #define ITCINTEN_SHIFT 21
* T% i& [7 c0 ]' D7 D6 y0 K - #define TCCHEN_SHIFT 22
- J. B0 b* |- F- a; N. {8 k+ J - #define ITCCHEN_SHIFT 233 G3 s" u! D* M' @! Q
& O* I9 M1 o& j- C9 ~2 }2 j3 u- static volatile int irqraised1 = 0;
+ P( |5 U3 R0 g0 t6 n( @ - static volatile int irqraised2 = 0;
& m4 _+ O9 W0 O+ q" `- u, d
$ A$ _- a( G+ f, W- E% T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& c' n s1 ~( p3 h8 T! S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 G8 R5 z8 a6 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c L! r* a( s4 v/ V
- v5 O$ I/ I) g) W8 [. _# Y
- dma_addr_t dmaphyssrc1 = 0;3 n; l* U, \7 p- ^' P. j
- dma_addr_t dmaphyssrc2 = 0;( d* t0 G2 ?! s
- dma_addr_t dmaphysdest1 = 0;4 B/ v+ t F) H! r$ g
- dma_addr_t dmaphysdest2 = 0;
+ K9 c$ z: i3 P3 k5 @) G - : y5 f4 ]/ h' G3 I
- char *dmabufsrc1 = NULL;
- f+ A5 j* h1 S s, G - char *dmabufsrc2 = NULL;
1 a4 w3 Q9 V# R. V* o1 J0 b) V - char *dmabufdest1 = NULL;
0 m9 x& E7 a2 S, ^ - char *dmabufdest2 = NULL;4 ?' v# F! w4 N4 w
/ ]' Z% ?! T* m- static int acnt = 512;
2 k' u& y0 t- ? - static int bcnt = 8;* r/ J3 W7 H- w# S' k# P ?
- static int ccnt = 8;3 O- e, v3 G! r. I8 w
5 Z O% }3 n N; I- module_param(acnt, int, S_IRUGO);
& ^# @# \# I0 a( Q5 A$ V% {4 w - module_param(bcnt, int, S_IRUGO);
0 a; v9 x+ C4 w* h* k. E - module_param(ccnt, int, S_IRUGO);
复制代码
* K S2 D9 n" S( w+ m: G, X
) S$ [% o+ Y$ }7 O3 d# v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ y& t0 k4 N- P; Z. A- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% K+ y {; L# m* H" w$ P; G a: `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |0 d8 o8 E2 k) q. ^6 ?, k
* J" q$ Z5 A7 q! `. }% K7 s4 {3 N9 A! }% h$ C& y0 i
|
|