|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d6 t. \! {# g4 J: i9 ^- [code]EDMA sample test application3 M3 g0 i) C2 ]% i* i" ]; b# U
- /*
% m* l7 j1 b- K! C - * edma_test.c; X; e1 Q# |8 o) G
- *; ?& A7 v3 l+ l) T& d
- * brief EDMA3 Test Application
5 ?" G L, f8 ]" h4 v0 L - *
" B8 }) m0 n. V6 j1 P - * This file contains EDMA3 Test code.6 M2 P* I. A m) _
- *" ~2 K0 X- q& w6 T' o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 |9 z2 y9 I/ r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; [& I/ k* r- u: R: e% R) v
- * TO CHANGE.
! V* o' n/ W# `! }& ~ - *6 D7 n- ^ c. R) r# L5 d. P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( P' Q9 [$ s& K7 @% S1 R
- *5 q; O8 p, ~2 m7 U
- * This program is free software; you can redistribute it and/or1 M3 {2 _$ ?% y! L
- * modify it under the terms of the GNU General Public License as
8 n5 c0 @ q7 `4 b# C - * published by the Free Software Foundation version 2.
6 F. W+ _$ F5 X. J - *
3 o& k: K, }5 B2 R+ ?' U2 _/ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, |; X" U4 t7 N1 O' ]: g3 z( o7 K: O
- * kind, whether express or implied; without even the implied warranty) c; u# [1 V) D7 e5 [: q- W+ J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 o8 b8 {" G5 s; G1 F
- * GNU General Public License for more details.
" S" F/ t- A6 N; |( _, }5 k - */
* ?$ @+ I9 r! p# `
+ ^) ]- Y: v% @* D( M/ U" c$ ~- #include <linux/module.h>' {! e- P' ]4 ^: B; M5 R$ a
- #include <linux/init.h>( X) p) a4 J+ D+ d3 @, M6 p! X
- #include <linux/errno.h>
5 z' K2 X' |5 }( H5 ]& R - #include <linux/types.h>
: O8 Z5 `+ J9 k6 N: f - #include <linux/interrupt.h> q; O% X; L2 m( w" u' v6 o% {
- #include <asm/io.h>- B, W7 V/ Z6 v$ k) r, K
- #include <linux/moduleparam.h>/ @4 K! @- c/ f# N* e9 n2 X
- #include <linux/sysctl.h>
0 L- z, U* p, h P- D( d - #include <linux/mm.h>' x, y# ~- }+ K( Y, S
- #include <linux/dma-mapping.h>! X6 B8 ^# k: |2 X
- + J0 D5 ?* R, x
- #include <mach/memory.h>
8 O* Y& ~1 |) P, C! E - #include <mach/hardware.h>* B5 N' N: U8 i! i: V7 m( Z
- #include <mach/irqs.h>
3 J! T& k O6 K0 j, l& N - #include <asm/hardware/edma.h>
% Z+ g. r1 R8 N& B6 d$ u/ C* I% d
! K+ t% x* W- q" e8 Y- #undef EDMA3_DEBUG5 k9 j; X6 H8 p2 K: C: y2 Y
- /*#define EDMA3_DEBUG*/
/ `" i! _2 Z% Y. n
1 \" c' V# ^4 H) t! y$ G( ^- #ifdef EDMA3_DEBUG
! w+ \) g+ F8 N$ c; _- ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ~$ h4 J }/ F' _+ L1 f& D+ f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( X2 ? n! y5 H7 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- t5 V t, K# G6 s - #else
; D5 Q# _* O2 L8 _& R! R/ _1 f0 m - #define DMA_PRINTK( x... )
6 D/ h+ z) U+ n - #define DMA_FN_IN
N1 C# d8 Q g& U - #define DMA_FN_OUT
7 C. G% A. y( m% ?5 i' V8 q2 m - #endif& s% h2 b% ~3 u9 G' V% }2 v
1 v+ e/ p, h% B6 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 Y0 u: H) H& S1 c, J2 V$ h
- #define STATIC_SHIFT 3
( _5 H# T' C' o, j! V5 Z - #define TCINTEN_SHIFT 20$ g! ~4 y# j+ ^' n1 s% f+ |( g
- #define ITCINTEN_SHIFT 21) N- n$ o3 s2 l# G
- #define TCCHEN_SHIFT 22
F; _; o6 E$ B9 t( g% k - #define ITCCHEN_SHIFT 23
" s. R8 Y4 V, @$ \* ]- R
" c+ N) u) r& T" P. R" H% l- static volatile int irqraised1 = 0;$ N+ q- }, }( z Z
- static volatile int irqraised2 = 0;
2 r' X$ n% D- o. j# p) @ - / h6 h$ ?) W: H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- }' ?+ J. A5 s: u j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 v" B+ W+ l! X8 Q# M% B# `' a( E8 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @0 m0 s( W% H! N% Y2 Z
: v) B0 J2 R# W- dma_addr_t dmaphyssrc1 = 0;) _: } Y6 N2 w: ~. P" A
- dma_addr_t dmaphyssrc2 = 0;' j% h3 P! V8 t# A9 m
- dma_addr_t dmaphysdest1 = 0;
7 G- X5 w+ ]) q# @! @9 p l - dma_addr_t dmaphysdest2 = 0;3 e6 f6 a, y- E3 c
- % O5 D5 v& s% d2 z# w2 l
- char *dmabufsrc1 = NULL;) P1 t+ e6 t! t: b1 Y1 V0 [& @
- char *dmabufsrc2 = NULL;
4 z+ ~ w. \8 ]9 Z& l$ h2 l% N - char *dmabufdest1 = NULL;
1 ^' ~& G- J4 Q% l" N - char *dmabufdest2 = NULL;
7 q& K( D% P' ~& A - # P) O2 B5 N% L3 B$ H+ A
- static int acnt = 512;$ G1 v/ c: S$ _0 Z, w. R$ N
- static int bcnt = 8;
3 o+ \2 H+ f- A4 J6 W - static int ccnt = 8;
9 ^; v/ i: u, k% s
3 H2 }; ?8 E8 y8 }5 Z- module_param(acnt, int, S_IRUGO);: h4 ^: h$ X7 c. o9 @7 O
- module_param(bcnt, int, S_IRUGO);
. Q% N3 g g5 u$ h/ @% O - module_param(ccnt, int, S_IRUGO);
复制代码 : ^; o$ Y& t0 P
% @2 |8 v8 Y" c) M8 Y1 [: I. y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, t; K" V. r5 \5 Z8 ~% f4 sarm-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; m' |/ v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; c1 k+ j5 W& T3 U/ z2 ~1 N0 x( o6 n; o& V
* }- Q: [4 ~: X" V" X4 x |
|