|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - F7 F2 Z) _- l
- [code]EDMA sample test application
c# a0 t( H7 P" E( \ - /*
" i, l9 V9 l/ i& v- q/ H - * edma_test.c
& h0 ?) F/ r% V - *
! y4 w! L! P8 ^8 [ J4 D - * brief EDMA3 Test Application$ B/ Q7 _ R9 Y4 U2 d
- *% P9 {5 y+ F5 i4 `7 g# l
- * This file contains EDMA3 Test code.
0 Z8 z. C# |7 E) O( |$ k& M0 o - *' f7 `$ o" A" w. f& t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C, j0 t& a: ?+ v/ \0 H) G" }8 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT a/ p* _. L8 ^. { R5 @' T/ t2 [
- * TO CHANGE.
# k2 w* z# e) K - *
$ s5 ?+ L. Y) N; i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' l( `1 j6 K% w( l% M
- *: {0 D4 X4 M& M$ K5 h
- * This program is free software; you can redistribute it and/or
5 G/ u5 u$ h- x$ \ - * modify it under the terms of the GNU General Public License as% b1 G( ]; v! M' Q7 h' M9 a
- * published by the Free Software Foundation version 2.
; Z+ T& M' G, i! ?6 E, w9 f1 m - *
E( ~- f i5 C; t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ T) Z& s, T4 ~4 z8 t" w - * kind, whether express or implied; without even the implied warranty f5 G/ {8 W3 r8 A, g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 a6 N- c# N }& R5 a/ k
- * GNU General Public License for more details.4 A+ ?* r5 q4 @6 g# v# F$ |6 q
- */
( ~' r) s1 [4 C% @0 ^ A/ g
0 }& u: x. b. S7 C- #include <linux/module.h>: e" R2 ] j5 f, f* W; x
- #include <linux/init.h>& c8 {% ^" q+ `: ?1 U1 z
- #include <linux/errno.h>
6 y! R( x% h+ f& @- {- R - #include <linux/types.h>
/ ]% v3 D% @6 V& ]' b/ l* H - #include <linux/interrupt.h>
9 v6 s4 ?* |; v4 A/ i - #include <asm/io.h>
4 |- `0 L" r5 G/ t. N - #include <linux/moduleparam.h>
( `! m/ J- x2 p - #include <linux/sysctl.h>
/ }4 U9 X6 ~5 Y: T6 _ - #include <linux/mm.h>% Z" B7 v/ j! E8 N% v2 T
- #include <linux/dma-mapping.h>* d7 {* q3 L( _4 ?8 z: j; v
- ( B- \, [3 z3 J9 I/ v
- #include <mach/memory.h>; A9 _& r2 {8 l: c0 k2 V0 [
- #include <mach/hardware.h>
, {+ W* g$ j7 D" u1 }9 D- V q' R - #include <mach/irqs.h>+ p/ {; T3 @; [
- #include <asm/hardware/edma.h>( g/ N) Z' ]! [3 A/ z
- # R( T' a Q' o6 \
- #undef EDMA3_DEBUG1 _, k) Y9 H3 o+ d) u
- /*#define EDMA3_DEBUG*// U- o' G1 K. _
$ X3 @4 U- f! U( J4 C$ N- #ifdef EDMA3_DEBUG, l Z, E6 M1 u6 `) r! s4 e$ |/ D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 M; c9 p$ r7 s* H- q/ j) T, B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 c6 ^- s! F# F: X8 p) i0 p5 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. G# n. e, l4 K% H - #else" q E% R. z5 z* e
- #define DMA_PRINTK( x... )
8 o1 A" Q- V* w% e8 S8 t - #define DMA_FN_IN
4 s1 _ \/ f. C( c: H7 H - #define DMA_FN_OUT
L- Y$ _: E. W, `1 l, W1 J5 K( F - #endif" b4 P) ?7 R" e* G2 i: f4 N( {
, k! }! ?/ ` A8 e: {2 v: s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% |3 q1 R9 V3 m+ n; f7 p - #define STATIC_SHIFT 3
' n# s. n" L7 L: L - #define TCINTEN_SHIFT 201 i0 `9 p6 X1 a% B2 f! Q
- #define ITCINTEN_SHIFT 21
% [: @& K6 x: X( { e$ [' B9 X - #define TCCHEN_SHIFT 225 y7 T/ {* |. N* ~
- #define ITCCHEN_SHIFT 23, p' F# W; m/ _' p, H V2 h2 b
- . e7 g( W5 K D
- static volatile int irqraised1 = 0;
- i: Z: {% k4 {% K. J4 W( W! x4 U - static volatile int irqraised2 = 0;5 |0 Y6 C. o" h
2 Y, i. u n q, m" ?* w2 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ]; T& m( Q* U4 d0 i+ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [& |* M( ?4 \& m7 X7 X1 S9 w& C/ `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 T! b% N7 Q/ `. F& l
% \( Q4 Z: |: J$ ?4 f; ]- dma_addr_t dmaphyssrc1 = 0;) B2 T, D- o$ b4 V" V3 S
- dma_addr_t dmaphyssrc2 = 0;
! J# |7 R x' U! P! u7 c - dma_addr_t dmaphysdest1 = 0;
3 t) R$ N9 b% i2 M8 R - dma_addr_t dmaphysdest2 = 0;, J% M, R n, L n, }
- 2 Z* N7 i; s* a% l
- char *dmabufsrc1 = NULL;
4 {* X! Z( Z- m5 V0 B6 B - char *dmabufsrc2 = NULL;6 l7 @: v# ]" I6 u
- char *dmabufdest1 = NULL;0 c' ^* n/ r: A3 J
- char *dmabufdest2 = NULL;
# G* S# V3 \1 G
" J6 A% d% G9 V* z: R; m- static int acnt = 512;
2 X5 `# H6 E7 H7 ` - static int bcnt = 8;6 l3 p5 l3 U4 f$ z+ W5 o
- static int ccnt = 8;
/ t8 Y( Y& R( p( b - 4 b9 j g3 [- `9 P, j
- module_param(acnt, int, S_IRUGO);
, |) ?) Z# Z3 M! `. L" P$ o - module_param(bcnt, int, S_IRUGO);
6 m4 L6 `1 E' S) }4 K, y - module_param(ccnt, int, S_IRUGO);
复制代码 3 F L( k( n9 e# b2 D# E' v
) @" O$ U( r2 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U3 p+ d3 Y6 G& l: Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- T9 r9 U( t) A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; c1 f; C2 x$ j1 I3 P$ }; o2 q6 b& E* h) h8 B9 N
, l |1 s4 I5 t |
|