|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * u7 J! U% W& G; Z, R2 z+ ^' T
- [code]EDMA sample test application. e. ]+ H6 f1 I% \, J; u
- /*" A& |/ G% ~: W7 e/ V
- * edma_test.c
4 M# ?# V6 v4 v8 A% [, h& q5 J - *
% H% W8 n/ P7 r4 e- ~8 T8 } - * brief EDMA3 Test Application
# s1 y o5 M/ {3 ^2 ] - *2 c+ y. x+ x7 l0 \, O3 z
- * This file contains EDMA3 Test code.$ _7 A; `: K% U8 Y6 z
- *
' L. T% ~; {* r3 ?# }; H; ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( c2 U& t& x% X; ` n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; x% U4 j1 [6 k) ~! c1 N J* O
- * TO CHANGE.
; {. \- ^# a1 u. m$ R g, M# S% | - *
0 C r7 I2 a. S$ B. M8 I. q2 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# X9 F! i% T3 h& ^ - *1 C7 U' z: K7 V
- * This program is free software; you can redistribute it and/or1 K8 Y8 I7 J* S6 E
- * modify it under the terms of the GNU General Public License as: l1 f$ ?4 M1 ^" _. Y+ e" i$ `
- * published by the Free Software Foundation version 2.
8 M# m& ?4 { s6 r A - *8 N3 N$ L2 g5 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 \9 y. N* Q# B, B% |# L# v, r - * kind, whether express or implied; without even the implied warranty
: o! W5 v# T' E; g( Y$ L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ E- f1 \1 T* A$ R7 _ - * GNU General Public License for more details.5 K9 O* `2 }& q! n7 `6 R4 D
- */
( r0 E+ |; u4 q/ u* w- Z - % Z2 h( H; k! K& V$ y6 E
- #include <linux/module.h>
# c/ l# w& r- g& Y - #include <linux/init.h>( E4 D2 a; j4 d' f
- #include <linux/errno.h>/ V# X9 Q! X+ l
- #include <linux/types.h>3 i8 S4 P5 ^% c+ ]; k+ J
- #include <linux/interrupt.h>) [2 u \! ^5 s9 ^) \2 N2 ?/ Y8 W
- #include <asm/io.h>/ o; i I9 S9 a: F( o
- #include <linux/moduleparam.h>- {: [ o; a% Y5 D6 e
- #include <linux/sysctl.h>( s( h) |% ]% s1 L1 l
- #include <linux/mm.h>) O( H0 s* k: B- n% W, u
- #include <linux/dma-mapping.h>( r0 W+ k" P. x6 @ G
/ b. F8 N8 o* h& |- #include <mach/memory.h># m- C$ j4 ^) E
- #include <mach/hardware.h>
, c8 H' h* h B) ^7 n - #include <mach/irqs.h>& n5 r. e9 I! q
- #include <asm/hardware/edma.h>) T) N* G6 I" S% ^0 }! ^9 }
- 1 m* m; u# ]! a, v; }
- #undef EDMA3_DEBUG0 O3 y0 g0 \9 Y3 N6 G' C
- /*#define EDMA3_DEBUG*/0 }! R4 y5 Z9 [: w7 X; k6 {
- G7 S$ H! _$ m- #ifdef EDMA3_DEBUG+ Z+ B$ n. x S- j: D- q& J2 q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' g4 z; D, c, [4 ~1 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 _( j: L7 v& c1 `7 b1 J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' |6 r7 [* E6 q% c Q9 l - #else
" }! I% y o& ?: N - #define DMA_PRINTK( x... )
1 ?: q, g1 G; ]8 ^( Q. ]( e - #define DMA_FN_IN- T- J( P0 `: o0 T& F1 n
- #define DMA_FN_OUT
& N3 n: p) G. A' h$ f - #endif: ]/ r6 W3 u T. B3 \; ~! q
) e( F- F7 A0 L2 A/ _8 ]* g2 R) m) m- #define MAX_DMA_TRANSFER_IN_BYTES (32768); f3 S. L# V# U0 k& P
- #define STATIC_SHIFT 3
& i/ F4 e+ s2 u6 r8 ?) @- L! \% r5 d - #define TCINTEN_SHIFT 20
7 r% |) r7 R7 u' r. {3 q - #define ITCINTEN_SHIFT 21* ]( ~3 x5 B, n& L! e
- #define TCCHEN_SHIFT 226 E! e- u" p/ G) H2 h
- #define ITCCHEN_SHIFT 23, u/ b/ z! i- u. g: S4 g
i7 g: h" A+ v" j6 d D- static volatile int irqraised1 = 0;3 t/ B& a' A3 f9 H- g8 t/ C: r8 e
- static volatile int irqraised2 = 0;8 `& D& F2 y, v9 z [) P
- ) w( Q: m: z* o( D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 d* v- H2 Q5 ~ k* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t4 u f J/ u# r9 M% n A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }. G- M9 L- ?+ u) M4 v
- ) i3 [; E! {- z! p4 P
- dma_addr_t dmaphyssrc1 = 0;
3 U9 | W5 g* U/ R3 E3 h/ h5 P - dma_addr_t dmaphyssrc2 = 0;/ Q# \+ w$ w6 l4 z8 u$ I& |
- dma_addr_t dmaphysdest1 = 0;! K; c7 w8 Z2 i5 Q# L2 B* k
- dma_addr_t dmaphysdest2 = 0;$ _, Y& g6 z) g- \
- # s' j0 f! P: ^1 T
- char *dmabufsrc1 = NULL;
9 X. t" w8 V E - char *dmabufsrc2 = NULL;
4 A9 R4 Z5 e) \ o - char *dmabufdest1 = NULL;
' _2 [, Q+ H; V9 U X* v - char *dmabufdest2 = NULL;
6 A- a, g5 q! {2 u3 A - 7 Q: T3 U9 t% Y- o0 {: b
- static int acnt = 512;5 o) ?3 S* m: g- A9 i, J+ o4 Z
- static int bcnt = 8;
1 V5 W5 O0 h* J' b8 R - static int ccnt = 8;
: |- d6 L" N- d' w% @- G - 3 p* E; p' W6 u
- module_param(acnt, int, S_IRUGO);4 U) H2 v: e! o) @
- module_param(bcnt, int, S_IRUGO);- f% s; S$ u; S1 S
- module_param(ccnt, int, S_IRUGO);
复制代码 ' _: o- @; d! S8 R: J' T' p
" Q: r9 f6 l' j, F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O( Y' S4 \5 c; n: e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. l) Y( s& Z, b( w* E3 ]2 E9 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W) @' r4 s0 R5 `+ v4 U, O4 r
: E3 B7 {& m! l! j/ G/ a5 U4 u3 }$ @$ R3 ^4 j
|
|