|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. U! P+ C& P1 I1 A! y ~- [code]EDMA sample test application
7 V& O/ x0 y1 Y: b1 r - /*
5 b8 Q" c) d* ~0 u - * edma_test.c6 v: A3 T; D) G
- *2 a8 e% `; m) [5 S
- * brief EDMA3 Test Application
8 U2 u0 b7 B/ {# e. z' R - *
' I& ]. ], ^1 o/ p1 d - * This file contains EDMA3 Test code.
- ~; @' M' \/ z+ g0 }3 L - *# G0 g- K5 H: `. k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n9 R, B, e' _7 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d K4 W3 l5 u
- * TO CHANGE. ~2 h: v+ R# X7 q/ Y, J
- *
9 R _9 S& w4 x9 \, \6 I+ [6 V* y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ i( Z! K& m3 o* ~3 y+ Y1 |
- *9 T% q( b+ L- x# }' m: y: b
- * This program is free software; you can redistribute it and/or g) u8 Q- v1 {% j3 @0 v. j* q3 t
- * modify it under the terms of the GNU General Public License as9 F# I% u( d$ R) F1 t& X$ Q; B& @, F
- * published by the Free Software Foundation version 2.% ~. ^7 b N( Q6 T5 }' t8 G& G
- */ B" ]2 N& ^5 P i; `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& @* X) \8 X$ Z1 m
- * kind, whether express or implied; without even the implied warranty
! [& `, ?$ `" M) A# @1 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, G+ _' ~# g/ D, K4 r
- * GNU General Public License for more details.
! n; P; f. A. f - */
! o; Y3 }! r8 ]" V& T7 ?! v! X - : `3 f; ? h4 ~+ P
- #include <linux/module.h>+ X7 u7 | [- V) B& g4 L0 T8 K
- #include <linux/init.h>9 s& ^/ {7 b- d8 y
- #include <linux/errno.h>
$ o& ?( a; E; [! H/ ? - #include <linux/types.h>
. R6 M, S) @2 ^ ], D - #include <linux/interrupt.h>
$ |' J q; m& T, ~) [ - #include <asm/io.h>5 r; S% ~8 A& _; V& G1 a: P3 c
- #include <linux/moduleparam.h>
- M5 K' h1 H. ~! z - #include <linux/sysctl.h>$ m4 o- n2 }1 K( S1 }
- #include <linux/mm.h>
# A+ X( u$ T5 b. |6 H. V1 O0 | - #include <linux/dma-mapping.h>
6 |9 ]9 R3 m" o* r4 [- w - a+ R A( C/ p$ S* E: c. C
- #include <mach/memory.h>
% ~' O2 E; b" b% j8 p. c! S - #include <mach/hardware.h>
1 a8 a: F. _! g( @0 w! b - #include <mach/irqs.h>, u( |; P0 ?9 l7 d1 l9 \; n5 K
- #include <asm/hardware/edma.h>9 Z0 N$ E6 u6 ^! c( Y+ i5 ]
- t% U x. F1 c i* }: ^6 o- #undef EDMA3_DEBUG
- L/ s4 h8 l- E - /*#define EDMA3_DEBUG*/
3 R! Y, r S$ I - $ q& X% }$ f2 G+ y1 F
- #ifdef EDMA3_DEBUG( |2 p) u" _8 r3 d& T5 Q! l. {- h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. C! R5 J* y' y! |4 r. ?! N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ W( D- W9 u, N+ L3 w4 G' v- i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 T9 b- l F" \
- #else
, a- E' m: z( G1 s - #define DMA_PRINTK( x... )
% Z, k& E. \( k - #define DMA_FN_IN9 w4 C x3 }9 r
- #define DMA_FN_OUT7 I v/ D8 w0 s2 D( U9 |0 t9 |( \
- #endif
1 w* L" R$ T8 } - / Q+ V4 Q& l ^) ]1 C5 s1 Q( ~5 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 H( }" X9 j. B0 a( ^- V- ^ - #define STATIC_SHIFT 3 k+ F2 q; }& b- L; u$ @
- #define TCINTEN_SHIFT 20, o5 x% _; U4 }$ ~0 E
- #define ITCINTEN_SHIFT 21
0 w- p+ k* w3 O& o - #define TCCHEN_SHIFT 229 }+ I" k) Y; G0 `
- #define ITCCHEN_SHIFT 23
" q# ]9 v, k: [2 r$ e Z+ G) ^ - : e& E( m0 a9 S! L
- static volatile int irqraised1 = 0;+ \- V) ^% G% G9 ]
- static volatile int irqraised2 = 0;
0 ?' f7 m( T/ |) b
- }1 v7 ?9 |4 u; t+ W# |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 f% Z8 H" x+ K% w: V# ~6 ]0 r2 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. U; e+ C2 f0 [2 G' K9 f! P8 q+ ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O5 M/ a6 f) C n
- 4 O2 e7 J$ G% v) O4 P
- dma_addr_t dmaphyssrc1 = 0;; A" K5 d M" n6 J2 \
- dma_addr_t dmaphyssrc2 = 0;% P1 i" v' z% i2 w1 ~/ H9 ?% ?$ `
- dma_addr_t dmaphysdest1 = 0;
, H3 e8 z. g" r/ |' ? - dma_addr_t dmaphysdest2 = 0;
; y" j8 s9 P) W7 A5 C. N0 c" } - 0 p* t$ f6 m; z6 g
- char *dmabufsrc1 = NULL;
+ I: M' {* z% r0 r" t% H - char *dmabufsrc2 = NULL;
* w7 T/ o% U! a+ f) m& L8 T2 [ H - char *dmabufdest1 = NULL;& M( h- h( D. n+ R
- char *dmabufdest2 = NULL;
. b4 c% Y5 ]& g4 q5 M - , X' Y, {) Q/ Q" Q2 ^8 B
- static int acnt = 512;# F+ t+ V; n) c9 i
- static int bcnt = 8;2 ^( e% M4 T& N3 n& H
- static int ccnt = 8;- ~' c- e0 R9 H2 D: Q+ m6 `
- % H5 f/ Q3 p1 [5 h0 l
- module_param(acnt, int, S_IRUGO);
1 V. R6 B [4 E( O' U - module_param(bcnt, int, S_IRUGO);$ }% s. C$ b' P' J
- module_param(ccnt, int, S_IRUGO);
复制代码
; ]$ a: s7 E% i8 I( l6 r9 o( ]# n8 [1 |2 F7 j* _6 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R, _$ v: N8 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! f: @; S% n) G1 c# f* g3 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& |$ Y Z H7 H! }# F8 H) L# }
2 L0 W9 d" ^9 U$ c; F+ P( I2 e* [. O7 U/ ~' L
|
|