|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / g; u" q- |7 C3 Y, @
- [code]EDMA sample test application/ H. W# K b6 K, t; X, s
- /*
/ E) X- T+ l: q( h9 T5 g - * edma_test.c$ t8 n! F6 n: u( c1 J, q9 r
- *
7 t. v0 E& Y8 x/ e, R - * brief EDMA3 Test Application; r- k, f( L# a- T7 g
- *: u2 u2 n6 [$ b; I( ]& E
- * This file contains EDMA3 Test code.5 Y, N9 |* j& T0 W( [& f
- *0 C+ B# E, c" ~/ O! ]; q; V, t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S, x, i! a6 Z. C/ n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 e" `0 r# ?( |% N2 A, E - * TO CHANGE.9 p; D& p4 Y+ k) z$ D A" e: X
- *) G6 L; B# @7 |7 n. t+ H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 ^' I4 t4 O7 b6 m$ b; ` - *
+ |" Q7 D( K7 M* k - * This program is free software; you can redistribute it and/or+ _* N5 } a' O M
- * modify it under the terms of the GNU General Public License as5 h, J+ Y4 W( L/ }* y! f: X
- * published by the Free Software Foundation version 2.
8 }! [" i" d0 E0 w+ P1 K! C - *1 p( }, L' P& l+ _3 t/ i* V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, O8 A, [0 X+ @2 i- L9 g9 ` - * kind, whether express or implied; without even the implied warranty0 F9 P5 ~- J; o' z9 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) t/ f* {6 V; o; J - * GNU General Public License for more details.
) a& S4 G% q, y4 ~8 g$ _) `# Z - */, t! \" S0 s, Q
- 0 @* { O3 G4 U& |! T P7 ~6 J) S. ]$ U
- #include <linux/module.h>4 Y: M! u* I5 t6 j* f" Q1 {
- #include <linux/init.h>7 H0 W$ M4 `, T" K4 E9 A
- #include <linux/errno.h>
& l7 ?+ G, I' y+ d& e - #include <linux/types.h>
/ j+ {* V% {% S3 P9 Y - #include <linux/interrupt.h>
/ X( F- o% D! k! z - #include <asm/io.h>$ o7 U- d1 O0 W2 g' @. P
- #include <linux/moduleparam.h>+ C% g2 a1 p/ J* R
- #include <linux/sysctl.h>
: D3 g- N, ]: E+ Z - #include <linux/mm.h>
& j7 I: C$ N2 q - #include <linux/dma-mapping.h>/ F7 H0 ]- e3 G- L8 o
* Y( j# o, K ?- #include <mach/memory.h>
7 b, [; i' t- E. |& h" O Z5 A - #include <mach/hardware.h>
+ V2 y p* P, y o G5 b - #include <mach/irqs.h>& o M/ Z8 Y _) z5 T8 }
- #include <asm/hardware/edma.h>% q5 ~' R: r" e" F/ G% P, @( Q
- # p9 E& f2 E% V) n; a5 u, o
- #undef EDMA3_DEBUG
3 E" j' c! v* w9 o - /*#define EDMA3_DEBUG*/, P$ P" \; L8 \+ {% \8 n
- 0 ]$ R4 \% ?7 C7 h" u3 w
- #ifdef EDMA3_DEBUG. Z9 i' U# K, Z1 M9 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F2 }; |# D: q- y; L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* m: f5 y0 A8 B3 {$ V- M( D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% x+ a4 }/ c% F5 m" X+ n - #else6 b. z8 W5 E" ?# I5 G- `& M/ J% ~
- #define DMA_PRINTK( x... )
: @& Z; D1 h) Y* H8 q8 k - #define DMA_FN_IN' a* s; a; F ^; k8 Q# b
- #define DMA_FN_OUT- t9 W& R, r5 `0 Z
- #endif5 u( P( q& r! Q) @& F* o; M7 q
4 l- y" v& J+ z& A4 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- f4 x2 b4 e5 b* |% B k5 F( c - #define STATIC_SHIFT 3
0 ~5 x7 S2 S5 x, y$ U; h - #define TCINTEN_SHIFT 203 _- b& d' f* ?$ Z
- #define ITCINTEN_SHIFT 21
2 \6 r# q8 g3 D$ {# L3 ^( Z, A - #define TCCHEN_SHIFT 220 J1 [/ }- w5 s0 B; u" ^6 v
- #define ITCCHEN_SHIFT 23
3 v' k! h. o3 a' s5 y
" M$ }0 Q/ N5 x8 T9 H9 a+ n- static volatile int irqraised1 = 0;
% N+ J8 o! |- A% S9 U- B6 f - static volatile int irqraised2 = 0;
- ~' Z5 ]( z3 _! J+ F - - v7 Y8 l9 r& l0 p) @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ e4 x* w W4 H1 }4 r7 T) }3 S5 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K. R, S5 x, n1 r/ z5 {: I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x* \5 j. Q( h! y: p/ ?3 z. X - # E1 d& l6 o+ E! c
- dma_addr_t dmaphyssrc1 = 0;
; W \) O! D+ q, D, t5 w9 ` - dma_addr_t dmaphyssrc2 = 0;
" V0 Q) M* u$ ~$ v7 G - dma_addr_t dmaphysdest1 = 0;
: e/ Z4 W! t7 G1 K8 ` - dma_addr_t dmaphysdest2 = 0;
w& i/ r# U4 U
' ^3 s! {. Z) ^2 V X- S3 v- char *dmabufsrc1 = NULL;
7 N9 r7 ~ f; o. { - char *dmabufsrc2 = NULL;
1 h; Q' o0 ]6 A3 u) z - char *dmabufdest1 = NULL;0 E. o+ {! _9 x: |& m6 x7 f
- char *dmabufdest2 = NULL;
" h; Z' D( Z' F: n - / `; e: i5 X. M9 T" d
- static int acnt = 512;( T3 ~1 ?$ S9 q* C1 j
- static int bcnt = 8;) G8 S" y# _; q; W
- static int ccnt = 8;0 B6 p! ]; M6 S' b) S2 k
- ) d% }2 B9 m& a$ O3 n
- module_param(acnt, int, S_IRUGO);/ |" v; @* [; \7 @7 X( J
- module_param(bcnt, int, S_IRUGO);0 C1 v {% b0 n W' V. H+ U
- module_param(ccnt, int, S_IRUGO);
复制代码
# Y+ b, u' E- i3 a
6 a4 O8 P5 I! ^& T2 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t3 M* Q5 Y6 B- s) ] ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# I X* z7 X# H9 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 g: Y/ m8 g' @" u) G
) t$ u* ?# n$ M7 Q
3 d5 e# d: t* Q7 Y$ P2 T( b |
|