|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ~* \* |9 g/ U- d3 S7 n
- [code]EDMA sample test application3 y" l& g4 U$ U5 |
- /*" R: r Y& h9 A+ P5 I- o
- * edma_test.c
3 Y4 |: |4 ~6 I7 I4 T: T - *
* C$ v2 y# d% l+ ^1 r2 S3 ? - * brief EDMA3 Test Application" j; } j R$ V' _4 r$ v( }
- *$ P- f2 c4 F% F+ E
- * This file contains EDMA3 Test code.
1 h* {0 D8 w/ V2 L - *
9 Z) {- W$ Z u: Q+ O% P0 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 S) F* n9 Q* d- V9 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. M E1 D' O1 f: B: s. U& O - * TO CHANGE.
" b7 g2 f* D/ S - *
& Y2 L% x- q1 _6 \" S- R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 J3 T: c6 L$ @1 P. k - *
X+ B( D& K' u) f! N* n [. Y u - * This program is free software; you can redistribute it and/or
[# S0 r9 L* ~2 [ - * modify it under the terms of the GNU General Public License as
* x v/ v, \* R% B/ H) P/ R1 B: k - * published by the Free Software Foundation version 2.6 S8 S9 L. X# B- Z
- *
8 ^; W$ |# P( v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( f, C" D K8 q2 S - * kind, whether express or implied; without even the implied warranty
7 h) k6 K: b" k0 J2 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! X8 a- |! x- n; y. W" i& f9 k$ ]
- * GNU General Public License for more details.7 H5 n. D! v0 W+ P/ r0 m0 Z
- */8 S8 P P& K- }% v
+ R1 j6 ~. [' Q5 j4 E5 l# E: E- #include <linux/module.h>/ t7 X0 {- k" A1 m( S. c
- #include <linux/init.h>4 m+ u& A J: u4 h& ?& t
- #include <linux/errno.h>
- i- _; Q) }7 r1 Y/ `* Q - #include <linux/types.h>/ _: V2 Z% y# r3 C* j
- #include <linux/interrupt.h>" J- l" D. J+ G8 w4 P5 N, o
- #include <asm/io.h>
1 E$ x; S( p9 q - #include <linux/moduleparam.h>
6 T1 G( @8 t) I( j, J - #include <linux/sysctl.h>
, e1 m' v2 C& K0 R2 Q - #include <linux/mm.h>
, m N0 p9 I8 }" v# m - #include <linux/dma-mapping.h>
: {( z; Q) z, R3 _+ A. r
) {. e4 A6 t! E; X- #include <mach/memory.h>: d5 U. W2 |/ d' ?4 l; M
- #include <mach/hardware.h>
! e) \0 N3 O1 d; O2 Z - #include <mach/irqs.h>' ~0 D8 \$ q B4 G3 l
- #include <asm/hardware/edma.h>
. R8 z* o; d5 R" |7 w
6 {* l: r- G" A: F- #undef EDMA3_DEBUG) A6 h+ K* {& ?, Z6 G- V
- /*#define EDMA3_DEBUG*/: X& z2 d' z" Z! e/ ^, g
' I! Z% Q! F- F5 p- #ifdef EDMA3_DEBUG& h, H2 j+ k7 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c1 N, [9 N7 w& V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ `+ D5 Q7 l4 f! J" O- h& K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); v, z7 r4 a; I8 S) R3 l: z* W
- #else' V/ |" x( i1 f( N! z
- #define DMA_PRINTK( x... )
2 n- u, H% z1 h5 h4 I8 K% F - #define DMA_FN_IN* }4 {2 W7 t& k7 W% X2 i
- #define DMA_FN_OUT' ? `! A1 ~5 R6 R7 R; O
- #endif; n$ h7 ^/ `- k# a
! C; x1 i! e- A, ? L8 a+ ]5 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* ]+ V5 W" x1 T* ]3 S
- #define STATIC_SHIFT 31 r) b0 {! A6 h' A- C% ^
- #define TCINTEN_SHIFT 20' A' u( W% R& R. t- A1 S
- #define ITCINTEN_SHIFT 21& {- l, M) f7 {
- #define TCCHEN_SHIFT 22; |) t- [4 {- x+ [+ F" ?
- #define ITCCHEN_SHIFT 236 N# @# ]. T/ [$ Q
- $ e7 m6 J7 Z8 t: o" j
- static volatile int irqraised1 = 0;
# s2 K( n$ J9 c+ g - static volatile int irqraised2 = 0;
* M/ p& a& N6 N; l5 A! Y - 2 M3 L8 Y. ^' I. u7 P% g: n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 }& I+ @, { b! q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n3 z9 Q$ x4 _ | M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K; c c' Z. V# T
1 g) l* W, J+ D: T# l- dma_addr_t dmaphyssrc1 = 0;# i9 N! {$ w8 d1 s$ I0 a
- dma_addr_t dmaphyssrc2 = 0;
7 U3 w+ |* n" z) b2 i - dma_addr_t dmaphysdest1 = 0;$ n8 h* S7 n. n' N# V* J2 @
- dma_addr_t dmaphysdest2 = 0;
( v$ }7 j) A* s, ~/ D! y - & F8 m0 n. }6 E3 K7 S
- char *dmabufsrc1 = NULL;
8 `8 c3 R7 T& P- ~8 o6 i - char *dmabufsrc2 = NULL;8 x) t+ M3 ]/ N7 X3 F
- char *dmabufdest1 = NULL;. L2 @. |$ W# }- f; p+ ?$ p
- char *dmabufdest2 = NULL;# c/ `) _6 P# O$ v
- : `9 i/ |" C0 U1 i3 y" d, S& C
- static int acnt = 512;9 [! z3 W! b* K2 ?
- static int bcnt = 8;& ^0 S9 A2 M- ~6 a! ~6 s
- static int ccnt = 8;
: G$ a9 N) H% D - ; y6 E( B1 O$ e7 ]7 @! U
- module_param(acnt, int, S_IRUGO);
1 E# n9 i+ r# M; _) p Z9 Y - module_param(bcnt, int, S_IRUGO);
$ o* \3 [' u, q: L# v+ ^ - module_param(ccnt, int, S_IRUGO);
复制代码
: w3 l! L+ O1 u! L! p/ {7 s4 G" t. ?9 t8 B q8 k4 L: t5 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 f/ J' O; A; H. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( w5 M. K {# r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 }# @0 I+ b& l3 T7 [7 Q: k* Y8 L9 s" {0 o" Z) p, y) g3 @3 v) [
* O, s% Y: _& ?8 A$ d |
|