|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 S& p: r9 e" D0 ^ b
- [code]EDMA sample test application& \! a2 z9 L; ~" g! i3 ^) }& Z# f& C
- /*
1 V8 K1 c$ a. s' g: m - * edma_test.c
4 ~* r; _; l+ I3 B; U$ ?& z7 O v - *
- m w$ u8 e) `, s - * brief EDMA3 Test Application1 a, w# A1 x# A; O
- *
$ d% O, ^1 _" @3 A c - * This file contains EDMA3 Test code.
" l8 M5 ]6 ~$ B( I ~- U! w+ _ - *
/ |0 h2 B) b' R- D. K2 z" D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: |% d5 P+ e5 N" B( v* Q9 l/ _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, L, e( ~* L' Y2 F [ - * TO CHANGE./ |0 _ N/ t4 Z6 _
- *# Y; F3 ^4 @3 T" N* N0 M1 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 z. ]6 v& [2 S4 R* K& ^7 i - *
& |' e+ J4 K3 \7 E* W+ f - * This program is free software; you can redistribute it and/or
2 P: n: O! O) m, { P" Z' X3 a - * modify it under the terms of the GNU General Public License as! k" f I- [2 s" o; [$ q! ]
- * published by the Free Software Foundation version 2.
0 I: l9 s/ x: O* i: n! K- t - *2 r9 U U8 Q; C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ T; s) ^! v! W - * kind, whether express or implied; without even the implied warranty0 Y1 W- O$ Y1 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' ]! P5 M* \1 F7 z/ g, d+ F - * GNU General Public License for more details.. w# y/ A4 j) X/ L3 n
- */! X; p& \, r' g1 S l9 z4 Q1 r
! L( l9 {# }$ M2 y- #include <linux/module.h>
: S4 r/ K6 R% j$ Q0 v - #include <linux/init.h>
* i# p. W6 w; `) F/ Q- z8 a - #include <linux/errno.h>% B+ v; S& \. Q8 S' R& |: A) H
- #include <linux/types.h>
2 O A2 L2 X2 ^" r. K - #include <linux/interrupt.h>
' O% k- A2 X. k1 y) X - #include <asm/io.h>; a) Z% {6 m; W6 K( C
- #include <linux/moduleparam.h>
7 b0 a f0 F }7 j& _' B - #include <linux/sysctl.h>! N9 A4 z0 t- i( c& S- g
- #include <linux/mm.h>
* p7 Y. H& O- w! A( B; d1 _: L; X2 a - #include <linux/dma-mapping.h>, b2 f8 n& S8 _, K- V/ D" x
- # A! T8 I3 t8 q1 c1 R
- #include <mach/memory.h> S' C- L7 M" ?( q, h1 [/ B
- #include <mach/hardware.h>9 |( v- N) a# @% e( J
- #include <mach/irqs.h>
* S" ?8 l3 E j C3 I - #include <asm/hardware/edma.h>
; \* J0 Y. v% L, x, S6 J - 5 u v2 @1 }9 F
- #undef EDMA3_DEBUG
+ `/ x" @& V! ]* I3 b% } - /*#define EDMA3_DEBUG*/! u5 `9 t7 h& _3 r
! o6 ^% s8 r8 @ w. ]0 H- #ifdef EDMA3_DEBUG2 r3 U* r$ t$ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' T/ G" W1 a5 F3 q* s6 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) z; b( Q6 w! j: q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, L: b' P/ Q' g7 u' f; L# N) ] x$ e - #else2 |2 b! ^4 [' f) h, U! |2 y
- #define DMA_PRINTK( x... )
' D* s3 A- T, g; z' T) r - #define DMA_FN_IN
1 R8 W9 ^7 b+ _ - #define DMA_FN_OUT- t6 O8 h# X$ \ l( r4 B q
- #endif
$ i9 `. ^; j& J4 v& m N
0 k8 O9 `9 K" e: W& t9 ?0 c9 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 H' z* V) C" m& H; \
- #define STATIC_SHIFT 3
6 k" i; s9 i! P/ V9 h! I% _ - #define TCINTEN_SHIFT 20$ z5 U) U8 o9 t& o( q) i4 Q: N
- #define ITCINTEN_SHIFT 21
6 o P1 q8 m& Z. ]6 Q" }6 I, s - #define TCCHEN_SHIFT 22
1 z6 Q, `* L; E: n: G4 V5 w - #define ITCCHEN_SHIFT 23
& w8 N+ `' v# [: p/ d7 L; b$ c1 j1 P - # u5 _1 v+ k$ j/ c! N- C d& M, m) [- s
- static volatile int irqraised1 = 0;" g H, s5 L, U* M, n) @/ A
- static volatile int irqraised2 = 0;
7 [; d+ i8 o, _- q3 p! h - * E. A9 d ~# j: `3 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h. i" z' @/ w8 e2 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W* A" B7 s; i8 s2 @) \2 y( z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. E/ X9 z! y& K+ |/ p7 Z
8 y7 a/ q& R5 z7 @9 S& E# x2 d& r- dma_addr_t dmaphyssrc1 = 0;6 y' x& N# K/ L$ _" Q
- dma_addr_t dmaphyssrc2 = 0;7 Q& {! k& i% V0 s
- dma_addr_t dmaphysdest1 = 0;! P% M/ P. K- ?7 \: X
- dma_addr_t dmaphysdest2 = 0;- k' ~3 f" F& O# y z5 B0 z' e
& G: j: g/ S" B3 j- char *dmabufsrc1 = NULL;) n% G$ }5 v7 M( x r# n/ h; j
- char *dmabufsrc2 = NULL;
4 d+ i( L' G1 q, b! J% r6 ^" G - char *dmabufdest1 = NULL;
7 R" {! R0 `2 H3 l z - char *dmabufdest2 = NULL;& K0 C/ ^# ^8 W5 Q* }
: C0 s6 P, Y& L9 T- static int acnt = 512;7 O! R: S/ D- Z, v' ?: U2 {1 A
- static int bcnt = 8;
. i( V, R: j) p0 D3 y - static int ccnt = 8;6 X8 f, z/ L- u& a/ d. S3 ]3 D6 c
- $ [- z9 b) a; b6 K" l
- module_param(acnt, int, S_IRUGO);
& D% G G) |& F0 s5 M( A - module_param(bcnt, int, S_IRUGO);
' X @# T2 N% s" l2 E% c - module_param(ccnt, int, S_IRUGO);
复制代码
, H1 X) `4 f: {" Z
( F* j. J0 V5 u7 |, C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: P4 q* ?, X3 g6 t, R' d) O9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 _/ K. q0 @2 {% |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ~" r2 f( U! |! V& e; q' [9 I4 _$ Z N$ d- e9 f$ _" x3 q0 D
3 Q) z8 C3 r7 J0 P2 h% I: c0 ~
|
|