|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 D& Q& R! ]. p1 E8 C# `
- [code]EDMA sample test application- S' J# e+ Q( g
- /*
* F4 L3 H+ p1 ~& V2 Y# f. _ - * edma_test.c
2 ^0 f( u' ^2 `: f6 i( @2 T - *) x' D( { D; _1 P% H i8 R
- * brief EDMA3 Test Application. \- e5 h& A' _3 y8 [$ E
- ** a' I! |4 V$ I0 Q p0 b$ h+ y
- * This file contains EDMA3 Test code.
' j" d9 P; I1 u. a: `8 X7 _2 t - *7 [7 a6 g& J1 ~* g, c; `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ^! C* p) R& H( `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' E$ l3 Q2 H7 Q
- * TO CHANGE.
$ k% Q& w9 p x7 T; ^ - *
0 x3 Q6 ^$ g I: o5 Q& `. x9 q- V# T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ r/ K3 m7 J! m. n2 o! z; b G' w8 j$ ]
- *
( S0 r' |3 s% Y0 w' ] - * This program is free software; you can redistribute it and/or
% U/ ?5 n1 z) C! V& L' Q6 }, N - * modify it under the terms of the GNU General Public License as: m$ Z! p" S" v- L$ I+ D! V' S' \
- * published by the Free Software Foundation version 2.
" B9 W$ ^- i. {* }" R9 c! I - ** v3 T9 L) T3 t, v6 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ i7 Z+ [* ]8 S, t6 ^
- * kind, whether express or implied; without even the implied warranty' M+ @8 O2 X3 X. F) u/ J" Z+ E) Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" J- M$ F y. a - * GNU General Public License for more details.: o* |7 V5 O E- N! s
- */
/ @, z' c8 Z6 J
0 m9 ~# `; L. q- s) M- #include <linux/module.h>- Z7 s: Y2 \0 x6 i* P% P
- #include <linux/init.h>
# A3 Y& K2 P; n - #include <linux/errno.h>
+ G& g$ l) j+ i H) A& ~ - #include <linux/types.h>8 D j. [# _% X; X
- #include <linux/interrupt.h>
0 Y- J! d& S! j# @) y: }5 ~ - #include <asm/io.h>. ?" C- N2 k+ }3 y1 K$ n
- #include <linux/moduleparam.h>
$ S$ o w) f( S P4 ^! Q! Q - #include <linux/sysctl.h>
. x' a _! P7 o - #include <linux/mm.h>
4 ~% \" b u- U H - #include <linux/dma-mapping.h>
, F, w: L7 N+ S9 V E* I
$ w, k' u8 U% J- #include <mach/memory.h>1 ]3 D5 n/ k% r8 |8 o
- #include <mach/hardware.h>& [* B- d4 M! d
- #include <mach/irqs.h># F% @+ r9 `( Z1 T4 {5 t K- I
- #include <asm/hardware/edma.h>
, i1 z/ `9 F) e/ h7 s
0 B; B1 Z7 h6 v8 R" c" ]. I- #undef EDMA3_DEBUG
5 v/ H2 o6 }6 D! C. d& z - /*#define EDMA3_DEBUG*/
9 U0 Q8 s( w; a! G1 N: i - $ P% X% v" \6 t" c, L3 j* m6 Q% C; i
- #ifdef EDMA3_DEBUG
$ W1 s8 \7 y8 ^$ O0 e9 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) h. F7 T9 e5 t6 ]) `: Z/ X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ?/ r7 m: P. ]+ B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ O; f9 y0 R2 |% F2 h {, Q4 ~ - #else
+ j: D6 ?/ |% A+ ]5 O$ w - #define DMA_PRINTK( x... )
$ v" F* e: F6 @4 E3 u - #define DMA_FN_IN
8 L5 ?5 C- P$ v& |6 C! \ - #define DMA_FN_OUT# D. n; E3 X) z0 f; U4 \; t1 ^
- #endif: t; u) s3 h: n: h
. n9 C- J' k; |* ^# i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) o1 b+ U" l* @. s. k3 {: w1 a - #define STATIC_SHIFT 35 y; o/ r6 N! Q
- #define TCINTEN_SHIFT 20) M* ?, Z9 {0 X9 W4 e8 {, t& c2 {# P
- #define ITCINTEN_SHIFT 21- L6 K6 \, B0 Y* d1 i
- #define TCCHEN_SHIFT 22
' x4 s7 { Q4 a) Z - #define ITCCHEN_SHIFT 23; I" A q. ?" A' @: y
- + x, A: f0 q: x. b
- static volatile int irqraised1 = 0;
5 Z0 m5 E; ~0 H+ O: r5 Q - static volatile int irqraised2 = 0;# y- p) M5 j0 v: I- W# Z0 M
- - s. L1 |: S4 V; a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# U4 N) Z6 r: n) J0 y* P% v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [& G' \( t" N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B' p% O, X# k) r2 n, d- s/ {; G
8 q- S8 {- s4 w/ c- dma_addr_t dmaphyssrc1 = 0;
* e1 ~" f; G: e - dma_addr_t dmaphyssrc2 = 0;
/ z6 a7 k3 G: t5 D( a - dma_addr_t dmaphysdest1 = 0;
9 R# k% T3 g/ u! A5 d/ W - dma_addr_t dmaphysdest2 = 0;& P! V) r" I" o7 ^1 M
3 n1 A. i( @2 p h! X- D. j- char *dmabufsrc1 = NULL;
' m. S( s7 ~+ n6 P8 v - char *dmabufsrc2 = NULL;) n5 W: r% X& u# P
- char *dmabufdest1 = NULL;7 u1 X+ C h" C+ I& _+ V2 E' {
- char *dmabufdest2 = NULL;
3 ~6 y+ {& U5 @( E6 w3 C - / s- r0 f: I' W" w. A
- static int acnt = 512;! P( a [0 c9 H0 }+ x* J% ]3 H
- static int bcnt = 8;6 P- I' C/ P5 k: j8 G+ W Y/ o- }, f
- static int ccnt = 8;
9 e1 v5 Y* F3 G
4 {+ Q1 I) U" T8 q- module_param(acnt, int, S_IRUGO);
" K( g$ u0 f. I2 F - module_param(bcnt, int, S_IRUGO); t7 U. Z- d2 D i7 g0 I' l
- module_param(ccnt, int, S_IRUGO);
复制代码 8 ~# C+ X' u! g) N |( \3 _
7 E3 M( `) }9 d( B/ z# O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* q' }% v) K$ N- _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- P3 u- a1 j0 ^. x* W) C2 r/ e4 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' N5 _8 c) m' A5 k. `2 P/ ?4 k6 \
6 Q' K1 k j: ?) C# D( Z
9 U/ R) \" n1 r, N6 K |
|