|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 D* V, j O z z3 y% U, z
- [code]EDMA sample test application& |* S& C) W/ \% R
- /*( e* g$ `3 i$ L4 ?, J k
- * edma_test.c0 j3 x' O: c5 D0 V. F2 D
- */ J4 G# ?* z0 Y% D/ Y U: d
- * brief EDMA3 Test Application
( _$ D4 B/ [* I9 Z0 Y# p( T" u, l - *
$ T1 P6 @- H5 x& G' j) P# F - * This file contains EDMA3 Test code.2 s# Q/ S7 b4 C8 H; B
- *0 b8 J4 _5 L' O7 O+ D" b+ r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' i2 t) I1 w* a9 i; m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ y2 b6 b% d" [; v1 G/ h' A5 i - * TO CHANGE.
- l- c3 d/ U1 m' E& ` - *
& d a, [% R) c# s8 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 x8 w" h( u5 F9 }- ?! a/ V7 h - *1 d5 I" v# e% w( `
- * This program is free software; you can redistribute it and/or' n5 D8 ?9 j C) i# z# |0 W
- * modify it under the terms of the GNU General Public License as+ O! x3 z/ z& A9 b& A. s! B; p
- * published by the Free Software Foundation version 2.- `& R/ B! j! s, O' b2 j4 l
- *. A' t, f/ l. d: ^ `9 l6 D( g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: v) m" f2 p( Y- ?4 i$ A - * kind, whether express or implied; without even the implied warranty6 o9 [2 F j8 Z; {( a9 d9 N1 E, w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, C: w1 z8 |4 i) B; K9 y - * GNU General Public License for more details.
4 F2 [. ^# e$ a; M% F; q4 N - */
( g+ O! B b, v5 `6 {5 W
9 e) \9 s/ J+ P3 M; V" l- #include <linux/module.h>, n0 J: U" s5 H( t
- #include <linux/init.h>
5 ?: ?) G8 k2 y& } W - #include <linux/errno.h>0 J# r7 J/ W5 l* Z
- #include <linux/types.h>
! j5 v) ^1 e% W! ~, e& g# F - #include <linux/interrupt.h>
( p- v5 R. n U+ W) S: x$ l ?% X+ O! h - #include <asm/io.h>
/ w9 z' m; \5 i# d) h$ m( M - #include <linux/moduleparam.h>' J0 L4 e' D$ }9 d7 f) K+ v5 u. H
- #include <linux/sysctl.h>6 V9 R* z, A- `& o$ J+ W+ a
- #include <linux/mm.h>2 _/ O q" e3 |# u; t" m
- #include <linux/dma-mapping.h>
* x# e. o+ f A - 5 K7 ]( ~) Z4 r( {4 O
- #include <mach/memory.h>( ^2 u# g) I, H! E4 K( u
- #include <mach/hardware.h>, U- @1 |* l* M# W" h& n, w
- #include <mach/irqs.h>2 F2 K; m, D/ ?2 q% y
- #include <asm/hardware/edma.h>
! P' B8 i$ \2 P8 y& R1 ]
! O b W! f% `; |1 X' ^2 L5 m- #undef EDMA3_DEBUG
4 l/ s7 H; d7 B1 {* h2 @ - /*#define EDMA3_DEBUG*/0 p' P$ y2 F6 e* b: Y
. H0 `6 U, ]& d1 d& u- #ifdef EDMA3_DEBUG
" I W5 ?6 I& t( F% q: { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Q$ W) L" I; T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 H, N6 ` n0 N0 L: W9 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a# y) Q2 x Y0 D5 x( Y
- #else
" i# ~6 |5 c7 k% J6 a- Y4 P; g - #define DMA_PRINTK( x... )% H9 h$ |. o! c/ H- h9 L
- #define DMA_FN_IN$ n5 |* e$ X. Z0 e4 b
- #define DMA_FN_OUT; _- K, ]0 J+ L W2 o* O6 s
- #endif
; m5 K# C1 B/ y8 q: L. r, G - ! J8 |- i8 N9 m0 Y( N: G; J- L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& M! D7 h$ b* T4 A7 ^6 k8 D8 \/ e# a - #define STATIC_SHIFT 3
. ^. e- F4 Q( M: D- q: x - #define TCINTEN_SHIFT 200 E2 o, w8 z% f
- #define ITCINTEN_SHIFT 214 }; k0 Z7 }* F% H( y
- #define TCCHEN_SHIFT 22' N3 z7 H8 h8 E' L% @* U' N' u
- #define ITCCHEN_SHIFT 23
! r$ j7 |6 r; [8 {+ w" ^) n, _# [ - ) r8 M. _# Z7 D, D
- static volatile int irqraised1 = 0;- H4 z2 A: R2 l1 t
- static volatile int irqraised2 = 0;
- Y1 T* d0 B. S( o% D
/ L' W0 n r- v h) M/ s. _7 o }% Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t3 |+ u8 _/ u8 a% ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
X) d2 g8 `! x+ l! R1 {0 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) q. m! M# y2 x4 ^8 K
0 c0 T& Z# Q- s K- dma_addr_t dmaphyssrc1 = 0;; E; B4 c' r. e' f- {% P
- dma_addr_t dmaphyssrc2 = 0;8 k! C/ S1 r4 ?, n" Z2 a. R
- dma_addr_t dmaphysdest1 = 0;
4 V) [9 t) H0 j: p, y" M+ A - dma_addr_t dmaphysdest2 = 0;
$ p( T) m6 z& u3 k6 P - 4 y3 V E! E" W* e y
- char *dmabufsrc1 = NULL;4 P7 m0 _$ c, D0 M/ Q" M. @2 A
- char *dmabufsrc2 = NULL;1 I; e, k& P: |7 R
- char *dmabufdest1 = NULL;
. r1 x, E: t8 C$ r6 e - char *dmabufdest2 = NULL;4 Q }3 [6 m5 _2 i9 x6 |
7 i: t- |* ^3 w* Z- static int acnt = 512;
7 o" D' x4 h `1 U - static int bcnt = 8;
3 h8 g' r* c4 Q. P - static int ccnt = 8;
8 W& h" A, U1 N5 s8 V# h7 h' `' F
8 A. A0 {; ^, T2 [. n- module_param(acnt, int, S_IRUGO);
; r4 X( h' \% `5 H6 g - module_param(bcnt, int, S_IRUGO); V1 |9 ?- R( s% f* a- _2 Q7 k
- module_param(ccnt, int, S_IRUGO);
复制代码 3 E! l" E$ D, b9 V/ H/ I$ O# I
; n8 _& o: ]/ k' f* }, x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 N# g) f/ ?+ H- J6 r: x9 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: s. O( q6 z; C& _" X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i( y" k: i" ]" z( C2 V% M. i' Y) q; Q9 W
% V3 k& u/ P K9 O4 c
" U4 e& d: f) w8 @0 B# x$ }. G. ]' _ |
|