|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 P& C9 m( a+ k; d- [code]EDMA sample test application
3 v/ P- e2 q* ]/ s - /*
$ e% `, @3 i( J. O: z7 N - * edma_test.c
- R: Y E3 @1 ~$ V Z1 z4 X - *
: v' Y! S; m1 t5 Q/ f - * brief EDMA3 Test Application1 L: ^1 @- _# }3 g1 J, c
- *
% a0 \( s% k# @' s) F. ? - * This file contains EDMA3 Test code.
; O9 _8 y$ k* J! v! p2 C - *% g4 J6 k' Y) p; E" J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 F; }. I4 X1 J% b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: @" H/ v' Y* Z. C( g0 G y9 D
- * TO CHANGE.
0 Y4 \0 p$ g( x i' ]* s; C) r) b - *% p4 ?6 }( I% N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# R9 t, e- J4 D- s0 ~
- *% W& C& D/ ^- z" K/ h5 E" v
- * This program is free software; you can redistribute it and/or
5 x8 z$ {0 O6 l; { - * modify it under the terms of the GNU General Public License as
) ~# I0 M9 J8 [9 U6 A& W - * published by the Free Software Foundation version 2.
4 L2 E+ t: m; | t: D& S/ I0 n - *$ g1 b2 B2 z1 ?: w9 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Q1 N, U2 X1 M6 K9 |- I8 A l s: ?
- * kind, whether express or implied; without even the implied warranty }/ k: `# k3 }# Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 Y8 L+ U8 V7 L. y
- * GNU General Public License for more details.! h& C8 J" j( K( q* f
- */
, z: C/ \/ w. Q# n( T0 [5 g% s. w
3 d+ x4 e) Z6 O: n* B! C0 L/ A- #include <linux/module.h>3 O# y9 V& m7 Q3 A! n" |
- #include <linux/init.h>1 G! C0 P& c' O5 j$ [
- #include <linux/errno.h>
) P y" { o3 @4 V. ^) C - #include <linux/types.h>( G; Q. c+ K% l9 f8 F
- #include <linux/interrupt.h>
6 O1 P, J1 i. Q- ^ - #include <asm/io.h>
- S9 U* e* u' A8 s - #include <linux/moduleparam.h>- U# z& I, m5 C$ g5 r* C! Z
- #include <linux/sysctl.h>& G7 ~: U6 s; H6 b# z I) D
- #include <linux/mm.h>1 v$ V* W4 B7 |0 Y1 e2 F
- #include <linux/dma-mapping.h>& P5 w$ N r9 F: v) A
- 6 T" F D, Y% m
- #include <mach/memory.h>
0 H+ g8 B6 z& T' a7 b$ v P; F - #include <mach/hardware.h>- D9 A0 m3 J+ B7 _2 l
- #include <mach/irqs.h>: p3 i/ W& ]( p' j/ e
- #include <asm/hardware/edma.h>
5 J" S4 F$ i0 F1 @: _4 H! B
$ L8 u5 f: d3 F# R9 f% f# I- #undef EDMA3_DEBUG
3 I1 y' T/ x) o$ \; G6 o - /*#define EDMA3_DEBUG*/6 j* G- \9 b% A1 B/ A% w) Q# q2 e- |$ M
6 }: d8 U( d) _: R+ d2 E- #ifdef EDMA3_DEBUG8 M, o$ S' ` u: l/ M: U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( M( `% J: g, F$ h& o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
x) m% @1 C1 u8 K' C0 P" Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& ^% T' D# W W6 }. D; n) [) U - #else
3 ]; r. {8 g) {2 v: | - #define DMA_PRINTK( x... )
7 x6 j) U8 \9 ^& |5 i9 T4 G S - #define DMA_FN_IN1 O6 |( y& @5 f3 p" @( o+ b3 W8 B
- #define DMA_FN_OUT
/ d2 s) s% j' S* R! T - #endif0 }: R( v( V' P% z( a
- 0 |; A; u9 }" w5 \+ [1 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# U% a& b2 `0 R* v! V
- #define STATIC_SHIFT 3
2 }6 n6 C9 O; N A" ^8 k6 h+ u - #define TCINTEN_SHIFT 20
& {! w8 Q' ]1 D) x9 ` - #define ITCINTEN_SHIFT 21
2 H5 S m! t# W" l j3 f - #define TCCHEN_SHIFT 22
' ^. } c( I4 U9 c - #define ITCCHEN_SHIFT 23
& s3 Z* q1 L& B( l
9 ~2 S3 r% Z, J, o+ L- static volatile int irqraised1 = 0;' N* w; I1 k2 p3 d
- static volatile int irqraised2 = 0;4 [* [ q B7 a$ y( v* e
- / k2 M7 c- N6 |" B# \; C, u* I, S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q. \' g, E6 C4 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- y* {4 U$ W4 v, c/ G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n/ f) ^( T9 L' T6 _
0 s, Y) z6 \. O7 c/ e/ z- dma_addr_t dmaphyssrc1 = 0;
5 i6 J+ Z z2 f- i- @& f/ w/ I - dma_addr_t dmaphyssrc2 = 0;( T* \9 z1 u( L" x, {
- dma_addr_t dmaphysdest1 = 0;! r" {2 z5 H- b! C! R( I) ~0 _
- dma_addr_t dmaphysdest2 = 0;
( e" h! p% b7 S+ q. K
2 N( @) j2 ^: ~8 ?3 I, U* c- char *dmabufsrc1 = NULL;
: @6 G! I! G" O- R4 L Q+ X9 g - char *dmabufsrc2 = NULL;# C8 n& C7 z+ w) M& _- K/ y
- char *dmabufdest1 = NULL;
' _& b5 }3 J- M' q" `- y4 S - char *dmabufdest2 = NULL;
+ G% L# n! T0 t- ]
) S5 ?; o* |8 C& M2 J# I- static int acnt = 512;( v6 e) Z5 w4 M9 L
- static int bcnt = 8;; ] a6 S% j! _: p1 X
- static int ccnt = 8;% j b; N+ M" P
- 1 e7 ~- n1 d& f" j
- module_param(acnt, int, S_IRUGO);: r6 r+ F' h7 v
- module_param(bcnt, int, S_IRUGO);
& p$ K7 c3 _3 ? - module_param(ccnt, int, S_IRUGO);
复制代码
2 [; v9 M `" H: r9 f7 _
& x2 {0 l# G: D! f X3 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 O# i2 k" F' ^5 |# c: Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 W, c$ q4 t4 d" W* F6 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; e7 R2 }1 C) L
+ Y4 e4 ~* [6 J6 a4 m) V" p& t9 m
. [- m3 H. ]! z" o* r( H S |
|