|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 x1 o9 \2 T7 a: y- [code]EDMA sample test application5 p% b% e2 G: M3 [+ ]+ L$ N+ Z0 a. t! c
- /*! C& i7 X0 ~" t3 B; M; G
- * edma_test.c! c, G4 M- l7 A& L. V6 l* I& m5 a
- *
9 ? n% K; K& D' m9 T - * brief EDMA3 Test Application% T$ n3 K! R' k
- *
' p" \6 [, H$ p: e, V - * This file contains EDMA3 Test code.
% f. U! T) S) i3 | - *" g0 l& R! @ O2 y2 G) e3 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# r% r5 {. O! G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 E" Z' U6 e+ B4 P7 P* R) \
- * TO CHANGE.3 {' k& D6 @& U
- *
2 a8 g6 q. O* H5 @9 J4 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ?, {- _% B0 ]; a
- *" a* c! i! U( f% w
- * This program is free software; you can redistribute it and/or
5 ]6 F+ X: v- v8 Y1 d7 W - * modify it under the terms of the GNU General Public License as' h9 [/ `$ D7 ]* S. A `; [
- * published by the Free Software Foundation version 2.8 w+ i9 G% ~+ x1 l4 P
- *3 t# {2 ?3 G0 e, W+ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ K& f1 D; X( R7 g5 Y - * kind, whether express or implied; without even the implied warranty& J& m2 O+ h# O0 @% [5 Q1 p& a! {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 e4 {/ _7 Z8 U" W g - * GNU General Public License for more details.' E$ n/ c8 O/ u0 H- i. s0 [
- */5 W) a2 |! |- o, p% L" L: u
; [; d# @' L" B4 v& Q& @- #include <linux/module.h>
; y) w9 b- w' A. y8 W+ p- H% a - #include <linux/init.h>. p: e) S0 Q! H" `- s* p- P
- #include <linux/errno.h>. z$ ^" b2 C5 ~" Y7 R3 O
- #include <linux/types.h>
; f! g% t' m3 s4 w$ x - #include <linux/interrupt.h># h8 D- ?; v/ B+ x1 h; g9 P
- #include <asm/io.h>
9 }0 J5 I: C4 @3 U - #include <linux/moduleparam.h>/ r% @' Z4 k/ X% y
- #include <linux/sysctl.h>. [9 I9 r/ }# D- Q: K3 n0 l# W
- #include <linux/mm.h>" L+ }3 V+ D; ]8 ~) W+ w" Z1 c3 l
- #include <linux/dma-mapping.h>' X. \3 F& z1 H( ?5 t7 r3 {# j
- & z: w$ }5 o1 G* u' }' d( y) l
- #include <mach/memory.h>0 T1 \1 h5 s9 D6 p$ q8 f
- #include <mach/hardware.h>, b! @1 N5 E1 T r' K* W* Z# s/ X. k
- #include <mach/irqs.h>$ o& i- t3 D( `" J
- #include <asm/hardware/edma.h>
1 T7 _. j8 q3 q9 m% n+ J9 m
, f: o3 `% W, |- #undef EDMA3_DEBUG
: g0 Y( u- ?2 v - /*#define EDMA3_DEBUG*/
% H" B+ w, {) u; y# P8 ?
2 c" J6 |1 v' R& [5 k) _+ Q! z- #ifdef EDMA3_DEBUG: C' N( j4 N) a, ?' E3 ?1 v& b" g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( s6 X; U7 [$ \: A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
Q4 k$ F) o* } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ W/ b ^3 ~8 p$ L8 |3 c - #else1 {+ y( D3 ?! M; {- T# K L3 w
- #define DMA_PRINTK( x... )3 `! P+ y' o+ N! ^8 A: k& S/ @
- #define DMA_FN_IN
: s8 O) y$ o) |& X - #define DMA_FN_OUT
' L. {8 y* S. p J6 A. C - #endif
- H7 X( L2 k1 y% K4 g0 M, `
0 }" Y0 [' ~: ~7 g: l! |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ]/ z- [ `$ W. k _
- #define STATIC_SHIFT 3
, V3 `" ^7 C; o4 _; d - #define TCINTEN_SHIFT 20( b. N& p& n9 o: ~
- #define ITCINTEN_SHIFT 21
2 J% i% S5 e) W1 |+ Y - #define TCCHEN_SHIFT 22
0 q1 G. |- Q* t$ x$ x - #define ITCCHEN_SHIFT 23
5 l. g+ `9 M! @5 q7 ^
, u# V* _3 N9 {- static volatile int irqraised1 = 0;/ Z5 v% n2 X7 l0 i. w
- static volatile int irqraised2 = 0;) `' S: _ T6 ~" y
! j# u9 i/ C3 j$ j- z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ? [3 I- l1 \2 E) C; E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w! D0 t/ b+ b$ ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d3 t. }, [* G
" u* G8 C d) ^, Q" f2 c- dma_addr_t dmaphyssrc1 = 0;7 s: j f2 E# ]" z( j/ c. S: @
- dma_addr_t dmaphyssrc2 = 0;4 b& K" e% b9 Q& R- X( K
- dma_addr_t dmaphysdest1 = 0;- s% P- k! F9 i/ B. K, H! h, P
- dma_addr_t dmaphysdest2 = 0;
7 Y; ?- @/ {, C+ ^ - " A) W. R- A1 T: |" J4 r& f; _
- char *dmabufsrc1 = NULL;
& Y) Q. F1 I+ G, O1 J, W, G2 A- u - char *dmabufsrc2 = NULL;
% T0 z8 x1 c1 O7 n- \; x - char *dmabufdest1 = NULL;
7 ]6 ]5 x! r+ u/ B4 C - char *dmabufdest2 = NULL;- E% T. s/ k2 {; B8 B
2 r; m9 ^! @: k8 S- static int acnt = 512;1 h: o! W5 U* ]
- static int bcnt = 8;
* j" ^3 E% q: s- u) I6 G - static int ccnt = 8;6 z/ O7 Z: e# z9 H1 _
6 x! n, f1 b! i. N; V4 T" r# w9 J6 W- module_param(acnt, int, S_IRUGO);) f- t/ |* Y4 h. B8 n0 {2 b
- module_param(bcnt, int, S_IRUGO);, j R) U d) [1 _, l- K5 F; X0 [
- module_param(ccnt, int, S_IRUGO);
复制代码
/ ^. d* e% L' U( Y8 c
" q- W6 y, D3 _. E* }- f' M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 n& e+ M- [$ karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M" t, R" i, u1 I4 v' G# G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w) h+ r% ~; c z' @8 y
. a! n Y0 v$ z e1 F
5 ~1 B% H: K" o* d+ [ |
|