|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * d- q0 w: T) { Z( |* J2 N
- [code]EDMA sample test application8 ]& A8 A2 M1 d( t5 l; [3 s- t7 V
- /*
% m+ Y5 ^" d" y6 O/ i ` - * edma_test.c
0 a+ P* W5 n: z - *% H4 B4 K) d/ b3 S: P0 Q
- * brief EDMA3 Test Application; a: O" c0 X, c' \6 `
- *( j# j, X) R* e% R3 y. _2 _# N
- * This file contains EDMA3 Test code.
3 f p2 A3 N2 x( {( K! s+ ]- [ - *; }% W/ a% I B1 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ]) Z/ Y9 h/ U, E# d2 c8 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 h9 g( v7 [6 s - * TO CHANGE.- _9 x; n+ f. e: w% m
- *! S w/ I+ i8 q) n' b$ t, n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& O0 m5 W6 l5 q9 C- w: M
- *
' \& w1 E" g: B9 {% e$ E - * This program is free software; you can redistribute it and/or
m8 J+ `1 e1 y4 Z3 d - * modify it under the terms of the GNU General Public License as
$ o* U1 U. ^/ A- O( q$ o( M - * published by the Free Software Foundation version 2.
2 f; X/ `8 D R8 `* m6 x - *7 f/ _2 E8 r% z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any U' Q3 t, q% W8 f. V) m8 V
- * kind, whether express or implied; without even the implied warranty/ m6 H" P' _1 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 |) j2 b6 R% l" \' d - * GNU General Public License for more details.
( u) d* y9 T) n) A1 \9 i( X" U - */: C4 P! z# |( W' @$ b; v9 G
- " p! ?; m% j. r; F) \
- #include <linux/module.h>4 b" M0 f ]- x9 ~) @
- #include <linux/init.h>
5 \7 E' I* e$ ^+ R2 _; L - #include <linux/errno.h>
1 P1 W E) B/ p f( _ - #include <linux/types.h>
& V( J8 A% z4 R/ Z% ^! y+ R2 U - #include <linux/interrupt.h>
L) `. p6 m! v8 O8 D) A - #include <asm/io.h>/ y: I% p C7 ^6 |
- #include <linux/moduleparam.h>& o% \- K( x$ }+ F$ ?
- #include <linux/sysctl.h>: Q$ T4 ~" C" M M* x
- #include <linux/mm.h>5 X% g! D t) b( s0 ?0 l; _
- #include <linux/dma-mapping.h>: X- |: z5 F! G) Y
- 3 C {9 Q# g# Z( K2 T5 I
- #include <mach/memory.h>; T# E. K9 W3 S& Z% b v4 b5 ^( B5 q
- #include <mach/hardware.h>- y+ P/ ^/ _7 u H. W/ m6 Z
- #include <mach/irqs.h>
X' ~4 V \' e - #include <asm/hardware/edma.h>) ?; Y# N' u& f' }, F6 g
- 8 w4 r* W# N4 O- L2 D1 ~
- #undef EDMA3_DEBUG
# F! ~# w. b' v - /*#define EDMA3_DEBUG*/# F# Y: T9 q' }+ j% L
- h6 G1 m* d8 f# |1 N6 J" h4 p. [
- #ifdef EDMA3_DEBUG! J/ u0 ~& n0 V. G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: c1 k; k5 B2 [4 N$ {' H t0 {5 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ O. J- S+ D c, U4 i$ b5 Q1 ^$ i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 u/ G2 i9 g8 Y* Q
- #else) S% m* ^2 n8 f& ^
- #define DMA_PRINTK( x... )
3 ^7 i7 u I/ [& a# j - #define DMA_FN_IN7 x, e5 z1 a+ `: W( d
- #define DMA_FN_OUT: u% I/ U3 l1 W
- #endif6 f; x* Z) ~: E( v4 `. s( z2 w) e
- B& Y; Q0 ^* }5 O- e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( `- v# N5 d, e3 Y1 A
- #define STATIC_SHIFT 32 q2 x6 @0 U% x) P" K% R; y( c
- #define TCINTEN_SHIFT 20; u' n9 G4 M# T- v! T6 b1 s
- #define ITCINTEN_SHIFT 21
. {/ W4 o V7 ?, \1 V6 Y - #define TCCHEN_SHIFT 22% H0 e7 q" T- ?6 O$ o$ v
- #define ITCCHEN_SHIFT 23- \( J, c4 E0 B4 H
- ]2 Z* K4 J& j4 i& r1 N: K8 {, I
- static volatile int irqraised1 = 0;, M8 I7 D0 \6 x7 B
- static volatile int irqraised2 = 0;: P7 i/ C! h: c0 k: j9 j9 F$ N0 ~
9 ~( M N' f3 y' w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& G& I7 F+ T8 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( v5 g' J( x' o" o. y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z& l7 h! h$ E* o
- ; M" \5 S# A h0 y* ~( Z( D
- dma_addr_t dmaphyssrc1 = 0;3 D/ m6 R2 Q5 `. J0 \/ ]
- dma_addr_t dmaphyssrc2 = 0;
, D2 B! [' R; R$ q( L2 f - dma_addr_t dmaphysdest1 = 0;; @7 ^% g. @; n
- dma_addr_t dmaphysdest2 = 0;& n' r) ~% `% I, N
, z. l8 b6 \- @) ]) P7 Y- char *dmabufsrc1 = NULL;
0 `& {0 \! R( _8 P6 N% l - char *dmabufsrc2 = NULL;
! Z' j. t6 Z; t. t! R, Z - char *dmabufdest1 = NULL;
% T' k$ l% ]$ \ - char *dmabufdest2 = NULL;
7 w) L2 J S% w- S F
2 t: w6 p8 p& H v( G, e. }4 T- static int acnt = 512;9 W% z) {% P K9 n; ?% k& z
- static int bcnt = 8;
5 k, d; A v" v4 ~! g5 X - static int ccnt = 8;* J0 K. h( O2 r' g. [/ T
- 9 Y: c' ]) e% c" z( }4 c6 A* I
- module_param(acnt, int, S_IRUGO);
* y9 B( |5 P, g& t1 L2 V - module_param(bcnt, int, S_IRUGO);
1 U( B& z. U8 H8 `; Y- t - module_param(ccnt, int, S_IRUGO);
复制代码 ~8 c# x, _, A; P& S/ b @
# A6 y/ k# n9 V+ y! A9 Y" b0 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Q! P: l# Q3 v9 E- Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
W2 }. f( a, N4 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K1 n3 [$ N) R8 |) U
( O+ ^& p0 G8 d' v6 c) A. @( n7 g
|
|