|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 M/ {7 }+ I8 F6 T# Z. S0 {- [code]EDMA sample test application
- H2 \* m# T' N: a - /*- x& n @$ C- R | T
- * edma_test.c
8 u9 b, {! _* u, O! j - *8 X! Y2 Y# o p' `* K( ~5 \. h
- * brief EDMA3 Test Application+ D, N! |$ P8 a% F
- *3 `4 ~4 J& ?9 p% J
- * This file contains EDMA3 Test code.
- T6 e) ]" O+ U# l: k$ m - *
; p8 J& F" w& n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [+ o5 v8 K% v! S# d" C% i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# W! }8 e6 }0 x) l) D' s
- * TO CHANGE.) Z8 O r. B. a$ a4 S* b
- *$ h* b, z. b+ n! v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ~& Z5 j- P3 Q9 A - *8 J) a8 v, b, s
- * This program is free software; you can redistribute it and/or' e# D. }4 }9 N3 p2 M7 Z/ m
- * modify it under the terms of the GNU General Public License as* \- l" U6 _$ G4 ]+ p$ V/ T' f
- * published by the Free Software Foundation version 2.
; T- v7 \! E. w/ Z; g3 |! B* P - *
- k: M; ^' O* v5 }6 ?0 \ B; ]; _" I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ _3 h0 G4 a5 d0 y; n
- * kind, whether express or implied; without even the implied warranty
6 ^/ ^* b0 I- j1 q+ V3 g3 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, K1 c" v" @3 Z! { - * GNU General Public License for more details.6 g& A! ~1 ~7 e5 a0 _. n6 l+ T
- */1 z* m0 K+ K/ g
- * F: B7 J, r8 e3 y4 v+ s
- #include <linux/module.h> L# _$ t# H! [) n: I
- #include <linux/init.h>
. `8 S4 f8 d+ y6 t$ \ - #include <linux/errno.h>: C3 f- I2 o/ [8 W, q; R7 s8 [/ y* z
- #include <linux/types.h>* M! f8 Z- ?# a4 x
- #include <linux/interrupt.h>' n( N; d* u: I
- #include <asm/io.h>
' _ u7 N/ m) m5 h: W5 r: H' E, T- w9 Q - #include <linux/moduleparam.h>
: L) ~" a7 @5 B0 W/ ~) Y3 ?7 M - #include <linux/sysctl.h>
/ \+ |5 ]1 H5 U i& I - #include <linux/mm.h>; N/ b5 c4 X+ t R5 }9 C
- #include <linux/dma-mapping.h>0 o' J( [0 G4 K; w( O: p7 f" v2 F0 ]
3 k* A' l/ n( _4 ~- #include <mach/memory.h>
0 Z% r# X A n) V' L - #include <mach/hardware.h>8 x8 B0 M# Z" _# H2 ~
- #include <mach/irqs.h>
! \+ t% [1 N& \& P9 e3 d - #include <asm/hardware/edma.h>
" j& q( U* g& g* P+ b( _! S - 8 z$ }5 b/ A- y R: V8 A& \2 F1 y
- #undef EDMA3_DEBUG k6 l& k. f7 f3 S0 i6 v
- /*#define EDMA3_DEBUG*/. z' e9 \' d) E6 _* a/ S! p! ~
- 7 X P% u8 q# ?2 O
- #ifdef EDMA3_DEBUG+ o: W3 l* v) I* j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% V0 o, D4 `& E; Q7 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 M/ ^' {( J B2 |# n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 x; A6 g7 R6 n% a' r - #else
; Y2 Y1 N. ~% |: i - #define DMA_PRINTK( x... )
& `- S: G; F+ b& ^ - #define DMA_FN_IN9 ]% n! I( ? V% N9 q% f
- #define DMA_FN_OUT0 {+ z6 K; D4 f
- #endif
! V& J5 @, x/ Q$ T4 s( m8 v7 x
9 Y% n- I+ c# E( ^7 G( d$ ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ n$ J# C& t$ {2 [* _! d, T# ? - #define STATIC_SHIFT 3
0 @2 s: H# }0 A+ ~ - #define TCINTEN_SHIFT 20
& f& [0 f$ p6 S; W9 T q/ \ - #define ITCINTEN_SHIFT 21
# m$ ?# ~* W" v5 x' x; [1 ]* V0 q - #define TCCHEN_SHIFT 22
+ H( _5 O' _# J( _ - #define ITCCHEN_SHIFT 23
4 N6 M. |9 t8 z" ` - & W5 t) w1 g' B7 z
- static volatile int irqraised1 = 0;7 }7 _3 A; B, H3 n2 ]$ b3 L! [
- static volatile int irqraised2 = 0;( i2 I G9 ~+ N, t& W; ~
* c+ y' P! }; Z, x3 M+ l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h' d- M- }9 S+ L+ a% c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& v+ o1 \. T. `' p" I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Z3 U/ U R8 N( H
, g9 H1 s( o7 n9 s$ R- dma_addr_t dmaphyssrc1 = 0;8 `+ P8 I5 W' T- Q5 P
- dma_addr_t dmaphyssrc2 = 0;+ Y, H* C" ^1 U n
- dma_addr_t dmaphysdest1 = 0;
$ F+ V; c+ r) a7 a c2 n' _ - dma_addr_t dmaphysdest2 = 0;
! O; i, a7 v, W$ }
& }) Y# O, W. y x) p- char *dmabufsrc1 = NULL;
$ h s0 s3 x, H4 T" D - char *dmabufsrc2 = NULL;
+ U5 G5 S8 N2 K! ? - char *dmabufdest1 = NULL;
3 k0 J6 W- Y3 C }+ n - char *dmabufdest2 = NULL;: R6 ], `# ?' j1 ?! a. s+ g
- " B# ~# P( ~( B2 k8 N
- static int acnt = 512;; Z$ K& c2 _8 k
- static int bcnt = 8;- B( T% X! }& O) F" s/ C
- static int ccnt = 8;" i4 m2 R" }# E' Y7 J0 I
+ R* \& z' t& X+ o0 F- module_param(acnt, int, S_IRUGO);
) N% H* Q6 @4 W+ g - module_param(bcnt, int, S_IRUGO);
$ }+ R& G- A" u/ Y% A/ M& q, Q - module_param(ccnt, int, S_IRUGO);
复制代码
; c) V( c3 n( T) K2 D8 H% ?$ J
; _, J; ?& m- m7 r$ N- W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 `8 I0 w d( \8 p8 P, X3 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ?9 \3 P. J9 o, D- h1 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 t, X8 C: i+ `* Z. P. ~: y! m8 Z; g% Z. h) _% t
( q! P# F: [. ?- F
|
|