|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % [3 n: h" ]. w2 H
- [code]EDMA sample test application/ [5 O5 \9 l* J, r
- /*% E; E2 ^- D6 d5 j3 U) W
- * edma_test.c, N9 n+ V1 m& r R# d$ Z
- *; S- T2 O' a; @% ]( a' o; x
- * brief EDMA3 Test Application$ c( m7 k; P% ]6 Q0 ]4 |/ J9 O
- *
, P9 e' i$ @; ]5 j# P! P - * This file contains EDMA3 Test code.$ J, ^) w: ?+ q, Q
- *' R4 `$ }: t$ ?+ r3 Z/ m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( S8 |$ Z. h9 h( q! z# c$ e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% L' b5 B! j% ` - * TO CHANGE.
5 H- X( C& I. h- T - *6 i. P2 j( q0 o/ p# o: u- X) M4 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 _" _/ _4 B& _ \( u2 _ - *
& p$ e; X0 m0 \ - * This program is free software; you can redistribute it and/or7 r4 _: B. p, {* ^! N7 I
- * modify it under the terms of the GNU General Public License as0 c% F! Q$ z8 M* Q
- * published by the Free Software Foundation version 2.
/ s2 f8 ?# p1 i N9 [9 a- ^1 S8 K. e+ C& H - ** @6 w& d) w; F- s8 d5 b e# I; E6 u: j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 v# k3 \. h6 x, X) {3 \7 n9 A
- * kind, whether express or implied; without even the implied warranty
0 ~1 Z. Q5 l/ E5 W, }- K0 K c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ~/ F5 d* k6 n3 w4 P
- * GNU General Public License for more details.5 x( p' t9 D' u% e) e+ @
- */
8 U) ?& o5 }$ h3 E- A u
' p8 Y6 o9 O, k- #include <linux/module.h>$ D4 ~9 ^" J \- ^' t0 }' H4 X
- #include <linux/init.h>
5 x I) I" V5 g+ F, u Z5 }' i - #include <linux/errno.h>
1 z2 j2 e" C9 P, x9 f) |+ Y - #include <linux/types.h>
4 |. E: q) ~/ c% C5 v2 } - #include <linux/interrupt.h>
( A7 Q' Q4 Z2 _8 W9 i2 o# u - #include <asm/io.h>
& S9 K% i9 z& M* f! [* h: _+ S- { - #include <linux/moduleparam.h>
! v/ i0 B( e# j ?3 N+ u; o - #include <linux/sysctl.h>
4 j# q, s3 E! i7 H8 _ - #include <linux/mm.h>
- L) f. w! K" i& C; |6 j0 T3 I - #include <linux/dma-mapping.h>
- P* M, U: I/ W" |1 R
& t9 h. Q" _0 w7 H- #include <mach/memory.h>
; H5 o/ V+ S7 \5 q5 K, S3 c$ v - #include <mach/hardware.h>/ ~% b* ?' \" ^' J
- #include <mach/irqs.h># o$ M. V2 d, ~' d
- #include <asm/hardware/edma.h>
; |; k- p. i+ E. i8 } - ' g9 B9 a' j/ H# d9 r* B, Y! V2 i
- #undef EDMA3_DEBUG# ]# s% n7 u% P1 @; C5 |7 V
- /*#define EDMA3_DEBUG*/6 w- ?: A. z! S# {9 y- d
- 0 }$ F& l$ V6 D3 N
- #ifdef EDMA3_DEBUG
4 O7 L' G" A3 M+ i/ P+ f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- N& Q/ i0 o5 R. H' A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; x) ?4 G. E& [7 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: G6 q8 [8 X- F6 H, A; X6 X - #else( S3 S* B) V: W. ~# O
- #define DMA_PRINTK( x... )
4 y* f* W( l4 K( j - #define DMA_FN_IN3 H( o/ d: ^# P/ T6 q
- #define DMA_FN_OUT
8 H5 w1 X2 Y' a, G - #endif
' K4 O6 A6 D. O1 ? - 5 D9 r4 ]' O) [8 G8 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 s( y& I* V- v6 q3 {* _
- #define STATIC_SHIFT 3
5 L9 d9 N9 Q: E8 a" }0 i- j - #define TCINTEN_SHIFT 20( I" A3 |; f$ j+ A' n' q. }
- #define ITCINTEN_SHIFT 211 y; |% w) G* M+ H i( [8 T
- #define TCCHEN_SHIFT 22* l% M' p& m* z9 a8 |
- #define ITCCHEN_SHIFT 23
* L" Q6 S, I; U" R0 b& c( r6 g) g- x
4 H* J- m. j- v2 a- static volatile int irqraised1 = 0;
4 U7 W4 u) [6 _0 V - static volatile int irqraised2 = 0;
% g' [" u9 d$ E) b0 ~ - % J; n' u8 a- C; i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) S1 M$ `1 l4 e3 J( B1 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 n7 M: [; Z) a' O- i) \9 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ~! \& ^8 r( a$ U& W+ [7 A! u - 9 k9 U! }# E8 {2 u1 `( k6 c' r/ B7 v
- dma_addr_t dmaphyssrc1 = 0;: j( x5 p1 s; `* u. i
- dma_addr_t dmaphyssrc2 = 0;
% Y' l# G! A" [2 `7 W1 V6 q# u - dma_addr_t dmaphysdest1 = 0;, L) B, P$ H! D2 y0 Q: u6 J
- dma_addr_t dmaphysdest2 = 0;' y4 i9 C! V3 L ~
- 8 Y" M7 ?9 n4 N2 }% j
- char *dmabufsrc1 = NULL;
\8 G2 ^- @% W. c' G6 V - char *dmabufsrc2 = NULL;
0 Q, ]* G* I8 O5 C' X- s% l - char *dmabufdest1 = NULL;: J) R Y1 B; s j) g# C
- char *dmabufdest2 = NULL;
; }* Q* T4 w7 ~# V% W, u! M$ f - + t: x3 `) l/ k6 S }) v) ]
- static int acnt = 512;" ~# j9 m% O) E6 O1 ^( Z) ?/ J, ?
- static int bcnt = 8;
0 g/ x. P" z2 z- ], i - static int ccnt = 8;
' p# N- C' h* a5 u. T
; `# m4 @ @- B o& k- module_param(acnt, int, S_IRUGO);# S8 S; R: b6 b8 L
- module_param(bcnt, int, S_IRUGO);
( |9 ] X8 V* w5 a! q% `, q% ]4 Y/ U# @ - module_param(ccnt, int, S_IRUGO);
复制代码
% Q: l1 A1 W# ^- p
9 f! c5 W4 W, `$ B# h7 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 i0 h' d% L. P# C. G- u7 `5 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ a/ V/ _4 h! M* v+ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" g: S) r, ^1 p
; s- G. V, _4 m! U8 C }6 i
4 K2 l, C7 Z8 n2 `) E/ X
|
|