|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 s- e: m! \! j2 y, F7 Y$ T9 `9 g B- [code]EDMA sample test application
$ [' m/ z6 M! m5 _ - /*% G3 F0 f0 |9 q7 Z
- * edma_test.c) d; [' E5 Q. P2 N
- *
+ Q( q ?. l5 G% J - * brief EDMA3 Test Application
# {! G$ \: m2 p/ N - *# L" \/ h( l: {$ D
- * This file contains EDMA3 Test code.
* R( M) K6 Z; w5 a4 A% @" U - *7 n- ~: ^% m: p6 J- O4 D" h7 M% Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 p5 F2 z' h2 Q. v$ t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 c' ^6 K4 D: M0 A9 C# p - * TO CHANGE.
( s: G ~3 I: @1 Y' x# p7 a - *% S" J% I8 V% x& H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }! M$ X A) ]3 I0 P
- *$ [- F% B, l3 }% T% x: C
- * This program is free software; you can redistribute it and/or
3 L- { ?9 H* P - * modify it under the terms of the GNU General Public License as
0 ]' @5 J, f& a; c% W1 I - * published by the Free Software Foundation version 2.7 s& _, c# v) Y5 `9 _ T
- *: x3 z ]3 R2 c2 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 J$ D# V+ B6 B7 R3 j* z. S6 |+ ? - * kind, whether express or implied; without even the implied warranty
# d$ W \% j) w8 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- b3 ]' M: ^, p- L; t - * GNU General Public License for more details./ ?) p8 w+ C- I* D9 p$ j5 I: u
- */
$ n3 k+ G# P4 H( f% W w - $ M& `& E9 W& n$ |2 {8 M6 A- W* Y) `
- #include <linux/module.h>+ a N$ _9 K1 p$ s* z8 j. _" T
- #include <linux/init.h>$ _) }* R2 v& w6 |0 j9 K
- #include <linux/errno.h>
" y1 i1 B0 k' O; o6 N% {0 \; ?5 B - #include <linux/types.h>
% {+ B- {. J0 B# n - #include <linux/interrupt.h>% z/ r2 w+ F; f! X" I3 o
- #include <asm/io.h>
: h5 u+ S# [) P2 ]; G$ } - #include <linux/moduleparam.h>
. D- s, d# \- W% f - #include <linux/sysctl.h>
% K0 v7 |: o/ O( L$ _" ~' ~6 b - #include <linux/mm.h>
; Q# u) l0 `* t. { - #include <linux/dma-mapping.h>3 ^6 I5 [! F: s" t2 X j
- , X/ ?' B# z& A2 P- D& ^9 O+ D
- #include <mach/memory.h>
$ h# Q! _) f8 {3 ]0 l& o; q: x - #include <mach/hardware.h>, l4 J( w3 t2 Q; i, P% G8 C1 m
- #include <mach/irqs.h>
, K6 |! r% V8 `, B, D9 s - #include <asm/hardware/edma.h>. w' ~7 U, ]/ Z9 O/ z G+ X5 Q4 F. O
; B/ G- q" b3 X7 `/ A7 b3 v- N. Z- #undef EDMA3_DEBUG5 `. H/ V5 e) P3 S% d
- /*#define EDMA3_DEBUG*/
" K( R& M7 u- d9 C9 S0 P
6 o0 B6 V6 C2 J! D. N- #ifdef EDMA3_DEBUG2 u6 c3 b6 A7 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) o5 Y( [5 _; E- q# p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z8 C) z$ B; A3 P2 f$ \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N, n7 m4 S4 t9 K' x
- #else
: y5 O: N% j a* G; U' g* W, S - #define DMA_PRINTK( x... )
$ q7 q9 q- H1 e( p8 l, j - #define DMA_FN_IN
; N: w" u0 e: ~: ^/ @5 g - #define DMA_FN_OUT
7 ~+ Z; c; Y0 s9 P5 g$ i' a - #endif" T! d7 k5 R& h$ y2 L z" k
- ) }* _; n, {8 ?1 w3 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ g3 v8 r, M1 y- K+ b - #define STATIC_SHIFT 3
' A5 B3 o! G1 r; B) G( ^ - #define TCINTEN_SHIFT 20, t8 t6 B k$ L/ ^
- #define ITCINTEN_SHIFT 21
8 K' I. j- b7 ?! v) H - #define TCCHEN_SHIFT 22
' d' r. N4 }# j9 D0 \5 e' ] - #define ITCCHEN_SHIFT 230 d* |. B4 J0 f2 }3 V
4 N/ C% z- f y' S6 i- static volatile int irqraised1 = 0;! |. }( K" E5 G% y5 [7 _9 p
- static volatile int irqraised2 = 0;
5 _! x1 m, q( s; n! a% @ - + I* w7 V" l4 o1 k6 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R. C- `! z, d9 C, L2 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% r) A1 e8 V& |( |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); k( u% m6 f5 b6 R9 k' @
- / |6 g, x7 v% v8 f: @
- dma_addr_t dmaphyssrc1 = 0;: V& y& W: l! {- A& Q( q* M
- dma_addr_t dmaphyssrc2 = 0;
4 {, F- }1 |, y) H4 \ - dma_addr_t dmaphysdest1 = 0;
2 L( I( d6 H4 K; f - dma_addr_t dmaphysdest2 = 0;
# ?) ~$ h. y7 d4 L1 K4 _8 r
3 t) j& E8 `% }2 z- m% [/ |% j) r- char *dmabufsrc1 = NULL;
/ O: A4 r; a) C9 G - char *dmabufsrc2 = NULL;4 ?/ c# l8 N; n8 h( { }
- char *dmabufdest1 = NULL;9 U5 N; V: i) O
- char *dmabufdest2 = NULL;: `" o- y. q; ?) _+ q( K
5 K" A% k0 _8 I% x, P- static int acnt = 512;0 s" ?+ L' Z7 c! t8 Z* R& d
- static int bcnt = 8;, ]. g6 H# V' D2 x
- static int ccnt = 8;
+ j+ d1 S2 w* N+ i; }: F - 3 j' B9 t% _# o C
- module_param(acnt, int, S_IRUGO);$ V* D6 y& A7 l2 L0 H3 v5 F- m) p
- module_param(bcnt, int, S_IRUGO);! i+ g1 s- _+ V2 o0 {+ U; ~1 T
- module_param(ccnt, int, S_IRUGO);
复制代码
/ i( u' b* ~7 A R3 O0 U( R
/ D( K" f0 I& v y6 R! t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; O3 S, Q; y( a# R, H: f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% V9 N- n, q; c( ?3 O; e: ^0 E/ L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) n1 A4 ?' @# [# T, M, H
v8 G. m+ H, k% ?. f' ?5 e! v, d( M& U3 E* _( @; \% \
|
|