|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( C* ?# K9 m5 v& e- [code]EDMA sample test application' [! i7 |4 z4 @
- /*
* F$ b1 m+ W; [+ S: L8 [/ w - * edma_test.c
# Q. T: n" _7 ~ k$ }/ Q! [ - *% m" I( f8 J& e' i
- * brief EDMA3 Test Application3 Z, [ ~9 E ~- R4 b8 c1 F4 \
- *
* K( X' Y* c8 W' j s m - * This file contains EDMA3 Test code." J, O4 ^. X+ n
- *& H" O2 H& N+ C( Y& b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
p) N2 P, R; S+ V) ~5 e9 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
s) l5 @* [3 \ D r7 x - * TO CHANGE.
& d; }& h* }1 i/ p - *
; C! k$ i6 X2 v/ k t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( F. v0 R0 a! d8 |# c - *7 `3 _& t4 O5 C! w
- * This program is free software; you can redistribute it and/or: c% S2 t( q4 A, o9 z) j
- * modify it under the terms of the GNU General Public License as
5 r$ U& } G/ Z( k7 x8 P' H - * published by the Free Software Foundation version 2.9 x) {2 [$ i( e1 v
- *
9 s! C( _- t* W- ^) B5 D5 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' W/ n' V+ A3 k% y1 l
- * kind, whether express or implied; without even the implied warranty
. [" c5 ~" G8 k1 v) |- r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! q. G) B1 ]# a8 H, ?
- * GNU General Public License for more details.
: ^3 F$ l6 S, h% d - */* y. _+ R: I# d: [ v
- ~7 v7 c; f5 u1 i- S8 D/ J5 M- J* k
- #include <linux/module.h>
7 A7 F% y0 S: V k. ^6 `( Q$ E3 D - #include <linux/init.h>
8 v: K2 g7 b" u7 k$ X - #include <linux/errno.h>
! m/ j: Y: G/ ]8 u/ G - #include <linux/types.h>5 K6 a; T3 ]" ]% E3 v+ B
- #include <linux/interrupt.h>; V' i2 f9 z, k) |/ V3 v: h0 X
- #include <asm/io.h>
1 f1 Z) n5 T- p4 C - #include <linux/moduleparam.h> y- Z! y$ u6 b' S/ ^" d/ g
- #include <linux/sysctl.h>
1 b3 m/ O. X2 R" { - #include <linux/mm.h>
! W9 w. @' W2 ~: M h, q - #include <linux/dma-mapping.h>
# r4 e2 F0 A& v: R& I" Y
! K5 D! h# s* j- H6 X% n* w A- #include <mach/memory.h>
( ]$ Z V2 A2 [& h - #include <mach/hardware.h>
! z4 V% o% T% S8 }; F3 D - #include <mach/irqs.h>
! H* F* _" b: r6 { - #include <asm/hardware/edma.h>1 X/ Q: C6 J! v: z% L$ u1 n
1 U' Q/ J! d, d+ j# y- #undef EDMA3_DEBUG
0 G b, `9 n% J* r3 I9 O; J+ s - /*#define EDMA3_DEBUG*/
+ h a- K" k K$ Y9 L8 V - & |! Z% d. L, ~! H, c
- #ifdef EDMA3_DEBUG- c9 q- J; G# @, d' m/ f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) I$ {; r+ S% V Q, ?' a( U7 i1 D# Q$ \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Y0 S6 B2 p& p) ]7 g5 L5 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 d* ^# \+ L0 K# m: _! {7 D
- #else
$ x2 _3 t1 @3 `1 ^. g - #define DMA_PRINTK( x... )
, }( \8 \% E) L* n; h - #define DMA_FN_IN
2 A" J5 c& c4 |" ^. } - #define DMA_FN_OUT
5 W9 o) Y' n/ Z7 e: V - #endif
, T$ `6 h' h) w - ) r& p. P& @9 b# s: h( E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, X! o5 r& B/ Y, t8 w1 }7 d - #define STATIC_SHIFT 3' J/ `( ]) j: S) k P7 P- o* n+ s
- #define TCINTEN_SHIFT 20, n/ |. d( z2 g$ j" Z
- #define ITCINTEN_SHIFT 216 g, y3 Q R( z
- #define TCCHEN_SHIFT 225 X+ h( h9 c; b. ~2 d6 A
- #define ITCCHEN_SHIFT 23& F, @ p" u" f8 _
- 7 ^7 L$ f6 }9 G( P. J( e0 N9 E
- static volatile int irqraised1 = 0;5 g& }- J9 a o- l5 Z
- static volatile int irqraised2 = 0;7 F5 B- t4 M% u
- . l- ^" u- q' E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- n3 i$ @) h6 |! e* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 P2 e! _! n5 J5 A6 E+ p# n( @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F, U, e4 U2 f5 v1 r
, {+ K5 i" k; f; }7 l- dma_addr_t dmaphyssrc1 = 0;
* u( v% ?9 h+ B3 P7 u5 s - dma_addr_t dmaphyssrc2 = 0;# M% f8 C; c; J0 }: K5 o
- dma_addr_t dmaphysdest1 = 0;) K1 U' P6 P( q1 l' v
- dma_addr_t dmaphysdest2 = 0;
. o+ m0 s7 y2 `; b5 y4 W, n- [; I
; w; e r+ g7 Z* m7 M- z; G# l- char *dmabufsrc1 = NULL;9 x" ]) D: W& I$ \0 M" R3 J
- char *dmabufsrc2 = NULL;, @2 n+ W8 i2 { O; `2 Y. w
- char *dmabufdest1 = NULL;( \' J3 N5 R! I2 V5 ~
- char *dmabufdest2 = NULL;
2 b1 x4 b1 b0 ^9 A - ! P+ B5 b' s- {6 `) p
- static int acnt = 512;
& V: F+ E: E# R; G8 b+ e+ Y! ?* U+ V - static int bcnt = 8;
2 m9 p5 e$ M. k - static int ccnt = 8;% j$ m9 ~7 i9 A& ^
- 7 p, s5 n+ K2 V0 R" {$ u
- module_param(acnt, int, S_IRUGO);! z& X2 @2 K( V! s" a9 c& v3 e" |
- module_param(bcnt, int, S_IRUGO);: [, B+ f+ T2 f* ^ H! N( W
- module_param(ccnt, int, S_IRUGO);
复制代码 5 k. P& D* a% R8 r. n7 P3 E( ?. z) u7 _
/ G/ V' H1 j( \( B% Y! I i# A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% _: j( I& q& \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) ]; Y: f) f3 {! J- K" Y6 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t9 j$ L4 l" u! a8 G0 d0 `9 ^& \6 [8 O4 s5 l
1 P; _2 ~2 R, R/ H% N5 I( R& J
|
|