|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . b$ n$ T# C# L& g( M+ h" P
- [code]EDMA sample test application
+ A. t! T' H- L& p; e* O$ h* u - /*; O/ t1 m) K3 @
- * edma_test.c9 }3 y6 y0 M7 R9 F1 }; U9 g
- *: o# S9 U- E: W" K2 L
- * brief EDMA3 Test Application
: p: m( D3 r5 p# e, O' Y; Y - */ d# N( o# a$ r/ `6 t4 a
- * This file contains EDMA3 Test code.7 q$ v' Z7 M# ~, \$ Q* ]
- *
8 k1 ^% x0 x) j9 i% t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F6 i5 C7 Q" N4 d, W: ~. y# i; s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 R! _; z1 g( ^8 P - * TO CHANGE.5 V. o) p, t* P+ a) l
- *% j+ A, m% D1 z% N; ?: `2 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. v4 s2 Y ^1 R) I - *
5 v( P7 u; [' {- `0 r- V0 v - * This program is free software; you can redistribute it and/or$ N3 N( C M. K, E! T$ e7 l& q
- * modify it under the terms of the GNU General Public License as
+ h/ P- L! `4 d5 S( ?. X# k - * published by the Free Software Foundation version 2.% z6 y4 I) Z/ h+ z5 s. F$ f
- *( f! [( k7 L6 w% l9 z% D% t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 d& Q; t3 {& @; r3 W - * kind, whether express or implied; without even the implied warranty0 ^9 [2 b2 M+ G1 X4 p7 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 P! V0 k4 `" G2 Q8 I: Q
- * GNU General Public License for more details.
% ^) y6 G# O0 }$ h! E1 Y0 c - */
8 Y1 \5 t: Z6 \3 [% | - ! E% U) W4 T. P) ~: ^
- #include <linux/module.h>
5 f) p* I8 I# t2 y - #include <linux/init.h>
* h9 D; z2 S2 _3 l$ b - #include <linux/errno.h>; C& r6 Y/ ~- J i' E* W$ v
- #include <linux/types.h>
8 G" w6 R6 G2 p. d- ?& F - #include <linux/interrupt.h>4 ^' _- p8 d0 Z6 j# A+ j9 K8 k) Y
- #include <asm/io.h>
; d; }2 d3 M' z, N( Q! ~ - #include <linux/moduleparam.h>
1 s8 B4 M0 \9 Y/ |3 J* F - #include <linux/sysctl.h>, a- M& K; s# @
- #include <linux/mm.h>2 w8 k- |+ z0 d
- #include <linux/dma-mapping.h>- |8 W$ p$ K) a% x' r% }) z
# K, l+ Z' Y0 `. Z# \! L. `& A- #include <mach/memory.h>7 T$ ^: a2 J3 u( J% H2 ~$ P& M$ N
- #include <mach/hardware.h>
/ H6 a: `# H9 R - #include <mach/irqs.h>. O- P0 j1 _7 P0 p; h
- #include <asm/hardware/edma.h>
0 F" a. V1 [. I1 _+ s: v
9 O3 W% `( @" a7 W7 r8 I# x- #undef EDMA3_DEBUG
6 b9 {8 C3 ?. N5 H: w - /*#define EDMA3_DEBUG*/& n( L) a. M4 e) ]+ N- I
- 1 N5 x* x8 x. w$ c* `
- #ifdef EDMA3_DEBUG/ b: B" |$ V7 ^. K1 M" U) e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); W9 H+ j3 I- f. ^# V6 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ f) |4 W4 [4 g9 ]$ n% _0 x. I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): |# j: _1 K% ~& B5 H: x( K- N( i
- #else
# Z4 q9 J3 ^( ]1 i; f& M - #define DMA_PRINTK( x... )
0 }" K" z5 w0 W8 O8 w$ J - #define DMA_FN_IN$ x1 u. e4 E8 z7 _1 v. E
- #define DMA_FN_OUT6 ], W7 {7 h) z! D7 [; {. R
- #endif
2 U6 ?2 \( K4 ^3 r2 `: h; G2 r; y
. X% }3 {" p5 Z6 e- a/ I, }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( p" ~" ~7 \1 H - #define STATIC_SHIFT 31 x- M7 Z- N" A
- #define TCINTEN_SHIFT 20
/ j. s% y. I9 h* t, m - #define ITCINTEN_SHIFT 21 y/ f# z% b$ E- a' F7 s6 k8 P
- #define TCCHEN_SHIFT 229 x& o; ]% D1 j3 B& `4 C
- #define ITCCHEN_SHIFT 23
$ M E* N, H2 l9 O @
% ]* v+ V2 O v B- static volatile int irqraised1 = 0;
5 k) A- p+ `9 f! h& h+ d4 i - static volatile int irqraised2 = 0;
; a1 F, n9 {, Y4 j) n' \/ G
, y" W: U8 U2 f, W! {% j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \4 L( S- m+ y+ u3 l& [0 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q1 l1 ]. e8 F4 A) v% w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ t4 U3 B* J2 i" Y- }/ E
( I5 D Y9 u4 l, [/ [& ?- dma_addr_t dmaphyssrc1 = 0;
: v/ p& q; G: T& |" l2 C8 G! N - dma_addr_t dmaphyssrc2 = 0;
6 |9 K3 T1 B. i( f" w8 E - dma_addr_t dmaphysdest1 = 0;
* U* b4 q. z! t: m5 p - dma_addr_t dmaphysdest2 = 0;2 r/ l% L( @. g' N
- * K7 g. M; N/ f& J/ {5 f, Q9 Y+ Q
- char *dmabufsrc1 = NULL;
0 C6 n$ b9 {" d - char *dmabufsrc2 = NULL;
- S9 t9 S: s' N6 Y. H - char *dmabufdest1 = NULL;
6 U% @( L5 G. v0 L2 L% |! t) z& x - char *dmabufdest2 = NULL;
8 G+ @: b" f/ w - 9 m0 E; g8 P4 |# u: U
- static int acnt = 512;% z1 l- j3 s& i7 f8 Y
- static int bcnt = 8;
8 @! J1 ~0 f" S- T - static int ccnt = 8;
8 z9 o# F& g. r6 j - 7 W- M$ J! R6 D/ A1 d; ?
- module_param(acnt, int, S_IRUGO);
; K1 L( x% x A& z- c - module_param(bcnt, int, S_IRUGO);
& U( l9 H0 }! `: B: h: [( | - module_param(ccnt, int, S_IRUGO);
复制代码
% u8 A" R: S% D" c
& @ B9 h( A7 K) M L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 I8 G( _0 [+ i3 P* i0 S. }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: R/ N5 v, ?4 _! Y( Y; v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ b3 Y% c/ k/ r& i6 v2 A {
) Q% N' A) l" i8 d& r+ K& P) r7 U) K3 H" X( Z: Z9 V
|
|