|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! j* R" k& |+ q
- [code]EDMA sample test application& r" T/ a8 s6 a' [6 q/ O
- /*- k, j4 Y( U9 b W) j
- * edma_test.c+ N, ?, V8 K" n3 o7 n/ I
- *8 r: }% g1 u9 w5 `9 o
- * brief EDMA3 Test Application( b: O( i1 j: j7 x ]
- *
. [. W: e) |+ A7 s9 A K- P - * This file contains EDMA3 Test code.8 [, O0 }& A9 V7 P- ^
- *
# c2 x+ W) A" f+ b- O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( B3 J, e+ f u% w! P( q7 O. @8 O" G. f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ?2 O8 t2 m/ A* h; ~2 M
- * TO CHANGE.& A5 M8 C: N) _& W% t
- *4 D) z7 d1 N* Z( w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# B+ e1 g3 S* S - * F# C! Y( p- M& j# V
- * This program is free software; you can redistribute it and/or
% o' |; ~: B. C6 R* I - * modify it under the terms of the GNU General Public License as4 E5 E2 Q4 X7 l( B
- * published by the Free Software Foundation version 2.
$ c( Y. [. n' G! C - *5 M! q0 L+ q; P3 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s6 u' L( G/ B2 [$ @6 r( J" N
- * kind, whether express or implied; without even the implied warranty
* q1 W' o7 Z" S, x9 T% j: I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 a! ? ~( E: Q# }# X5 F% J# q e% u$ _/ p
- * GNU General Public License for more details.
. w2 n; o$ Z( x1 s: C - */ t$ {( Y E& p! m
- . w5 e, c% K3 P) ` {: S* l
- #include <linux/module.h>
# R, ?" e3 @$ @, T: m5 C/ O, w - #include <linux/init.h># h3 T9 c4 S$ e- O. [5 w
- #include <linux/errno.h>
" W' J3 r5 h, X! n7 }6 v: { - #include <linux/types.h>/ y8 H5 m2 `1 n7 h+ n5 K# S
- #include <linux/interrupt.h>
! ?+ A- Z! k* B i Q - #include <asm/io.h>
- C/ \+ b: u3 l0 N$ F9 \ - #include <linux/moduleparam.h>
8 ^8 n6 v, V9 q+ H5 M! L5 z - #include <linux/sysctl.h>
# |$ E( f/ p- W% u. A6 U - #include <linux/mm.h>6 Q% C( l0 a8 X5 v
- #include <linux/dma-mapping.h>
7 _5 L& p6 q8 O9 p& F. \4 | Y+ e - * W$ A5 a6 y. R, I) f8 e+ z
- #include <mach/memory.h>4 V/ O" l _) y* A: c: c
- #include <mach/hardware.h>9 Y! C( x( p6 E/ e
- #include <mach/irqs.h>
0 U$ b3 [/ Z; F, O( f3 O4 s1 J - #include <asm/hardware/edma.h>) S# \+ S* a* {
. F* n' k/ e. q" x7 ~* c+ V- #undef EDMA3_DEBUG! R' U$ |5 u' D" y: c
- /*#define EDMA3_DEBUG*/( z0 D A9 _) `! J, z/ |8 N+ U3 m. F
- # u( y% Z5 U; w% |) ^+ g" w. [
- #ifdef EDMA3_DEBUG
) L' ~* R* F/ R. {* |+ e3 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) `/ t( J# a" l1 m8 Z4 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) {1 S* {' Q- u3 V* j8 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% l3 f& u0 ^$ z- P4 ^ - #else
r# ^3 |, @! `- y - #define DMA_PRINTK( x... )
# a9 O, o' g5 _- b, t4 v - #define DMA_FN_IN6 T/ X \- K% l; S
- #define DMA_FN_OUT8 F- a& `0 j3 z4 w( v1 F q
- #endif
9 Y2 j) @2 Y; q - 2 t) Q0 A2 S$ N( X1 {1 ^/ O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. E- Y1 V% |* z/ s( n+ @2 R1 E - #define STATIC_SHIFT 3
4 C- l- S& }1 g$ K$ c$ o5 x' y - #define TCINTEN_SHIFT 20
& w7 G F! O( K5 b - #define ITCINTEN_SHIFT 21
* {" X8 B, }+ E3 a$ z; l/ M - #define TCCHEN_SHIFT 225 X5 b$ z) v* B3 n( u
- #define ITCCHEN_SHIFT 23
8 F3 e2 r, L9 q; [
0 f; a" j. ]6 G& W; X: [& ~- static volatile int irqraised1 = 0;& l6 A- a, s+ L7 m1 k8 ?
- static volatile int irqraised2 = 0;3 K2 w: r: v+ z
- + b z; d1 c( d4 ^' `2 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q' \2 u b: m9 e1 S& g8 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# V0 O, L" V6 i- v/ l4 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% z# m3 T! P6 }1 }6 c - 1 A' r1 Q* @0 G' u+ d$ J
- dma_addr_t dmaphyssrc1 = 0;' ~/ u9 W9 t! r i
- dma_addr_t dmaphyssrc2 = 0;
$ B0 `7 r v* e, e: o' Q* W$ j9 u - dma_addr_t dmaphysdest1 = 0;$ p( S2 w" I6 j% p' Y. N# A
- dma_addr_t dmaphysdest2 = 0;
3 {" D9 v8 X' F - : r" D0 Z" V. x# D' { I5 [
- char *dmabufsrc1 = NULL;
7 U8 E% _* G( s4 s/ p - char *dmabufsrc2 = NULL;
6 O: D B: \ ^* \8 `9 _" F0 Z - char *dmabufdest1 = NULL;1 B$ [( F" f9 w3 L- ^ I
- char *dmabufdest2 = NULL;
3 d l+ U `) H& I. x7 t - , s1 d% W. m/ _# }
- static int acnt = 512;. L, m/ z+ y- h7 ]5 L+ L3 |
- static int bcnt = 8;: ?* T& o3 \9 J6 m) x% ?, w& g9 m
- static int ccnt = 8;1 X t# E" F7 X) Y/ u% j9 u1 q
: R0 h% i; k: G: a. m: j$ \- module_param(acnt, int, S_IRUGO);" G. }2 i+ B6 i) O; O# n$ [( Z4 j' _. [
- module_param(bcnt, int, S_IRUGO);5 e2 U2 _' M# [% e" ?# B" J0 l
- module_param(ccnt, int, S_IRUGO);
复制代码 . N: o8 Z r+ F7 B) I
! M& Q# j* G3 D5 p0 g, t K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) d+ I" R" C& } n1 |' G, Y+ y& O8 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: T( y# {/ I% `8 D. ]0 e J$ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ j* S" s7 j8 g' _# @7 ?9 v% X7 l- @3 ^8 U* y
: I+ x5 n: \# T3 J, F
|
|