|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% v' u4 E4 S2 b# [) w! o4 @- [code]EDMA sample test application
3 i% Q" ^6 Y6 c+ c4 W$ b) P - /*
, z h/ r1 H# q! E - * edma_test.c1 D( Q# S9 \6 @$ b ~6 k6 b0 w* `4 x
- *
0 Q0 }: A" a9 K3 C - * brief EDMA3 Test Application( |" F: ]* Y/ w5 T
- *
5 V: t/ R4 x6 Y+ |- [/ \8 X9 M$ A3 m - * This file contains EDMA3 Test code.- L9 P. ]2 D3 s' f6 m$ U( d$ q
- *
, n2 O: v( z& x- r- p- D. `) X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 D9 m" h* J7 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ w) R, H6 s$ s0 } - * TO CHANGE.: S1 O+ e# N+ W, {
- *9 M6 c; X) q! V1 x$ K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 _7 p) i+ Y9 j& N. M. ~
- *
* a7 T! F/ M5 {5 Y: f( _+ I - * This program is free software; you can redistribute it and/or
, E- L1 v) L' l. Z8 ^ - * modify it under the terms of the GNU General Public License as
4 S7 Q$ e# E' x( x1 K8 I6 p4 t - * published by the Free Software Foundation version 2.4 ^2 G* w/ C- ?% X
- *# i L) r. X+ S9 Y4 e# E" h- C9 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- P0 X& ~2 A/ N. {- f9 p( F - * kind, whether express or implied; without even the implied warranty" x3 X6 H' V3 r2 ]) f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" _% X2 y* ?, e+ C- S - * GNU General Public License for more details.# t. C" q, _7 ?, \7 H
- */
- |, v3 x5 o# ]5 I0 r3 G( S
6 `8 J! ], f, Z+ C5 u, F- #include <linux/module.h>7 c% y( a- {- U& _! f9 @/ [: f/ L
- #include <linux/init.h>% ?8 {4 g3 b2 p8 w0 @& P9 h
- #include <linux/errno.h>4 ]1 _) b: y# M+ S3 M/ ]7 x8 B/ C8 }
- #include <linux/types.h>
K9 E9 v+ Q, [' c# o& \, ~2 z# t - #include <linux/interrupt.h>8 B/ h4 L! ^/ }. h+ C
- #include <asm/io.h>
; n1 u5 T2 n4 T2 i) X2 { - #include <linux/moduleparam.h>
T9 [2 n: R5 a1 Z* C- D1 K - #include <linux/sysctl.h>/ z4 o" n# w2 j' k$ c( E
- #include <linux/mm.h>
/ @7 H) ]; O4 d) V! a* f - #include <linux/dma-mapping.h>
* @( t, d0 }8 G+ Z+ G5 Q - " ~5 Q$ ^9 l% w0 w; [& J
- #include <mach/memory.h># F5 Q5 U: |9 @1 ^9 w& [; n" O" N7 ~7 `
- #include <mach/hardware.h> W; p! P# f* M3 p$ S& E9 o
- #include <mach/irqs.h>* m/ b' o3 H% U0 Q" u
- #include <asm/hardware/edma.h> R B# f0 E2 x
- . o9 o/ l0 E$ N! ]6 U
- #undef EDMA3_DEBUG
) R5 N( M& m7 t% B - /*#define EDMA3_DEBUG*/ T" j8 g* ^8 K. K1 u- U2 H/ q. u1 Z
- _3 ~& x% Q2 t# O3 V$ E- #ifdef EDMA3_DEBUG
8 f- y" x- W" q. Z1 y+ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 i4 f2 D, P6 s) y! [+ t" ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) R- ~* {4 U9 X4 j( w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x. a3 t! p: q: V" c; Z( [4 z
- #else
4 X3 M# ^' J+ H, _ - #define DMA_PRINTK( x... )
3 o" x+ A/ }! K' G" d9 W5 E! s - #define DMA_FN_IN
7 }! b, A: I; k. g# }1 g4 \ - #define DMA_FN_OUT4 i7 _0 V2 F9 k! ]2 U0 J
- #endif/ p( m6 C* H( w3 }
5 z3 x: A* k( T$ H, u W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( _2 G* }. R! Z. S; ~; t( d& ^ - #define STATIC_SHIFT 3
( X. G0 _" N5 Z! }7 R+ V - #define TCINTEN_SHIFT 20# f2 Z3 ?+ f$ V! l2 f
- #define ITCINTEN_SHIFT 21- j% J: ]3 L. w8 a4 H M2 e1 C
- #define TCCHEN_SHIFT 22
" ~5 Q; X F/ b# u0 r - #define ITCCHEN_SHIFT 23
q" q1 B/ L+ y, a0 w - # F* b; X l" W/ n* }
- static volatile int irqraised1 = 0;1 v) a6 {4 P0 s
- static volatile int irqraised2 = 0;
( L8 l V* A5 ?: ~1 A4 H
1 T8 f* `4 l9 |0 i7 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d9 [, e, L& ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K! D' v1 C$ K/ b- T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 j; B/ y* t1 a6 z n
- R m, A6 q/ k- dma_addr_t dmaphyssrc1 = 0;3 f; R/ ]8 A' ]5 v x* l1 H& @
- dma_addr_t dmaphyssrc2 = 0;7 P0 u* v, K# H! ?, K. y/ P: X% \: m
- dma_addr_t dmaphysdest1 = 0;
$ x' A( u7 L( p1 s3 c9 L - dma_addr_t dmaphysdest2 = 0;
5 k# U1 V) d5 C: E8 R
# C: A* F9 A6 t0 C& G- char *dmabufsrc1 = NULL;9 c% T% V6 Q/ _- k* l
- char *dmabufsrc2 = NULL;7 i l% [& T1 ?0 E- f7 I4 i9 ]% R
- char *dmabufdest1 = NULL;1 d( @6 v' h+ j; U3 I$ G
- char *dmabufdest2 = NULL;
7 P- Y1 k0 v: ^0 E$ f8 ^8 t! M
8 D2 q% l) D( g) d7 V: l! i- static int acnt = 512;
. n* G( F& X, p- S7 _ - static int bcnt = 8;& n( A& @8 X k- V- y' Q% u
- static int ccnt = 8;5 Z- l& Q( @- e. \
- $ o/ L! Y8 H+ p
- module_param(acnt, int, S_IRUGO);
7 R/ m, _9 D+ G! R l/ U - module_param(bcnt, int, S_IRUGO);! p) b0 x0 M" L; X
- module_param(ccnt, int, S_IRUGO);
复制代码 6 i7 u7 A6 D1 d5 o( j" `
# p8 P, @3 K. U% l& P3 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; V% W, A+ t, Z9 b: f' 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 Z1 J; i6 G) P, X& [' { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) i; d" r( k$ r" @ p9 t8 `& t
$ K. z3 a5 G3 @
& T3 v Q* x/ w& Z' g7 k |
|