|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 M* V" n+ J R
- [code]EDMA sample test application
. W4 _( r2 W: c* e) [ - /*. p5 f1 C( I& y" ?0 }
- * edma_test.c/ |% ?/ a4 ?) U
- *8 g; P) \8 A4 o k! z- Y
- * brief EDMA3 Test Application
7 K6 e# }# C9 k$ R& D4 G0 Y - *
0 g. E' q" t" X5 H+ @ - * This file contains EDMA3 Test code." M; }; R, u5 G" n1 M% N' k1 R
- *& E. p" |' a( D1 t. }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 U/ C) C- I2 e* H0 g6 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: k( \: Y; g& _3 M5 U Z - * TO CHANGE.
/ A: ]6 M1 p: G+ w - *. p/ r( c1 e0 t2 o. l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o6 d) x( ^0 t5 A
- *0 V: @8 U( I( j. M9 ?- q$ c% ~
- * This program is free software; you can redistribute it and/or
: {8 _, C( R* c! l1 p8 `, c - * modify it under the terms of the GNU General Public License as% f& k S+ Y+ ?& \+ b8 |2 _
- * published by the Free Software Foundation version 2.
z4 v1 l( r% a7 O/ _/ W - *
, T8 e( \" N; D7 t. k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, l4 F7 N$ k' r2 u! E5 p. }5 O) f - * kind, whether express or implied; without even the implied warranty+ {) h% I7 U0 k& L: o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) L* [& O3 l/ r3 ?0 m% T
- * GNU General Public License for more details." i7 S* s8 M# U$ b
- */
: ~) N- t0 ^8 J
S3 n, L* O; ~9 Q& j! D: _- #include <linux/module.h>
7 F; p1 R- R& S/ X6 ? - #include <linux/init.h>$ e+ ?! s: L( o5 U3 W! Q+ e) a
- #include <linux/errno.h>! m3 N. D y7 Q w
- #include <linux/types.h>
6 Q3 U, G& G R: }) R9 J - #include <linux/interrupt.h>
4 r# h! t4 U8 k+ b+ @& [! G - #include <asm/io.h>
: z/ j: H' X: @' F5 j - #include <linux/moduleparam.h>
" w7 \ N3 r6 v$ F) \ - #include <linux/sysctl.h>
1 p' p" J9 g+ @4 B. ?- w - #include <linux/mm.h> p1 O" t& W0 A" `" B- |
- #include <linux/dma-mapping.h># t2 [! c" N4 W8 I( E7 D
- 4 e3 l- x1 O0 I: O( ]
- #include <mach/memory.h>
7 D" d# R& q% R( W1 ~6 f1 T7 } - #include <mach/hardware.h>
* ` W- M% s2 ~* B% x2 c, Y1 s - #include <mach/irqs.h>6 ~" t8 r; m7 U$ y
- #include <asm/hardware/edma.h>
6 l8 f$ t6 A! S - 9 Q7 b6 m$ a0 @8 ~- O. d
- #undef EDMA3_DEBUG3 B- }3 p6 N: u
- /*#define EDMA3_DEBUG*/
+ d* T' P) N* u1 k; n - 1 ?" l" @" r; P0 t$ V
- #ifdef EDMA3_DEBUG
; @( Y$ b9 V1 G, o: Z A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {; F9 m8 N; F0 i4 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Y7 g/ I$ }9 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. Z a/ A$ p9 t! g: z7 @) {) ^( K - #else! T# _2 R1 X5 x
- #define DMA_PRINTK( x... )$ d% R5 P/ t. D& V
- #define DMA_FN_IN
2 i7 [* T9 U6 M3 H( ] - #define DMA_FN_OUT! X2 {4 D4 S' c2 H; o4 h6 y
- #endif7 O8 b! G. w7 h( v
- 7 W7 P; V/ G9 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# [; q! |! E, F" M3 \
- #define STATIC_SHIFT 36 ~$ B) m/ [; G) _
- #define TCINTEN_SHIFT 20
/ c4 h. g* p2 |. ~& K9 B - #define ITCINTEN_SHIFT 215 j, W* X6 V- I$ @' s7 @
- #define TCCHEN_SHIFT 22- a- g6 s. L# R. m
- #define ITCCHEN_SHIFT 233 ^4 R& ], V5 J+ d4 c. [" ~
- % o% s9 n4 d! [' L; R l* T# {
- static volatile int irqraised1 = 0;9 d3 ^' u- j3 j* s. D
- static volatile int irqraised2 = 0;, G3 q& }# z. H+ q
- ! ?3 V8 W3 T9 p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 C$ L1 d, z% r4 W" R% W- K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 F* Z d7 z4 ~) r: W! S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); o$ }; ~$ i5 P: y( L! ~. U. o
- 5 s: D8 d+ S6 T
- dma_addr_t dmaphyssrc1 = 0;
1 s" A7 x; |7 J7 G - dma_addr_t dmaphyssrc2 = 0;* E. c: D2 `9 j0 }* C; N& V& E
- dma_addr_t dmaphysdest1 = 0;; {3 R5 D# B3 U* i% Q
- dma_addr_t dmaphysdest2 = 0;
& `8 a8 G( S/ f/ E: Y - . l' `1 D% f. b3 e" l5 T k
- char *dmabufsrc1 = NULL;
7 I8 X; H, U, d2 p - char *dmabufsrc2 = NULL;
% I4 P. |" f; a8 F5 Z' z) \! P5 U' X - char *dmabufdest1 = NULL;
) r8 T# ?3 P& @5 s) O) p5 Y( y - char *dmabufdest2 = NULL;
- y9 s# U5 \; a+ Z) q - 5 h7 A9 d# W3 I; \$ F
- static int acnt = 512;
- P5 Z- ]& {6 H0 c: r) p6 D - static int bcnt = 8;8 ~0 o2 Z! s1 Y. x$ n
- static int ccnt = 8;
) I* l( {: V* R( e3 W; |8 a - 6 A3 y8 p# g* f9 h
- module_param(acnt, int, S_IRUGO);. T, ~* a0 ]) E
- module_param(bcnt, int, S_IRUGO);
^: Y" y* D2 }4 t1 o! s - module_param(ccnt, int, S_IRUGO);
复制代码
8 a( j6 O- o$ S! h$ _( N; b9 q; s( k/ U! q4 E+ j8 A' Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. J+ } l( W7 I7 O5 H& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* C2 o& j$ g/ K0 f- ~8 V0 |' M2 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 X+ p; @% s# H+ s! ]4 n! k- N$ ^
9 X6 I2 t4 z2 P( t$ |
0 q$ M5 x9 l0 i; ], d# _ |
|