|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ]" u6 }, K+ D" D* h, ]! Q
- [code]EDMA sample test application
, O9 K' a% g6 F) f0 B - /*9 Q0 w0 e) M5 |0 X
- * edma_test.c
N) u- Q. F. H/ Q' c' Z - *
- p% z K7 k6 `$ }# g9 l - * brief EDMA3 Test Application1 P; J0 J$ `- ^8 I/ |
- *3 T$ O$ k' R$ I7 i* ^
- * This file contains EDMA3 Test code.) d+ d* m& Z3 |: W. ]# K+ N' v
- *+ J! Z6 N: v, t) K" q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r0 J; r: @( B/ [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: }; G/ |1 k e/ G+ z - * TO CHANGE./ M: @4 p/ J4 q/ d3 k: z8 l) l' ]
- *3 P, V) g. f1 J5 w6 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 f5 l: f, h2 U5 U6 g( K9 ?* K - *' g) L( d; N9 h
- * This program is free software; you can redistribute it and/or
2 E7 U' {- P* g$ M* q$ u/ v - * modify it under the terms of the GNU General Public License as
8 @1 n, |# i* Y2 r$ i% j" i - * published by the Free Software Foundation version 2.9 l' [8 n8 y a. ~2 G/ K- `/ R1 I
- ** i" |% a4 E! m0 c. C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 @- q8 p1 y1 L* \( w
- * kind, whether express or implied; without even the implied warranty& l+ s4 Y& m/ {, ]8 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; [- _) \ G, x
- * GNU General Public License for more details.: u' h) e" @" S+ y% S L+ `
- */2 d' Y* C: p8 B6 n3 t( J
- / t3 A0 L9 G; H Q' T7 W
- #include <linux/module.h>
+ [& w, u) R# h' b* j - #include <linux/init.h>
: }) q) I9 }: R4 g0 b - #include <linux/errno.h>
0 _! d* K. I+ G4 f - #include <linux/types.h>
/ f5 v+ L( z6 p$ \6 k+ Q7 E1 R - #include <linux/interrupt.h>
( s/ |" ~ t/ X7 l S. w - #include <asm/io.h>+ p% i$ h! ^+ f. j
- #include <linux/moduleparam.h>" v6 }( [7 }% p( G
- #include <linux/sysctl.h>
0 y- x* ~7 x/ _ - #include <linux/mm.h>
7 k3 S% n1 _/ M% ]% U: r) E4 W7 g X - #include <linux/dma-mapping.h>
" h* M( g, N E+ v. r. O W. B
/ h6 e# X* z, y4 V8 n9 V' f- #include <mach/memory.h>
3 s( X2 z5 P* G, p* c$ m* B - #include <mach/hardware.h>
3 T- v% ]7 O0 j# o" w - #include <mach/irqs.h>
* c% g2 W' r g8 s# v5 c9 H - #include <asm/hardware/edma.h>/ S. |6 n! q& f& G
- * {5 q' C5 U! F: P T" @8 t: r
- #undef EDMA3_DEBUG! p+ L( u+ _8 k4 H3 n. R: v
- /*#define EDMA3_DEBUG*/
% A8 l3 I. M; A4 f' c- W - 1 Y, [! S' O1 @$ X/ a5 P( F. x. k
- #ifdef EDMA3_DEBUG7 s( U! ~) c' ^; z' r3 H! s6 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ r# `. j' g7 M$ e9 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 i; i: [9 v3 J0 L' Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 M8 X$ V1 @& @/ A - #else
|& v3 N8 f! V$ d9 c/ n - #define DMA_PRINTK( x... )( p: j, I: J+ j6 j6 }0 T
- #define DMA_FN_IN7 ?, Z& Y* n5 t6 K5 X/ y
- #define DMA_FN_OUT/ K2 g v8 Y; Z9 t% X6 H
- #endif
6 R8 w W W4 \8 `& O { - . O! U: [2 }) r/ @4 Q" {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): o6 ~1 h6 U) h2 M' g4 S
- #define STATIC_SHIFT 3$ w. l$ [) d4 n0 k
- #define TCINTEN_SHIFT 20 M! i/ Q0 e+ u+ q
- #define ITCINTEN_SHIFT 21
( ~: D1 @, s( G - #define TCCHEN_SHIFT 22
( i" P! |- E5 ~2 W( S, g - #define ITCCHEN_SHIFT 23
1 b, b0 z. \ Y - * S1 x) Q- p4 H3 t: K2 e6 a
- static volatile int irqraised1 = 0;
% v! j b* k G8 ?) m6 I9 P - static volatile int irqraised2 = 0;/ D7 P4 \8 M3 n0 e( U" |' U# h/ N/ k r
- 1 C) |8 o3 T$ [! I6 U' ~. ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( X$ g9 V E) I1 @# h( E& J, m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j2 ]% Y' L& b) ?* ?; }$ W' l. ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]" P/ p- A3 n0 A4 ^& i2 i; Y$ o
- V9 b) s3 U& H8 a4 I; p- dma_addr_t dmaphyssrc1 = 0;, @$ L3 \% j# H+ }' L
- dma_addr_t dmaphyssrc2 = 0;9 M5 e: x, \3 [6 Z) a2 o2 M
- dma_addr_t dmaphysdest1 = 0;1 c- q; ~( ^! K+ q" d
- dma_addr_t dmaphysdest2 = 0;5 K& g3 b2 Y9 ]% j' M9 [" P
( F% U: |% C, m: K/ b& _- char *dmabufsrc1 = NULL;3 A' d6 R8 N$ u! X* n: E5 p
- char *dmabufsrc2 = NULL;
( U3 e# ^: m6 M - char *dmabufdest1 = NULL;$ b7 T7 i$ C& J; A7 y
- char *dmabufdest2 = NULL;
" I1 u f4 c7 }/ @
- ^4 ^0 W: }3 j! D9 D- static int acnt = 512;; p6 G" v% p+ W9 `5 m% N! D# Z
- static int bcnt = 8;
( ?0 ]6 e! J% _3 I1 G - static int ccnt = 8;4 `/ C! `. Q) E8 _$ F: Z& m
% w4 `* w& U- Y. M5 p- module_param(acnt, int, S_IRUGO);
3 L4 I9 V- V, g3 l/ a - module_param(bcnt, int, S_IRUGO);
$ N1 \8 O6 R7 N6 F3 G+ K5 [ - module_param(ccnt, int, S_IRUGO);
复制代码
5 L: ?3 ]7 B H. E' H% h5 h# O3 _. F5 e( E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) q4 f* ]( L5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ^. T ~7 q3 I7 D; c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! W$ m6 x& D2 H/ u- w% J. S
/ O' j0 G- e. Y2 q! z+ b3 K& D- v" v& j1 A+ U( V9 ~
|
|