|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ r5 b: J# q& o- E0 {
- [code]EDMA sample test application3 V/ O" Q7 c2 M. m9 D
- /*8 I# J7 }; J: L
- * edma_test.c. D1 s' P+ }% t/ h( T
- *
( k' y2 I. E" F - * brief EDMA3 Test Application- w/ M5 H8 O" L& p# y5 K
- *
; _; I9 J) ~. q4 N& T, j3 i5 O - * This file contains EDMA3 Test code.3 `! L+ }1 q, k3 K: Y
- *
, U% U/ N; ]7 L* |; J* ?* { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; o% C) U9 A. t6 g% ~! D3 L) a4 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 p* ^& r6 y4 d, d - * TO CHANGE., w. g9 L# \1 x6 ]
- *- C, q) H( B; P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) |% n C& o' F0 {* c& i
- *" q1 t" a Y3 C2 G
- * This program is free software; you can redistribute it and/or( U* D* Q$ g$ _$ A7 b# N4 N2 F5 t
- * modify it under the terms of the GNU General Public License as
! W G/ R& l7 {: d, q8 e$ S - * published by the Free Software Foundation version 2.
4 Y: M# `! t. ~6 v/ Z: R - *5 ~5 J% B6 |9 Q+ F N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" q: D& R/ _- @3 m1 g
- * kind, whether express or implied; without even the implied warranty
* Q9 b/ c n/ j4 n3 h9 V# v1 [8 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' o/ {; S: ^3 z0 b+ ~ - * GNU General Public License for more details.
4 O0 I! {- e, _ - */$ p) ^. g! u5 w9 n' t
- " O) Z9 g* Z# s9 Q/ I. o: L! k" y
- #include <linux/module.h>+ }* }# |( Z1 S3 _4 h7 @0 A _4 I2 c
- #include <linux/init.h>$ e+ x7 k: Y3 v3 c. U
- #include <linux/errno.h>
: z$ V9 T; e r- u0 E0 m - #include <linux/types.h>
* \5 \! ? [3 d5 b9 ^% M! M) M0 S - #include <linux/interrupt.h>
' J1 J$ U, b; k' F6 W4 N - #include <asm/io.h>6 N3 `- ]( y$ b% S8 u+ s$ \
- #include <linux/moduleparam.h>/ }6 X; F" X/ B. V' y6 _
- #include <linux/sysctl.h>
% m- m8 K# L! [3 z - #include <linux/mm.h>
; ?' i$ q$ n6 M3 E! L# a* M: C - #include <linux/dma-mapping.h>
2 E9 c. T+ z2 s9 }+ D* N- l/ H, O S
2 Q8 o- _8 q4 M5 Y9 H/ C& \7 _- #include <mach/memory.h>
7 z" T w+ Q& M8 \/ i - #include <mach/hardware.h>
7 Z* H- r4 C& E2 H7 D( H( c, z - #include <mach/irqs.h>
" s S- ?, I0 M4 d7 W# \ - #include <asm/hardware/edma.h>
) {' m& o; u8 E% C. P/ K - 2 m" N g7 x; ]& _
- #undef EDMA3_DEBUG {$ M; Z7 Z9 |) Y8 E7 O
- /*#define EDMA3_DEBUG*/: _1 ^1 f4 F; q. r
- 7 ^) Z( ^+ s9 \0 V/ Z' v. p( H. w
- #ifdef EDMA3_DEBUG
' T$ j- a- d% v1 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 D) H0 w* r! H( D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 O8 w3 ]" Y8 c' e0 W: C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
f/ l$ u2 A0 r: d# J) i0 x( t - #else6 ?4 K* F' M8 f( J9 R! U
- #define DMA_PRINTK( x... )
3 p4 K% }+ U: m( L$ R; D# F5 M - #define DMA_FN_IN2 v0 `; {+ V1 W* y. B7 @8 M4 Q
- #define DMA_FN_OUT
/ \, F3 |% p0 C4 d% Z - #endif9 c& P6 J/ P- q M6 a- m
- # q0 i0 o( D6 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" ^: r: v( u5 j) N - #define STATIC_SHIFT 3: k" a6 {% G' \! V7 [
- #define TCINTEN_SHIFT 20
$ {( e& N7 T# {& s' r, v - #define ITCINTEN_SHIFT 21* _( f, d/ f& c; Y4 k
- #define TCCHEN_SHIFT 229 x* _2 O( f. C+ i0 Z
- #define ITCCHEN_SHIFT 236 Y) f" {0 d4 \( x* P# r: }, z
- ; ]6 m; G: F% M7 L# z' ?
- static volatile int irqraised1 = 0;7 ^3 r# |* M. k2 X9 t
- static volatile int irqraised2 = 0;
3 f( M5 [4 s. n9 x% c - : ^8 F! x; k, ~1 K, h1 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U5 b2 U1 [% f# _8 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H9 p* B2 F; J8 s) H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Q$ K/ J0 R4 F$ m d- i7 V& ?1 ? - + D9 A, I7 @% ^9 L& K; y
- dma_addr_t dmaphyssrc1 = 0;- r( ~8 e s$ C9 P4 v
- dma_addr_t dmaphyssrc2 = 0;: D8 l3 i5 S$ ?. r
- dma_addr_t dmaphysdest1 = 0;
3 ~9 {# N" x M9 Q; E - dma_addr_t dmaphysdest2 = 0;& H& V8 c F9 f% |* o
- ' D) e8 @. T: X- W: f* k
- char *dmabufsrc1 = NULL;
+ ~$ @; w2 Y2 g7 q' r - char *dmabufsrc2 = NULL;
7 E+ K7 `4 X$ G, x$ W# T& I - char *dmabufdest1 = NULL;
- g- W2 G( v6 \/ J( [ - char *dmabufdest2 = NULL;. O* `& z0 o/ {
6 P4 R5 e9 x; s: f5 c- static int acnt = 512;
( J4 A9 m- m, N! D9 U$ r; B T. C. }$ @ - static int bcnt = 8;
6 W6 f2 O7 A# x. i - static int ccnt = 8;
8 e0 C/ \/ p0 y, [# T2 P - ( |( o( @9 r; A* q
- module_param(acnt, int, S_IRUGO);+ P T" C# A& k4 A: y0 ?
- module_param(bcnt, int, S_IRUGO);
/ m5 d0 o: w% z8 s8 \1 h/ ~ - module_param(ccnt, int, S_IRUGO);
复制代码 , X1 S% ]! v6 @
% q$ C H9 U; H- u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* T" C8 M) h/ E( Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! U- L1 H, G0 y% N: q& c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 I' M9 x1 {) _
! ?. Y5 O, |1 `. S3 b% d2 u: Q; T: X' G
|
|