|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 s% w v/ |3 W# K: C5 I$ w$ Q
- [code]EDMA sample test application, \+ e0 z2 i8 `6 O, [
- /*, e) g$ i) i8 C, [) }8 \
- * edma_test.c! v$ C: n1 r h8 V' T- n
- *1 A& ~5 b8 j# f c- G# E
- * brief EDMA3 Test Application
: U: E$ B" n2 v! e _0 _! _8 [( } - *
0 |, F8 y1 \8 u0 T6 G k5 O - * This file contains EDMA3 Test code.
: I; ?2 K7 \. S7 W/ M& a( ] - *
, ]/ W- i8 S/ b' K- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h: n1 g/ \. d5 @/ T3 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; V8 h$ F5 `1 f* x; x9 w1 a. w ~ - * TO CHANGE.: H; |+ {( c- o' n
- *& @4 k4 }* a2 _9 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 X, o/ W! r# D! q1 f+ q8 J
- *' A$ O# }6 n- h6 I) E/ j0 v
- * This program is free software; you can redistribute it and/or
- f+ h c) f% z) d4 Y - * modify it under the terms of the GNU General Public License as
/ U/ {) f' W: Q- u( }0 }/ C& w - * published by the Free Software Foundation version 2.
& y+ G, k# C' y4 L9 R) M - ** E# M$ z- o$ E4 q9 @/ O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) H; n" j5 Z3 J! b$ L
- * kind, whether express or implied; without even the implied warranty- N+ v9 m4 A$ ~ t7 a" s, E: j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 Q) P$ b7 J7 @% S - * GNU General Public License for more details.9 M- S6 O I# V( `9 I% }: d
- */
* u& [/ @# \- @- m# H - 5 |$ O4 } _) e7 Q# q/ E) p0 E
- #include <linux/module.h>7 U; o% r: t* _, M* v. W
- #include <linux/init.h>
" Z+ B1 M0 `+ D, ]) y) A - #include <linux/errno.h>
/ G0 r" u9 e1 \' x8 ?5 T( w - #include <linux/types.h>
( k" C! {. {$ m: U0 I ?3 E - #include <linux/interrupt.h>' w, P0 N) p6 j% [
- #include <asm/io.h>
4 B. z- p; m9 P$ w' g# k - #include <linux/moduleparam.h>( R5 Z0 k$ J) x/ @3 e* t6 E
- #include <linux/sysctl.h>
. W; b. }& ^+ S/ A - #include <linux/mm.h>
1 U& I1 e. p, M! y( H: d, V* ~ - #include <linux/dma-mapping.h>
9 h! n7 q3 X& X9 q K$ b
1 |; i, H6 Y* L9 y/ h( j+ n( e- #include <mach/memory.h>2 n4 r# C$ h; m8 c8 r
- #include <mach/hardware.h>
: l W' {" d, B! Y8 R3 U! x - #include <mach/irqs.h>
" S+ d8 i9 `( {6 d - #include <asm/hardware/edma.h>/ |0 j, N% N+ ^* D
I# ~+ p; E/ | X( S1 N- #undef EDMA3_DEBUG1 m5 d# b! a- T, m% g4 \: j( f6 m' B: W1 T
- /*#define EDMA3_DEBUG*/
* J/ b3 F7 k( F1 ?$ ~. X( X
. n6 K, Y4 |' j6 v$ q- #ifdef EDMA3_DEBUG) ]2 E8 H: w# r: [3 D% x3 }+ v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 d' U9 K" _: `. | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* c/ }+ F' j0 v5 H2 o* e, Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- [+ f; n) @$ q1 |5 m - #else2 P8 [. |) V! B4 F( U
- #define DMA_PRINTK( x... ), n/ B( t) ]/ \5 O' H z
- #define DMA_FN_IN
# j& s1 r1 H+ i& ]+ P6 u! z4 R. L - #define DMA_FN_OUT
# F9 e$ z5 d: R) Z - #endif, }1 C' [. q' s8 y9 ?
% h$ D' Q/ ^3 Q; {* } S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 z# k5 ~+ j* f5 }# _, \' T( \
- #define STATIC_SHIFT 32 d$ O- o- b7 y2 `& B
- #define TCINTEN_SHIFT 20
) H: j3 Q6 {! y. j d - #define ITCINTEN_SHIFT 21 @" u( P( {; I$ d
- #define TCCHEN_SHIFT 220 c0 f) l9 `9 Y
- #define ITCCHEN_SHIFT 23
# V$ _( p' B4 `& \: P- O2 }; q - 8 Y: M. T( x( D: c+ G/ F. ]$ o
- static volatile int irqraised1 = 0;
0 O, s- q* S$ j( m- \( P1 k2 Y0 E - static volatile int irqraised2 = 0;
5 J2 ?, z" p: Q' ?' O
3 T$ z3 j1 ]* V/ z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' V8 r9 \; K ?3 C! i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Z1 `8 \, @2 W7 X( b0 K& h* V5 F/ k( A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^) `9 u0 h! e5 Q
) [8 k6 r2 Y+ _% g- dma_addr_t dmaphyssrc1 = 0;: ]. ~# Z6 G; W X: p0 E! T
- dma_addr_t dmaphyssrc2 = 0;; X- q$ G5 k5 n" ~' Q. g3 {+ J# S
- dma_addr_t dmaphysdest1 = 0;* f. m: K+ i3 u2 j0 O
- dma_addr_t dmaphysdest2 = 0;
8 C. d. H$ `: v1 E. z" P - & i4 n8 E: Q" ]9 |
- char *dmabufsrc1 = NULL;+ u$ X( n" \2 v2 j0 H: _; l
- char *dmabufsrc2 = NULL;
3 K& M4 r# f" X4 Q; T& Q5 v - char *dmabufdest1 = NULL;
$ I5 e6 L* p7 \. I7 m, Q- P - char *dmabufdest2 = NULL;! a1 _: t* V5 F
; _5 o; I% u/ o- static int acnt = 512;! P- B* j- v' G8 D
- static int bcnt = 8;/ i; {8 f7 r1 W6 l
- static int ccnt = 8;
4 j& W' P0 U2 W4 n+ s. a
/ b/ m* b) n! @- w; W" d* |- module_param(acnt, int, S_IRUGO);/ b9 W' b! E' u, @
- module_param(bcnt, int, S_IRUGO); O+ r; l) o4 G+ l$ X
- module_param(ccnt, int, S_IRUGO);
复制代码
9 ?5 H& ?3 g# z
0 d H( z; x* c* C; J) `, W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" a5 |7 p$ J- K. ]6 G: }! }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 y* t) ^ C6 x8 v$ r& R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- u. y2 Z/ b2 F+ I) n
$ R/ i0 N( O' _ S
! c6 k- E2 w$ b- O! ?/ V8 e$ t |
|