|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \. [+ Q0 _0 E5 D& }( P. G- [code]EDMA sample test application F3 w6 g/ A6 @9 T
- /*
% J. {8 Y7 H/ o' W# M" {' H* P) o - * edma_test.c
% h* d$ \ C+ q* P" V+ I: y - *
9 ?! I: Q% L6 [/ @! I5 u - * brief EDMA3 Test Application
! K4 _4 v5 e A4 [ - *" o! t! N0 H, H" Y
- * This file contains EDMA3 Test code.
2 ~0 W4 p1 e* g; f8 S+ v4 l - *
/ f' b3 b$ m) p V7 i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ y: Q1 M+ }- T' K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. t3 F2 `# C, s& P _9 c - * TO CHANGE. t: C0 X9 W$ J& ^# P
- *
9 i$ @7 A! n- u) d5 Y) u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# L6 Y0 i4 A ^1 K# W4 `4 o0 N
- *6 m6 E! }4 g8 K6 ~. T& p# r
- * This program is free software; you can redistribute it and/or
3 o0 ^# G# _1 W/ h( j - * modify it under the terms of the GNU General Public License as
) J* P. r' B9 Y. b$ E/ l - * published by the Free Software Foundation version 2.% o5 s3 Q) i# l; i0 e. c
- *
+ L+ e( W1 D+ a5 @# N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 x$ s% I9 e: ?: l
- * kind, whether express or implied; without even the implied warranty
! b/ K: w v) ^& C4 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ y- I5 Y% A" U4 N
- * GNU General Public License for more details.- h1 V) x, }5 v- S0 |
- */# a/ b9 f# r+ Q, t0 @" i1 s
- 2 Z2 o, {0 W1 z/ j
- #include <linux/module.h>$ w- K) n3 W& Y$ A: z" h
- #include <linux/init.h> A2 I0 @- L% H& J. O& P
- #include <linux/errno.h>
4 t% ^. f- f/ u& Y: g8 \, S/ q- C, Y - #include <linux/types.h>
8 r0 G1 b. x+ m3 E( K - #include <linux/interrupt.h>) H7 b9 g8 i! T) L6 [% T1 V. c
- #include <asm/io.h>( E) p% C# s5 y7 B! K' X
- #include <linux/moduleparam.h>
! Y8 j. L" X# g R3 x; k6 ] - #include <linux/sysctl.h>
9 k2 w1 M/ S8 T" ` - #include <linux/mm.h>+ s1 I2 n7 o$ @" y8 @
- #include <linux/dma-mapping.h>9 V1 Z X" d1 U7 i8 D
* ?* q/ `# H2 {# h0 k- #include <mach/memory.h>
5 ?+ [/ N% r D& g8 d. h; c+ k - #include <mach/hardware.h>
; p, m5 r1 N: _3 J - #include <mach/irqs.h>
$ p3 I) Z: Q0 x& f5 Y) n - #include <asm/hardware/edma.h>
8 g' T1 @9 ?- l: g
/ L; m* r6 x% K9 |- #undef EDMA3_DEBUG! T3 A' G/ \3 s% n6 N9 P
- /*#define EDMA3_DEBUG*/* O! T2 j; a8 J* W' q" c) \' Q6 t8 x( a
s/ N" _ x, m( X c7 x3 `6 {" |- #ifdef EDMA3_DEBUG) o9 c& |* y; k( d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F' q5 g; a* P m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i8 s: N: v( ^) `4 ~- B$ Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
w5 {. b; O3 }+ s - #else
$ f; g, z: g# C- D5 Z" ]6 O# \ - #define DMA_PRINTK( x... )7 g/ E5 C- _! M) u$ W9 I
- #define DMA_FN_IN
4 v; u1 s1 y6 n, ?, E) } - #define DMA_FN_OUT
0 u% ~" y+ D4 m3 Z1 _ - #endif) l' k' @5 ~! ~" {- `
- ) K' _) t7 D( d1 H6 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 W% n3 M" Y2 p8 z
- #define STATIC_SHIFT 3. q: o1 i7 q4 N! g0 N- M' f2 L
- #define TCINTEN_SHIFT 20
( K; a1 R" H8 H; O* V9 j! ` - #define ITCINTEN_SHIFT 21
$ `; u' |! f. n' n: }2 N, r - #define TCCHEN_SHIFT 22
1 Y2 r+ n- ?# F4 j) |$ | - #define ITCCHEN_SHIFT 234 [+ ^( U1 r3 X4 v& x
- # l. \: Y: v1 E+ R. K; m: r
- static volatile int irqraised1 = 0;
; x2 ?! W& b' o4 d& |. B - static volatile int irqraised2 = 0;8 q. X% e3 _5 @8 I
: S& O+ ^, N; X9 r# B+ B% a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [8 l5 T4 p' P3 t: t% ~2 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 c0 ~* ]& N" J% ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G% T9 j4 c7 [3 [; |
- $ v: W0 W4 ^( I! O% |
- dma_addr_t dmaphyssrc1 = 0;
7 \4 n" A3 s9 a [5 R - dma_addr_t dmaphyssrc2 = 0;/ V; \' i9 Z ~7 _5 J+ o x
- dma_addr_t dmaphysdest1 = 0;5 y5 E8 k6 y5 ]* ^0 l/ c5 R K
- dma_addr_t dmaphysdest2 = 0;
3 }; Y' Z3 t( v* Q
* b4 X- `; w1 G( w0 n- char *dmabufsrc1 = NULL;
: I! S* b$ T9 e - char *dmabufsrc2 = NULL;
+ i. ?7 `$ f8 s# n - char *dmabufdest1 = NULL;
+ q! r+ n* w' |0 k) ?+ s" X, v/ u - char *dmabufdest2 = NULL;% P n. Z% g' F
8 e! r2 b4 l4 C. x6 N7 [" \6 c- static int acnt = 512;3 z8 m9 ^( B/ m5 t' V+ L% C' _3 J7 T
- static int bcnt = 8;
, b1 g9 i3 \ k& F - static int ccnt = 8;# |/ I5 u9 @2 Z9 U2 P8 t
- : L3 E2 @! C& L+ f# Q* Z
- module_param(acnt, int, S_IRUGO);
$ H( L3 @9 A2 Q! w( _: ] - module_param(bcnt, int, S_IRUGO);+ P: P5 R8 f( L: F' B
- module_param(ccnt, int, S_IRUGO);
复制代码
% _+ @* v; H! G, t& V6 B5 Q
# ~1 n8 l( ~% n$ f; c8 n' [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N9 }1 J7 F& `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 r. Z2 k- y4 g( A+ S) w: L% | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 C0 \; R! H. {1 p0 p
n% |# u/ j3 }- b0 N+ J, r
3 P0 }; p7 N& Y6 t" W: p( R
|
|