|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u$ x4 f, N G1 e+ K" ?
- [code]EDMA sample test application
1 s4 V9 v, Y; ?' u - /*5 ~/ s2 [7 r# l# x+ S# p3 T3 s; q
- * edma_test.c
r2 m; s, `0 h& u: }0 i+ c - * _; d0 @+ D% X" Z4 f. c# P" n8 W
- * brief EDMA3 Test Application
. `$ A% P; R, z; n - *+ G( D2 [8 j! s. d) N# V
- * This file contains EDMA3 Test code.) ~, \( C1 y' _* Y/ \& I! \& R; X
- *: N: E& }) H" Q4 f9 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 W/ v( R- @3 u6 g/ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ` N- c1 z4 ~" w8 } - * TO CHANGE.
- p3 u2 d9 b; h$ w6 Z! ]2 R1 V - *
3 \8 `1 e u" V( o2 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, j9 {* t: i3 V! c
- *. f l) ]/ t2 z$ D# T
- * This program is free software; you can redistribute it and/or
: h$ g6 o! T% v - * modify it under the terms of the GNU General Public License as" @! I& Y. f- c) M# S- a) [8 A5 t+ V
- * published by the Free Software Foundation version 2.2 J1 b, J8 @0 ?& L) k* a7 _3 J" X
- *
3 j. z3 J* s/ }: [) m+ q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 b. e5 D3 S0 ], ~ - * kind, whether express or implied; without even the implied warranty
% V! E% q X+ ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- e1 z& E4 j, D" ~: O
- * GNU General Public License for more details.
: g' |+ U% q% U - */" G/ R* p4 H) ~" Q% Z0 \3 Q- o
- t+ J9 G. d0 o, |/ _! `" n r) n
- #include <linux/module.h>, Q% x, v5 P* J; Y4 q
- #include <linux/init.h>
: ~, x$ g! e% R - #include <linux/errno.h>
% ~, \5 F* a: S. q9 r. w - #include <linux/types.h>% |$ G' E0 @& q& k. i& `1 A
- #include <linux/interrupt.h>
. }1 Q9 ~2 \! s& g7 j - #include <asm/io.h>
# S9 [1 R1 |; ^; Q& z' d) Z - #include <linux/moduleparam.h>2 g" w: k" f* A/ e9 _
- #include <linux/sysctl.h>
/ _$ S+ o- w* ^/ w - #include <linux/mm.h>
1 O7 C# C" o1 `( }8 p - #include <linux/dma-mapping.h>" ]( [* n6 i, X; F
- + |% _8 Q" y/ l7 t/ b& a& d
- #include <mach/memory.h>& f0 N9 l- V( `
- #include <mach/hardware.h>' ]) `1 C. H" A3 i7 ~$ t
- #include <mach/irqs.h>
0 I9 z) h/ J: X - #include <asm/hardware/edma.h>+ K9 ]6 n0 d8 G- i( @' @% i
- 3 H% ]2 ` {2 i2 x
- #undef EDMA3_DEBUG+ n3 c) r" T% T) R" }
- /*#define EDMA3_DEBUG*/& h# j; A( O3 A) l9 J
! O8 @$ w7 p) s% F3 [+ z; m8 O- #ifdef EDMA3_DEBUG
- [8 {7 O" W: U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m0 w/ C: ~* A B+ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 ]) z$ n6 P7 x3 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 e$ P. z- b9 [* ? \& B - #else
" {2 u/ ]9 o* j( N# s - #define DMA_PRINTK( x... )
3 H6 g* ~ z$ q& S - #define DMA_FN_IN
; F6 q. p# K. k8 t' C - #define DMA_FN_OUT& N% F! F0 u4 C9 L
- #endif
: ]0 X7 v% f3 C8 k9 W& A
; U" K5 e0 M# n5 O" q$ y3 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% }2 H$ v* U% c/ `
- #define STATIC_SHIFT 34 n& g' M+ u; c% S# q1 d; a$ A
- #define TCINTEN_SHIFT 20
X @; ^+ h: O6 _$ Q - #define ITCINTEN_SHIFT 21
: u3 \- ]6 u; }! Y! y- B$ T h0 V - #define TCCHEN_SHIFT 22+ m0 t4 Y3 w! `$ g1 |+ r! h( g& | l& w1 ?
- #define ITCCHEN_SHIFT 23% B3 ?: m( P+ W; [4 P" _; Z% e
- - h" A) \! i0 t7 x) `
- static volatile int irqraised1 = 0;% l. f1 o& z$ L: @* \
- static volatile int irqraised2 = 0;( C6 P: k" \$ S! c
- ( ~+ M! ^, x' f5 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 q: V7 ]7 d0 ]) R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 r u: D$ U# N* m% q& D, e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e; Y5 F% q4 u. a, I6 n2 b+ p
- ^$ b5 _* \+ @( P( r' I( k- dma_addr_t dmaphyssrc1 = 0;
1 G: w, a6 L) s; ~0 Z6 _: x - dma_addr_t dmaphyssrc2 = 0;% Y: h7 g3 H- d% R
- dma_addr_t dmaphysdest1 = 0;
# x/ a& C0 K) E* Q9 P) M/ j: K - dma_addr_t dmaphysdest2 = 0;
3 V; @5 q& d$ p, y
0 O( b: B1 t" y. B5 d3 B' X- char *dmabufsrc1 = NULL;% \8 y% a& _2 `8 {6 f# H1 Z# o
- char *dmabufsrc2 = NULL;
- T2 `# s+ A! p8 j9 H - char *dmabufdest1 = NULL;: B+ ]* ?* }* _& a9 P
- char *dmabufdest2 = NULL;- k9 |7 P7 n7 T" M# D" X. r
- b/ c- _2 d2 l
- static int acnt = 512;3 Q' H: t3 c4 E1 D7 d) ^& e
- static int bcnt = 8;( ]" x) {- F! S5 I% k1 ^, v7 u
- static int ccnt = 8;
. |- \3 ]- j( @8 ?4 r j
2 s! j- z9 V ^- module_param(acnt, int, S_IRUGO);
* f9 c9 B+ P5 w. g0 c# J9 l" e0 I4 I6 R$ _ - module_param(bcnt, int, S_IRUGO);
. {0 Z/ E2 u9 N! |+ U i - module_param(ccnt, int, S_IRUGO);
复制代码
9 P" @, m) m* H( m8 ^* S: e- H( z- Q, i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; d2 w" B& E& B5 e0 H, [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 t/ l3 H! {+ O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 S; l; s0 D2 {3 `7 O2 J8 V* R, Y5 {8 y
' P; \0 {1 ?9 l. i/ _1 `7 t, R
|
|