|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; L2 }3 o% D0 {3 S7 T6 ?# k9 F7 {
- [code]EDMA sample test application3 A% b" S& e0 C& `
- /*
5 a" m( Y2 @" o" ^1 i5 w - * edma_test.c
3 }; l. U7 B1 ^! I9 C& ` P( _ - *% W, _$ d4 c" D4 j( h( h7 C
- * brief EDMA3 Test Application
8 B: R4 j0 j( g1 t. W - *
9 o6 I6 Q. |) a8 B N4 ] - * This file contains EDMA3 Test code.) ]( P4 S P6 _1 ]# V9 O
- *. d% Q* {6 O! P1 s8 Z1 p/ [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 u3 A D5 o5 C7 `' c5 {" O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: S" h6 v5 i9 N! T8 F! Q
- * TO CHANGE.# V; u. h- d/ J$ ^( r# p
- *
0 _+ a* e/ { | _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 Q& z# p/ `$ p& _. |4 K - *1 N! s) K8 Q$ u, T* l4 @
- * This program is free software; you can redistribute it and/or* I* S3 X! A3 a7 }# Q3 {; i
- * modify it under the terms of the GNU General Public License as
8 c6 e2 u2 M$ ^) M - * published by the Free Software Foundation version 2.
$ v5 b* o* M! b9 @6 r5 K - *9 F3 B/ Q$ e' y8 H/ m# G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 S2 _" G @ k9 C$ s2 B! _
- * kind, whether express or implied; without even the implied warranty, A2 C/ @: O$ b9 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% [' u+ d# T d6 d - * GNU General Public License for more details.7 ^* |4 s7 _# g$ y* y: i
- */
$ z$ }* @+ c: ?% e/ Y; E1 Q
& `; W2 L" A; ]+ e$ P5 T- #include <linux/module.h>$ [% h! D. R3 {- t: f; s
- #include <linux/init.h>; T: G2 Y0 d3 D+ o, ^/ V
- #include <linux/errno.h>$ b/ _& ~" L! g9 ]8 G
- #include <linux/types.h>8 @6 n2 c1 W, ?
- #include <linux/interrupt.h>
$ M5 r; W/ _/ A$ q& c - #include <asm/io.h>
; `6 I5 E' o* u5 C - #include <linux/moduleparam.h># P1 D: U2 V; f* I. R
- #include <linux/sysctl.h>/ [, H4 I3 a8 w/ @% Q9 @% X& z1 h
- #include <linux/mm.h>
8 h5 U/ a8 W, ~. C. S% ]1 w1 H - #include <linux/dma-mapping.h>5 B4 |8 p) w: t S
- ! G0 w& p* R2 r% f! k1 @
- #include <mach/memory.h>* Z2 O% ?/ w6 g8 {7 W3 r
- #include <mach/hardware.h>6 e1 y7 F& |( d5 P& E/ u/ Q6 P$ K
- #include <mach/irqs.h>
) |5 E- A- P C0 S M3 S9 U( o- a* ? - #include <asm/hardware/edma.h>. ?1 x# G$ Q" s* [
- $ u" i0 Z) x X6 g
- #undef EDMA3_DEBUG
. h: D9 D5 i2 N# { - /*#define EDMA3_DEBUG*/
# ~7 _( y1 q% b5 n B+ x* H8 E - " z9 v) e" m9 E7 W' A" Z1 l+ b
- #ifdef EDMA3_DEBUG
* m' q# K0 r! p/ G8 D7 D4 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ H; Y6 Z' D* o: V" g% }! s5 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* o' n9 i7 @6 ^! L+ V3 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 }7 O- p; H# v6 G5 e; d/ R& P
- #else
0 P( L- E. `5 \: E% l7 }% q9 | ^ - #define DMA_PRINTK( x... )! `( o% m7 O" k
- #define DMA_FN_IN
' Q) |4 {! C w F% g, t. q8 @ - #define DMA_FN_OUT9 E$ R0 X3 ^# j6 P6 ?
- #endif) \/ C8 [6 ~; C' ^! w
- 8 H% R& T+ |( o* [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- \. A0 |4 G8 r: x# r - #define STATIC_SHIFT 3
z8 b9 u. T$ {* p2 g) Q - #define TCINTEN_SHIFT 20" t9 ]; @# y8 W8 a
- #define ITCINTEN_SHIFT 211 H7 [5 Z! D4 [, s" P4 B
- #define TCCHEN_SHIFT 22
2 f3 ?& L8 `! X' e - #define ITCCHEN_SHIFT 23
, r% ~2 }3 ?" @+ H7 V4 c0 k8 ?5 S6 ^/ F3 A - 1 r. A9 ~9 \! z' d- j
- static volatile int irqraised1 = 0;
8 ~/ c4 K* { O% d! w - static volatile int irqraised2 = 0;
, q2 H9 i3 ?9 S - " |0 P7 N& z9 {9 h4 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ?8 h5 h; I! b- b- K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N; k+ ^" g9 f& @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N/ N* q( o) ^7 O8 L# a+ M) w3 i W
& N6 L" d* M; d7 r/ G3 Z- dma_addr_t dmaphyssrc1 = 0;
, a+ B4 S/ l! I. Z - dma_addr_t dmaphyssrc2 = 0;
, _# V% l0 H/ R8 f: p - dma_addr_t dmaphysdest1 = 0;
& `* ?/ @0 D6 U( } - dma_addr_t dmaphysdest2 = 0;
+ `6 K$ M6 d. f! x+ n+ S - # M1 v- ~" f8 p6 G
- char *dmabufsrc1 = NULL;$ G9 e3 U- [- ^" P) x9 b" w
- char *dmabufsrc2 = NULL;7 |6 I+ F% n' s2 f E3 m
- char *dmabufdest1 = NULL;
8 R5 G5 D+ U, h - char *dmabufdest2 = NULL;
+ Y9 w! L1 }/ a2 a$ d$ [( ^' T
3 G; d. H! c9 b2 y/ T7 l- static int acnt = 512;
, d/ H' L1 [$ ?/ [ D' ~) H4 `. L - static int bcnt = 8;
/ p3 G& S7 [1 T- T( a$ Q - static int ccnt = 8;
, y* j, w6 S |: Q, g) C - ' L- n" B9 z+ G; u9 z
- module_param(acnt, int, S_IRUGO);5 u3 r$ ^( U2 L, V' s
- module_param(bcnt, int, S_IRUGO);% ?; j3 U5 M7 ] s& ]& t; `
- module_param(ccnt, int, S_IRUGO);
复制代码
" p9 R% c& R% d+ ^* X' L% k& d6 V$ M9 E7 V" {9 L& ?3 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 |3 r* P8 X$ P- u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 c$ d8 Z% \+ r/ C! g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c7 c. l) b' S/ o+ \# D2 s' |! l: h( A2 u' y1 N
; R. k( A( ^* Q) r6 |2 a7 F |
|