|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 u- Z0 |- e7 W1 K, A- [code]EDMA sample test application
' \$ k# d) B& z& h% C4 H - /*
3 l% R; d+ ~0 [4 y* y: A0 H6 H - * edma_test.c
t% D" Z9 y' n9 F& K4 B# | - *
, b K4 z( [! y' ~8 w. v - * brief EDMA3 Test Application y: t' [1 q5 R7 _- q( x
- *
) h; T3 X8 J. U1 \; {+ [3 t9 J - * This file contains EDMA3 Test code.
y+ e8 K5 y3 Z3 [8 v+ k# M! e - *$ g7 z& C6 v' Z5 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) `% ?% z* m9 i! [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 R' f0 |& ^" M \6 D% ?# B0 W - * TO CHANGE.3 ~ d& \: b% b
- *
, M- h) X& \/ b6 g+ o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: I$ t6 L3 F7 O& o
- *. q+ b5 F# X$ ^! F- ]: C k2 ]' s
- * This program is free software; you can redistribute it and/or# t+ P+ k# f8 Z4 }+ K
- * modify it under the terms of the GNU General Public License as6 h+ Z$ X) S" f0 s1 O9 L
- * published by the Free Software Foundation version 2.) ^2 f' k, T- M% L& s4 R
- *
; m) S, ^* T" F2 j: r4 F2 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }" c) u9 v# m- ~9 t J. H2 [
- * kind, whether express or implied; without even the implied warranty
7 y2 J( Q- e1 Z% Z% Y c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 R- C- @* f: `# S2 s! B
- * GNU General Public License for more details.
# f0 K% G7 J% u0 K" c - */# H8 m8 G o' `7 F# }" b0 q
- X0 r2 ]& b8 {9 p' Y
- #include <linux/module.h>
: u! ?* {) x0 n - #include <linux/init.h>' m8 Y+ C+ T( {9 V5 `6 |3 D
- #include <linux/errno.h>2 v$ g+ }5 Q( ~1 D
- #include <linux/types.h>& l- l f6 t- E+ l8 [
- #include <linux/interrupt.h>
+ }6 a3 o& \2 L - #include <asm/io.h>
- w6 `: {% F; n4 o - #include <linux/moduleparam.h>
2 X' r1 T4 {5 a1 @9 Q- ?5 D - #include <linux/sysctl.h>$ @: O X. B: S4 p6 Z
- #include <linux/mm.h>
& V, k4 j9 s0 r" K! [% O - #include <linux/dma-mapping.h>5 I* _ p" i$ d1 W; I
; K8 ]( L/ T# [- #include <mach/memory.h>
) b' j( c5 O0 Z, Q @ - #include <mach/hardware.h>. M. E0 E7 |7 Q" N M
- #include <mach/irqs.h>
: h1 K" {" A/ B9 d N/ I - #include <asm/hardware/edma.h> t. X n v5 s
- J. G; _) L; D5 G
- #undef EDMA3_DEBUG
! e# F9 {0 P K+ t7 @1 M) i+ y9 z - /*#define EDMA3_DEBUG*/
9 W. W0 q5 [, u B - + J$ p" Y+ e9 [* q$ C$ @9 E
- #ifdef EDMA3_DEBUG
$ w6 J# x! {, n& H. i6 L& ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 U% @0 ^/ D* k y( L" b- D& v& G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c; E1 n/ y9 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N+ t9 ?4 j! `
- #else0 X2 P7 w3 j" z7 J6 O/ d% |
- #define DMA_PRINTK( x... ), M# i( j" e2 s2 w( B
- #define DMA_FN_IN0 T! `" _; C/ h5 Z& \2 I2 s
- #define DMA_FN_OUT
' U: D3 i V$ f! H- R* K+ ^! h; d" ? - #endif
; M3 Z4 j& ?, _" Y - 6 r' l" g8 W$ F' s2 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 W9 G5 A" O3 D4 R - #define STATIC_SHIFT 3
n: [7 f! A% z. b; L3 o - #define TCINTEN_SHIFT 20
# ]/ @' f G; ~ - #define ITCINTEN_SHIFT 21& B. u1 Y4 b/ c/ G: q- n9 D
- #define TCCHEN_SHIFT 22: P$ X( O' S( s* n$ ^
- #define ITCCHEN_SHIFT 23
9 W# F& w5 k* z1 |3 G
! d% N P# V: W2 J- static volatile int irqraised1 = 0;
2 \8 n8 }3 r7 X1 m4 a+ ? - static volatile int irqraised2 = 0;
8 d3 P3 y1 Y1 `
% j: J' O" l) h1 E/ B8 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q8 Y9 q1 u; J3 X) m' ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
r& N6 |/ E3 N1 [( S* ?; S7 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f" }+ I. H5 ~1 y. e; w: { - : \! r2 r: _! j* I+ z( ?
- dma_addr_t dmaphyssrc1 = 0;
) Q5 X4 t0 x6 y/ m: u - dma_addr_t dmaphyssrc2 = 0;1 Q% D- @/ f" W$ S
- dma_addr_t dmaphysdest1 = 0;1 c+ h" n1 W; {* k# P
- dma_addr_t dmaphysdest2 = 0;
8 Q$ w2 ^4 D8 z6 F6 s
; L* z0 I7 j: n2 t8 |" t, y- char *dmabufsrc1 = NULL;: K& J$ E9 a. j% A9 y
- char *dmabufsrc2 = NULL;% V! t1 N4 \6 v" u' N5 j1 p
- char *dmabufdest1 = NULL;
8 G$ y3 X3 x+ a; b5 n6 } - char *dmabufdest2 = NULL;
" f/ H6 G$ d% F4 }2 c - , E: e8 @ C* ~9 a
- static int acnt = 512;4 [' {- B6 [5 E
- static int bcnt = 8;
5 F0 d B/ i1 ]/ [ - static int ccnt = 8;' l+ T R Z9 \ h& l
8 ^' M# w" } L* Q8 O7 `- module_param(acnt, int, S_IRUGO);
5 v1 o, }7 d) l+ U7 G3 }/ ? - module_param(bcnt, int, S_IRUGO);: Y( U- f: l. w4 k1 X' w
- module_param(ccnt, int, S_IRUGO);
复制代码
0 q4 A' C1 ]. H) M* w+ R8 g1 B: ]" C6 P, D( v5 @9 ~; I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C- g9 f. T/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ~) m6 Y; q* ^; m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 b% n! K' a# L3 M0 b
, a' [# j8 L: ?3 R1 C: S9 q! v& z) G
x# n! d- N' F4 k |
|