|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k% `2 }/ _5 i1 c5 g q0 ^
- [code]EDMA sample test application
% F, X1 ~: p5 E2 L% d* c - /*
5 e9 k* k" G$ ~3 f - * edma_test.c" X: i# y$ L8 H* ^
- *
: H0 S) ^8 H$ ]" C9 C z6 ?, \ - * brief EDMA3 Test Application
3 j/ e0 N( f0 A3 ~: m% k! s - *" N) V7 n9 v* n
- * This file contains EDMA3 Test code.
, `2 q6 X; L( y4 o1 G - *- ?: _ G) s& |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 g3 p- V& j) F$ W: N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 B0 D/ Q; P( K$ ?) E2 M - * TO CHANGE.0 }! G9 B+ W1 C
- *
5 e2 R$ Y4 |7 f0 `# l! w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 b6 H, D, E" B% E - *
6 J1 i: A) t. V - * This program is free software; you can redistribute it and/or3 F( T( F$ f" z4 C, Y
- * modify it under the terms of the GNU General Public License as5 G" k4 U. b& [2 g% \
- * published by the Free Software Foundation version 2." r9 e0 Y2 X; n. I: a
- *5 o5 X# p2 ^/ }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ k7 U4 g5 c. ~; i- Z# ^ - * kind, whether express or implied; without even the implied warranty; z: t5 d$ U, ?2 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 B4 }7 T) c2 B1 o# } c) V
- * GNU General Public License for more details.
6 c- T( Y. m& {2 l: [. p - */
R' Q) R2 j8 U! w- L
+ ]' ]: M7 H* z v/ m- #include <linux/module.h>
2 r& B7 z8 O0 U. { - #include <linux/init.h>) u' B: c# E2 }# q
- #include <linux/errno.h>$ t; P5 L8 v9 l( E7 T
- #include <linux/types.h>
6 T: l% j" x+ i5 J' A - #include <linux/interrupt.h>
$ |: H% B3 G- l1 [' n6 g( N7 Q2 n - #include <asm/io.h>" x$ U: g9 a z0 f3 t
- #include <linux/moduleparam.h>
f4 F$ y, V }8 r0 y; N - #include <linux/sysctl.h>
) }) i5 W# a+ D4 y: `5 o& P - #include <linux/mm.h>0 e8 B# ^% Z# _# D) C
- #include <linux/dma-mapping.h>
1 x* E5 |% r7 {9 r) J
8 K1 F/ {) n- g7 L4 _& O8 E$ a( h- #include <mach/memory.h>; c: C \# Y8 c G! F$ C
- #include <mach/hardware.h># ?2 s3 o( z8 J+ L7 d- s
- #include <mach/irqs.h>- ?$ G/ L8 V/ Q0 S
- #include <asm/hardware/edma.h>( [; n e7 `0 {. g
3 O" ]. o R& r0 S8 ?- #undef EDMA3_DEBUG
: M4 U1 j0 S; K - /*#define EDMA3_DEBUG*/
. V* ^# `+ ?9 F/ a - & g$ {0 o, y$ [
- #ifdef EDMA3_DEBUG0 H' d, f2 T7 ?! ^7 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ C; h" T$ S! n8 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ?: G; P3 c# C+ R2 [2 v$ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, u/ r7 P T( D: i# F - #else
. R$ ?/ ~- K" }8 X! m5 c( I7 ?* U. V - #define DMA_PRINTK( x... )
' s: T% C6 D* I, G# g G - #define DMA_FN_IN% W: W, v/ j. _* s
- #define DMA_FN_OUT
1 t6 z1 O+ b- `; e& c" R - #endif
% x* [$ R V/ N! ]5 e; w
/ k2 E3 f+ D7 g/ O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% ?0 a8 U$ B3 o4 p \9 C* o! y - #define STATIC_SHIFT 3
! b E8 T2 s8 c% X* w) \) [ - #define TCINTEN_SHIFT 20
: O/ q, W- H9 P8 I - #define ITCINTEN_SHIFT 21
1 f; f! t* a* M1 S. p - #define TCCHEN_SHIFT 22
- z- a* t0 S' D1 S7 N1 o: G0 @ - #define ITCCHEN_SHIFT 23" x0 |/ ~2 z& o! @5 B4 |/ B" M& r0 @
+ P7 K% t3 j! u- static volatile int irqraised1 = 0;
# }; T! ^1 O. m - static volatile int irqraised2 = 0;; b; @2 ~4 j1 N. S) i0 @
& b8 H, [1 a) Z/ f3 ]" x# G2 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ^* F) d- P6 B- z- d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 e! f0 U4 j4 K7 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! p: J. _% l' \! g# z+ X
& H. n$ Y6 D! [6 o0 {2 h- dma_addr_t dmaphyssrc1 = 0;
& K; y. Q7 C: o) E - dma_addr_t dmaphyssrc2 = 0;/ d( }+ _6 E( h- \ z
- dma_addr_t dmaphysdest1 = 0;. I& k, d2 ]; q( t# M7 o
- dma_addr_t dmaphysdest2 = 0;
: m- v# _. t& n4 C. n: M& O - & @, j- P, c; {) T
- char *dmabufsrc1 = NULL;
; _! l) ?1 ]8 \ - char *dmabufsrc2 = NULL;
0 [2 V7 P. W) g6 J, T" r9 W9 j9 R2 C - char *dmabufdest1 = NULL;, G% Y) ~ B( _$ R% L# g! ]
- char *dmabufdest2 = NULL;
& K. u3 E9 A& n; r
- p4 K: j8 Q4 r! M- p$ q- static int acnt = 512;
! @" o7 l3 ^4 t7 K7 V( Y - static int bcnt = 8;' Q( g+ G9 |5 |: K0 }
- static int ccnt = 8;
) c( Y# |, O L$ d
k$ j( x; x; i" Z/ y- module_param(acnt, int, S_IRUGO);
* z( o! @( p. w# Y - module_param(bcnt, int, S_IRUGO);! W3 K, S" Y# L$ Y
- module_param(ccnt, int, S_IRUGO);
复制代码
' z/ O- ~! W1 l: k3 ^ {% t! k, l4 _- |2 ?, N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 T/ a1 J1 {+ v1 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 i9 {4 S0 U7 Y0 }9 x# q% R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 @* E4 ^ k s' M8 ~. E0 S3 y9 |+ B0 g- `! Y# I9 q5 S" h
/ s! c2 V# F/ A& _; p4 ~: P# u1 N
|
|